aboutsummaryrefslogtreecommitdiff
path: root/import/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'import/src/lib.rs')
-rw-r--r--import/src/lib.rs21
1 files changed, 20 insertions, 1 deletions
diff --git a/import/src/lib.rs b/import/src/lib.rs
index b93dbec..0d72da2 100644
--- a/import/src/lib.rs
+++ b/import/src/lib.rs
@@ -9,6 +9,7 @@ use anyhow::{anyhow, bail, Context, Result};
use infojson::YVideo;
use jellybase::{
assetfed::AssetInner,
+ cache::cache_file,
common::{Chapter, MediaInfo, Node, NodeID, NodeKind, Rating, SourceTrack, SourceTrackKind},
database::Database,
CONF, SECRETS,
@@ -17,6 +18,7 @@ use jellyclient::{
Appearance, LocalTrack, ObjectIds, PeopleGroup, Person, TmdbKind, TrackSource, TraktKind,
Visibility,
};
+use jellyimport_fallback_generator::generate_fallback;
use jellyremuxer::metadata::checked_matroska_metadata;
use log::info;
use musicbrainz::MusicBrainz;
@@ -702,6 +704,9 @@ fn apply_musicbrainz_recording(
.insert("musicbrainz.artist".to_string(), a.artist.id.to_string());
}
+ // // TODO proper dedup
+ // node.people.clear();
+
for rel in &rec.relations {
use musicbrainz::reltypes::*;
let a = match rel.type_id.as_str() {
@@ -757,6 +762,20 @@ fn apply_musicbrainz_recording(
jobs.push(note.to_string());
}
jobs.extend(rel.attributes.clone());
+
+ let headshot = match image_1.or(image_2) {
+ Some(x) => x,
+ None => AssetInner::Cache(cache_file(
+ "person-headshot-fallback",
+ &artist.sort_name,
+ |mut file| {
+ generate_fallback(&artist.sort_name, &mut file)?;
+ Ok(())
+ },
+ )?)
+ .ser(),
+ };
+
node.people.entry(group).or_default().push(Appearance {
jobs,
characters: vec![],
@@ -766,7 +785,7 @@ fn apply_musicbrainz_recording(
} else {
rel.target_credit.clone()
},
- headshot: image_1.or(image_2),
+ headshot: Some(headshot),
ids: ObjectIds::default(),
},
});