diff options
Diffstat (limited to 'import/src/tmdb.rs')
| -rw-r--r-- | import/src/tmdb.rs | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/import/src/tmdb.rs b/import/src/tmdb.rs index ad99fde..414058f 100644 --- a/import/src/tmdb.rs +++ b/import/src/tmdb.rs @@ -6,17 +6,14 @@ use crate::USER_AGENT; use anyhow::{anyhow, bail, Context}; use jellycache::{async_cache_file, async_cache_memory, CachePath}; -use jellycommon::{ - chrono::{format::Parsed, Utc}, - TmdbKind, -}; +use jellycommon::chrono::{format::Parsed, Utc}; use log::info; use reqwest::{ header::{HeaderMap, HeaderName, HeaderValue}, Client, ClientBuilder, }; use serde::{Deserialize, Serialize}; -use std::sync::Arc; +use std::{fmt::Display, sync::Arc}; use tokio::io::AsyncWriteExt; pub struct Tmdb { @@ -164,6 +161,15 @@ pub fn parse_release_date(d: &str) -> anyhow::Result<Option<i64>> { Ok(Some(p.to_datetime_with_timezone(&Utc)?.timestamp_millis())) } +impl Display for TmdbKind { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(match self { + TmdbKind::Tv => "tv", + TmdbKind::Movie => "movie", + }) + } +} + #[derive(Debug, Clone, Serialize, Deserialize)] pub struct TmdbEpisode { pub air_date: String, @@ -176,6 +182,12 @@ pub struct TmdbEpisode { pub vote_count: usize, } +#[derive(Debug, Clone, Copy, Hash, Serialize, Deserialize)] +pub enum TmdbKind { + Tv, + Movie, +} + #[derive(Debug, Clone, Serialize, Deserialize)] pub struct TmdbPersonImage { pub id: u64, |