aboutsummaryrefslogtreecommitdiff
path: root/common/src
diff options
context:
space:
mode:
Diffstat (limited to 'common/src')
-rw-r--r--common/src/impl.rs11
-rw-r--r--common/src/lib.rs12
2 files changed, 15 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..a75f599 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,7 @@ 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 duration: f64, // in seconds
pub tracks: BTreeMap<u64, SourceTrack>,
}
@@ -28,7 +24,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,