diff options
| author | metamuffin <metamuffin@disroot.org> | 2025-11-30 15:47:20 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2025-11-30 15:47:20 +0100 |
| commit | e4584a8135584e6591bac7d5397cf227cf3cff92 (patch) | |
| tree | 5f3c2bdd19bbad2a9358f8de2de7f5b6c2846ed8 /import/src | |
| parent | 8174d129fbabd2d39323678d11d868893ddb429a (diff) | |
| download | jellything-e4584a8135584e6591bac7d5397cf227cf3cff92.tar jellything-e4584a8135584e6591bac7d5397cf227cf3cff92.tar.bz2 jellything-e4584a8135584e6591bac7d5397cf227cf3cff92.tar.zst | |
eid fixes
Diffstat (limited to 'import/src')
| -rw-r--r-- | import/src/lib.rs | 14 | ||||
| -rw-r--r-- | import/src/trakt.rs | 17 |
2 files changed, 20 insertions, 11 deletions
diff --git a/import/src/lib.rs b/import/src/lib.rs index 3cbabdc..af13316 100644 --- a/import/src/lib.rs +++ b/import/src/lib.rs @@ -890,7 +890,10 @@ fn apply_trakt_tmdb( } for (group, people) in people.crew.iter() { for p in people { - people_map.entry(group.a()).or_default().push(p.a()) + people_map + .entry(group.as_credit_category()) + .or_default() + .push(p.a()) } } @@ -932,14 +935,7 @@ fn apply_trakt_tmdb( db.update_node_init(node, |node| { node.title = Some(data.title.clone()); node.credits.extend(people_map); - node.kind = match trakt_kind { - TraktKind::Movie => NodeKind::Movie, - TraktKind::Show => NodeKind::Show, - TraktKind::Season => NodeKind::Season, - TraktKind::Episode => NodeKind::Episode, - TraktKind::Person => NodeKind::Channel, - TraktKind::User => NodeKind::Channel, - }; + node.kind = trakt_kind.as_node_kind(); if let Some(overview) = &data.overview { node.description = Some(overview.clone()) } diff --git a/import/src/trakt.rs b/import/src/trakt.rs index 1640ca5..4a4beea 100644 --- a/import/src/trakt.rs +++ b/import/src/trakt.rs @@ -6,7 +6,7 @@ use crate::USER_AGENT; use anyhow::Context; use jellycache::{cache_memory, CacheKey}; -use jellycommon::{Appearance, CreditCategory, NodeID}; +use jellycommon::{Appearance, CreditCategory, NodeID, NodeKind}; use log::info; use reqwest::{ header::{HeaderMap, HeaderName, HeaderValue}, @@ -253,7 +253,7 @@ pub enum TraktPeopleGroup { CreatedBy, } impl TraktPeopleGroup { - pub fn a(self) -> CreditCategory { + pub fn as_credit_category(self) -> CreditCategory { match self { TraktPeopleGroup::Production => CreditCategory::Production, TraktPeopleGroup::Art => CreditCategory::Art, @@ -339,6 +339,19 @@ pub enum TraktKind { } impl TraktKind { + pub fn as_node_kind(self) -> NodeKind { + match self { + TraktKind::Movie => NodeKind::Movie, + TraktKind::Show => NodeKind::Show, + TraktKind::Season => NodeKind::Season, + TraktKind::Episode => NodeKind::Episode, + TraktKind::Person => NodeKind::Channel, + TraktKind::User => NodeKind::Channel, + } + } +} + +impl TraktKind { pub fn singular(self) -> &'static str { match self { TraktKind::Movie => "movie", |