aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-01-16 10:57:40 +0100
committermetamuffin <metamuffin@disroot.org>2023-01-16 10:57:40 +0100
commit9f9449ddd58eb07d20e14e7a75c7387c9cc17ebe (patch)
tree52e39085589303d3d2e386a3575152fb6594bb61 /common
parente3f1a8ac9f4c9a015e9eac769fb3262e3bd16bad (diff)
downloadjellything-9f9449ddd58eb07d20e14e7a75c7387c9cc17ebe.tar
jellything-9f9449ddd58eb07d20e14e7a75c7387c9cc17ebe.tar.bz2
jellything-9f9449ddd58eb07d20e14e7a75c7387c9cc17ebe.tar.zst
write more code
Diffstat (limited to 'common')
-rw-r--r--common/src/impl.rs11
-rw-r--r--common/src/lib.rs11
2 files changed, 14 insertions, 8 deletions
diff --git a/common/src/impl.rs b/common/src/impl.rs
new file mode 100644
index 0000000..0808eb8
--- /dev/null
+++ b/common/src/impl.rs
@@ -0,0 +1,11 @@
+use crate::SourceTrackKind;
+
+impl SourceTrackKind {
+ pub fn letter(&self) -> char {
+ match self {
+ SourceTrackKind::Video { .. } => 'v',
+ SourceTrackKind::Audio { .. } => 'a',
+ SourceTrackKind::Subtitles => 's',
+ }
+ }
+}
diff --git a/common/src/lib.rs b/common/src/lib.rs
index e329d2e..d5fc3fc 100644
--- a/common/src/lib.rs
+++ b/common/src/lib.rs
@@ -1,6 +1,7 @@
-use std::{collections::BTreeMap, path::PathBuf};
+pub mod r#impl;
use serde::{Deserialize, Serialize};
+use std::collections::BTreeMap;
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct DirectoryInfo {
@@ -10,12 +11,6 @@ pub struct DirectoryInfo {
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ItemInfo {
pub title: String,
- pub source: Source,
-}
-
-#[derive(Debug, Clone, Deserialize, Serialize)]
-pub struct Source {
- pub path: PathBuf,
pub tracks: BTreeMap<u64, SourceTrack>,
}
@@ -28,7 +23,7 @@ pub struct SourceTrack {
}
#[derive(Debug, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "snake_case", tag = "kind")]
+#[serde(rename_all = "snake_case")]
pub enum SourceTrackKind {
Video {
width: u64,