diff options
author | metamuffin <metamuffin@disroot.org> | 2025-01-30 15:47:16 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-01-30 15:47:16 +0100 |
commit | 32a05b5ec244d4d8143993b082f8d3f86a0a4ecd (patch) | |
tree | 4cc75a81ef77a424822c2f74e4c9008be0a0205f /import | |
parent | e588d058ec3d13501edd0b4a3ac86604934c78c5 (diff) | |
download | jellything-32a05b5ec244d4d8143993b082f8d3f86a0a4ecd.tar jellything-32a05b5ec244d4d8143993b082f8d3f86a0a4ecd.tar.bz2 jellything-32a05b5ec244d4d8143993b082f8d3f86a0a4ecd.tar.zst |
external ids
Diffstat (limited to 'import')
-rw-r--r-- | import/src/lib.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/import/src/lib.rs b/import/src/lib.rs index 10bd0ec..a22551e 100644 --- a/import/src/lib.rs +++ b/import/src/lib.rs @@ -72,6 +72,7 @@ fn import(db: &Database, incremental: bool) -> Result<()> { trakt: SECRETS.api.trakt.as_ref().map(|key| Trakt::new(key)), tmdb: SECRETS.api.tmdb.as_ref().map(|key| Tmdb::new(key)), }; + drop((apis.tmdb, apis.trakt)); while !queue_prev.is_empty() { queue_next = queue_prev @@ -160,6 +161,7 @@ fn import_file(db: &Database, path: &Path) -> Result<()> { "channel.info.json" => { let data = serde_json::from_reader::<_, YVideo>(BufReader::new(File::open(path)?))?; db.update_node_init(parent, |node| { + node.kind = Some(NodeKind::Channel); node.slug = parent_slug.to_string(); node.title = Some( data.title @@ -167,6 +169,11 @@ fn import_file(db: &Database, path: &Path) -> Result<()> { .unwrap_or(&data.title) .to_owned(), ); + node.external_ids + .insert("youtube".to_string(), data.channel_id); + if let Some(uid) = data.uploader_id { + node.external_ids.insert("youtube".to_string(), uid); + } node.description = Some(data.description); if let Some(followers) = data.channel_follower_count { node.ratings @@ -244,6 +251,7 @@ fn import_media_file(db: &Database, path: &Path, parent: NodeID) -> Result<()> { node.release_date = Some(infojson::parse_upload_date(date).context("parsing upload date")?); } + node.external_ids.insert("youtube".to_string(), infojson.id); node.ratings.insert( Rating::YoutubeViews, infojson.view_count.unwrap_or_default() as f64, |