diff options
Diffstat (limited to 'import/src/plugins/infojson.rs')
| -rw-r--r-- | import/src/plugins/infojson.rs | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/import/src/plugins/infojson.rs b/import/src/plugins/infojson.rs index 3928e7a..6905e57 100644 --- a/import/src/plugins/infojson.rs +++ b/import/src/plugins/infojson.rs @@ -3,7 +3,10 @@ which is licensed under the GNU Affero General Public License (version 3); see /COPYING. Copyright (C) 2026 metamuffin <metamuffin.org> */ -use crate::plugins::{ImportPlugin, PluginContext, PluginInfo}; +use crate::{ + plugins::{ImportPlugin, PluginContext, PluginInfo}, + source_rank::ObjectImportSourceExt, +}; use anyhow::{Context, Result, anyhow}; use chrono::{Utc, format::Parsed}; use jellycommon::*; @@ -160,6 +163,7 @@ impl ImportPlugin for Infojson { fn info(&self) -> PluginInfo { PluginInfo { name: "infojson", + tag: MSOURCE_INFOJSON, handle_file: true, handle_media: true, ..Default::default() @@ -177,20 +181,20 @@ impl ImportPlugin for Infojson { ct.ic.db.transaction(&mut |txn| { let mut node = txn.get(parent)?.unwrap(); - node = node.as_object().insert(NO_KIND, KIND_CHANNEL); - node = node.as_object().insert(NO_TITLE, title); + node = node.as_object().insert_s(ct.is, NO_KIND, KIND_CHANNEL); + node = node.as_object().insert_s(ct.is, NO_TITLE, title); if let Some(cid) = &data.channel_id { node = node.as_object().update(NO_IDENTIFIERS, |ids| { - ids.insert(IDENT_YOUTUBE_CHANNEL, &cid) + ids.insert_s(ct.is, IDENT_YOUTUBE_CHANNEL, &cid) }); } if let Some(uid) = &data.uploader_id { node = node.as_object().update(NO_IDENTIFIERS, |ids| { - ids.insert(IDENT_YOUTUBE_CHANNEL_HANDLE, &uid) + ids.insert_s(ct.is, IDENT_YOUTUBE_CHANNEL_HANDLE, &uid) }) } if let Some(desc) = &data.description { - node = node.as_object().insert(NO_DESCRIPTION, &desc); + node = node.as_object().insert_s(ct.is, NO_DESCRIPTION, &desc); } if let Some(followers) = data.channel_follower_count { node = node.as_object().update(NO_RATINGS, |rat| { @@ -238,23 +242,23 @@ impl ImportPlugin for Infojson { ct.ic.db.transaction(&mut |txn| { let mut node = txn.get(row)?.unwrap(); - node = node.as_object().insert(NO_KIND, kind); - node = node.as_object().insert(NO_TITLE, &infojson.title); + node = node.as_object().insert_s(ct.is, NO_KIND, kind); + node = node.as_object().insert_s(ct.is, NO_TITLE, &infojson.title); if let Some(title) = &infojson.alt_title && title != &infojson.title && !node.as_object().has(NO_SUBTITLE.0) { - node = node.as_object().insert(NO_SUBTITLE, &title); + node = node.as_object().insert_s(ct.is, NO_SUBTITLE, &title); } if let Some(up) = &infojson.uploader && !node.as_object().has(NO_SUBTITLE.0) { node = node .as_object() - .insert(NO_SUBTITLE, &clean_uploader_name(&up)); + .insert_s(ct.is, NO_SUBTITLE, &clean_uploader_name(&up)); } if let Some(desc) = &infojson.description { - node = node.as_object().insert(NO_DESCRIPTION, &desc); + node = node.as_object().insert_s(ct.is, NO_DESCRIPTION, &desc); } if let Some(tag) = infojson.tags.clone() { node = node @@ -262,12 +266,12 @@ impl ImportPlugin for Infojson { .extend(NO_TAG, tag.iter().map(String::as_str)); } if let Some(rd) = release_date { - node = node.as_object().insert(NO_RELEASEDATE, rd); + node = node.as_object().insert_s(ct.is, NO_RELEASEDATE, rd); } match infojson.extractor.as_str() { "youtube" => { node = node.as_object().update(NO_IDENTIFIERS, |rat| { - rat.insert(IDENT_YOUTUBE_VIDEO, &infojson.id) + rat.insert_s(ct.is, IDENT_YOUTUBE_VIDEO, &infojson.id) }); node = node.as_object().update(NO_RATINGS, |rat| { rat.insert( @@ -284,7 +288,7 @@ impl ImportPlugin for Infojson { } "Bandcamp" => { node = node.as_object().update(NO_IDENTIFIERS, |rat| { - rat.insert(IDENT_BANDCAMP, &infojson.id) + rat.insert_s(ct.is, IDENT_BANDCAMP, &infojson.id) }); } _ => (), |