diff options
Diffstat (limited to 'import/src/plugins/tmdb.rs')
| -rw-r--r-- | import/src/plugins/tmdb.rs | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/import/src/plugins/tmdb.rs b/import/src/plugins/tmdb.rs index ab0a679..db336fe 100644 --- a/import/src/plugins/tmdb.rs +++ b/import/src/plugins/tmdb.rs @@ -6,6 +6,7 @@ use crate::{ USER_AGENT, plugins::{ImportPlugin, PluginContext, PluginInfo}, + source_rank::ObjectImportSourceExt, }; use anyhow::{Context, Result, anyhow, bail}; use chrono::{Utc, format::Parsed}; @@ -180,6 +181,7 @@ impl ImportPlugin for Tmdb { fn info(&self) -> PluginInfo { PluginInfo { name: "tmdb", + tag: MSOURCE_TMDB, handle_process: true, ..Default::default() } @@ -235,27 +237,31 @@ impl Tmdb { ct.ic.update_node(node, |mut node| { if let Some(title) = &details.title { - node = node.as_object().insert(NO_TITLE, &title); + node = node.as_object().insert_s(ct.is, NO_TITLE, &title); } if let Some(tagline) = &details.tagline { - node = node.as_object().insert(NO_TAGLINE, &tagline); + node = node.as_object().insert_s(ct.is, NO_TAGLINE, &tagline); } - node = node.as_object().insert(NO_DESCRIPTION, &details.overview); + node = node + .as_object() + .insert_s(ct.is, NO_DESCRIPTION, &details.overview); node = node.as_object().update(NO_RATINGS, |rat| { rat.insert(RTYP_TMDB, details.vote_average) }); if let Some(poster) = &poster { node = node .as_object() - .update(NO_PICTURES, |rat| rat.insert(PICT_COVER, &poster)); + .update(NO_PICTURES, |rat| rat.insert_s(ct.is, PICT_COVER, &poster)); } if let Some(backdrop) = &backdrop { - node = node - .as_object() - .update(NO_PICTURES, |rat| rat.insert(PICT_BACKDROP, &backdrop)); + node = node.as_object().update(NO_PICTURES, |rat| { + rat.insert_s(ct.is, PICT_BACKDROP, &backdrop) + }); } if let Some(releasedate) = release_date { - node = node.as_object().insert(NO_RELEASEDATE, releasedate); + node = node + .as_object() + .insert_s(ct.is, NO_RELEASEDATE, releasedate); } node })?; @@ -296,18 +302,22 @@ impl Tmdb { .context("still image download")?; let release_date = parse_release_date(&details.air_date)?; ct.ic.update_node(node, |mut node| { - node = node.as_object().insert(NO_TITLE, &details.name); - node = node.as_object().insert(NO_DESCRIPTION, &details.overview); + node = node.as_object().insert_s(ct.is, NO_TITLE, &details.name); + node = node + .as_object() + .insert_s(ct.is, NO_DESCRIPTION, &details.overview); if let Some(release_date) = release_date { - node = node.as_object().insert(NO_RELEASEDATE, release_date) + node = node + .as_object() + .insert_s(ct.is, NO_RELEASEDATE, release_date) } node = node.as_object().update(NO_RATINGS, |rat| { rat.insert(RTYP_TMDB, details.vote_average) }); if let Some(cover) = &cover { - node = node - .as_object() - .update(NO_PICTURES, |picts| picts.insert(PICT_COVER, &cover)); + node = node.as_object().update(NO_PICTURES, |picts| { + picts.insert_s(ct.is, PICT_COVER, &cover) + }); } node }) @@ -335,7 +345,7 @@ impl Tmdb { ct.ic.update_node(node, |node| { node.as_object() - .update(NO_PICTURES, |pict| pict.insert(PICT_COVER, &image)) + .update(NO_PICTURES, |pict| pict.insert_s(ct.is, PICT_COVER, &image)) })?; Ok(()) |