diff options
| author | metamuffin <metamuffin@disroot.org> | 2026-02-21 12:37:00 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2026-02-21 12:37:00 +0100 |
| commit | e6b999628da34713fb0686e094b2b7aceb26b989 (patch) | |
| tree | 8b5ede21b85f7f3d660bc3cd156ebc538860d70a | |
| parent | 276da3a082333b2287eca2e0fb2127fc6d1619e5 (diff) | |
| download | jellything-e6b999628da34713fb0686e094b2b7aceb26b989.tar jellything-e6b999628da34713fb0686e094b2b7aceb26b989.tar.bz2 jellything-e6b999628da34713fb0686e094b2b7aceb26b989.tar.zst | |
cleanup
| -rw-r--r-- | import/src/lib.rs | 108 | ||||
| -rw-r--r-- | import/src/plugins/trakt.rs | 2 | ||||
| -rw-r--r-- | stream/src/hls.rs | 39 |
3 files changed, 23 insertions, 126 deletions
diff --git a/import/src/lib.rs b/import/src/lib.rs index ceda42f..ecb39db 100644 --- a/import/src/lib.rs +++ b/import/src/lib.rs @@ -565,114 +565,6 @@ pub fn is_useful_attachment(a: &AttachedFile) -> Option<&'static str> { } } -// for tok in filename_toks { -// apply_node_flag(db, rthandle, apis, node, tok)?; -// } - -// fn apply_musicbrainz_recording( -// db: &Database, -// rthandle: &Handle, -// apis: &Apis, -// node: NodeID, -// mbid: String, -// ) -> Result<()> { -// let rec = apis.musicbrainz.lookup_recording(mbid, rthandle)?; - -// db.update_node_init(node, |node| { -// node.title = Some(rec.title.clone()); -// node.identifiers -// .insert(IdentifierType::MusicbrainzRecording, rec.id.to_string()); -// if let Some(a) = rec.artist_credit.first() { -// node.subtitle = Some(a.artist.name.clone()); -// node.identifiers -// .insert(IdentifierType::MusicbrainzArtist, 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() { -// INSTRUMENT => Some(("", CreditCategory::Instrument)), -// VOCAL => Some(("", CreditCategory::Vocal)), -// PRODUCER => Some(("", CreditCategory::Producer)), -// MIX => Some(("mix ", CreditCategory::Engineer)), -// PHONOGRAPHIC_COPYRIGHT => { -// Some(("phonographic copyright ", CreditCategory::Engineer)) -// } -// PROGRAMMING => Some(("programming ", CreditCategory::Engineer)), -// _ => None, -// }; - -// if let Some((note, group)) = a { -// let artist = rel.artist.as_ref().unwrap(); - -// let artist = apis -// .musicbrainz -// .lookup_artist(artist.id.clone(), rthandle)?; - -// let mut image_1 = None; -// let mut image_2 = None; - -// for rel in &artist.relations { -// match rel.type_id.as_str() { -// WIKIDATA => { -// let url = rel.url.as_ref().unwrap().resource.clone(); -// if let Some(id) = url.strip_prefix("https://www.wikidata.org/wiki/") { -// if let Some(filename) = -// apis.wikidata.query_image_path(id.to_owned(), rthandle)? -// { -// image_1 = Some( -// apis.wikimedia_commons -// .image_by_filename(filename, rthandle)?, -// ); -// } -// } -// } -// VGMDB => { -// let url = rel.url.as_ref().unwrap().resource.clone(); -// if let Some(id) = url.strip_prefix("https://vgmdb.net/artist/") { -// let id = id.parse::<u64>().context("parse vgmdb id")?; -// if let Some(path) = apis.vgmdb.get_artist_image(id, rthandle)? { -// image_2 = Some(path); -// } -// } -// } -// _ => (), -// } -// } -// let mut jobs = vec![]; -// if !note.is_empty() { -// jobs.push(note.to_string()); -// } -// jobs.extend(rel.attributes.clone()); - -// let _headshot = match image_1.or(image_2) { -// Some(x) => x, -// None => Asset(cache_store( -// format!("fallback/{}.image", HashKey(&artist.sort_name)), -// || generate_fallback(&artist.sort_name), -// )?), -// }; - -// node.credits.entry(group).or_default().push(Appearance { -// jobs, -// characters: vec![], -// node: NodeID([0; 32]), // TODO -// }); -// } -// } - -// for isrc in &rec.isrcs { -// node.identifiers -// .insert(IdentifierType::Isrc, isrc.to_string()); -// } -// Ok(()) -// })?; -// Ok(()) -// } - // fn make_kebab(i: &str) -> String { // let mut o = String::with_capacity(i.len()); // for c in i.chars() { diff --git a/import/src/plugins/trakt.rs b/import/src/plugins/trakt.rs index bb4a1b0..c7ad53e 100644 --- a/import/src/plugins/trakt.rs +++ b/import/src/plugins/trakt.rs @@ -260,7 +260,7 @@ pub enum TraktPeopleGroup { Art, #[serde(rename = "crew")] Crew, - #[serde(rename = "costume & make-up")] //? they really use that in as a key?! + #[serde(rename = "costume & make-up")] CostumeMakeup, #[serde(rename = "directing")] Directing, diff --git a/stream/src/hls.rs b/stream/src/hls.rs index b8d04ef..9414877 100644 --- a/stream/src/hls.rs +++ b/stream/src/hls.rs @@ -24,23 +24,28 @@ pub fn hls_multivariant_stream( writeln!(out, "#EXT-X-VERSION:4")?; // writeln!(out, "#EXT-X-INDEPENDENT-SEGMENTS")?; for (i, t) in info.tracks.iter().enumerate() { - let uri = format!( - "stream{}", - StreamSpec::HlsVariant { - track: i, - container, - format: 0 - } - .to_query() - ); - let r#type = match t.kind { - TrackKind::Video => "VIDEO", - TrackKind::Audio => "AUDIO", - TrackKind::Subtitle => "SUBTITLES", - }; - // TODO bw - writeln!(out, "#EXT-X-STREAM-INF:BANDWIDTH=5000000,TYPE={type}")?; - writeln!(out, "{uri}")?; + for (j, f) in t.formats.iter().enumerate() { + let uri = format!( + "stream{}", + StreamSpec::HlsVariant { + track: i, + container, + format: j + } + .to_query() + ); + let r#type = match t.kind { + TrackKind::Video => "VIDEO", + TrackKind::Audio => "AUDIO", + TrackKind::Subtitle => "SUBTITLES", + }; + writeln!( + out, + "#EXT-X-STREAM-INF:BANDWIDTH={},TYPE={type}", + f.bitrate as i64 + )?; + writeln!(out, "{uri}")?; + } } Ok(Box::new(Cursor::new(out))) |