From e4584a8135584e6591bac7d5397cf227cf3cff92 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sun, 30 Nov 2025 15:47:20 +0100 Subject: eid fixes --- import/src/lib.rs | 14 +++++--------- import/src/trakt.rs | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 11 deletions(-) (limited to 'import/src') 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, @@ -338,6 +338,19 @@ pub enum TraktKind { User, } +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 { -- cgit v1.3