Model updates, bugfixes, and a new muxing cli tool

This commit is contained in:
2026-05-29 22:26:22 -06:00
parent cf4327389a
commit b6ad592951
32 changed files with 2246 additions and 453 deletions
+21 -1
View File
@@ -1,8 +1,10 @@
//! Deserializable types from the TMDB API
use core::str::FromStr;
use core::time::Duration;
use serde::{Deserialize, Deserializer};
use url::Url;
pub mod id;
@@ -22,6 +24,24 @@ fn duration_from_minutes<'de, D>(deserializer: D) -> Result<Duration, D::Error>
where
D: Deserializer<'de>,
{
let minutes = u64::deserialize(deserializer)?;
let minutes = u64::deserialize(deserializer).unwrap_or(0);
Ok(Duration::from_secs(minutes.saturating_mul(60)))
}
fn still_url_from_path<'de, D>(deserializer: D) -> Result<Option<Url>, D::Error>
where
D: Deserializer<'de>,
{
const TMDB_IMAGE_BASE: &str = "http://image.tmdb.org/t/p/";
const TMDB_IMAGE_QUALITY: &str = "original";
let path = Option::<&str>::deserialize(deserializer)?;
Ok(path.and_then(|path| {
Url::from_str(&format!(
"{}{}{}",
TMDB_IMAGE_BASE, TMDB_IMAGE_QUALITY, path
))
.ok()
}))
}