diff options
Diffstat (limited to 'import')
| -rw-r--r-- | import/Cargo.toml | 14 | ||||
| -rw-r--r-- | import/asset_token/Cargo.toml | 10 | ||||
| -rw-r--r-- | import/asset_token/src/lib.rs | 6 | ||||
| -rw-r--r-- | import/fallback_generator/Cargo.toml | 6 | ||||
| -rw-r--r-- | import/fallback_generator/src/lib.rs | 4 | ||||
| -rw-r--r-- | import/src/acoustid.rs | 4 | ||||
| -rw-r--r-- | import/src/lib.rs | 7 | ||||
| -rw-r--r-- | import/src/musicbrainz.rs | 6 | ||||
| -rw-r--r-- | import/src/vgmdb.rs | 10 | ||||
| -rw-r--r-- | import/src/wikidata.rs | 8 | ||||
| -rw-r--r-- | import/src/wikimedia_commons.rs | 6 |
11 files changed, 51 insertions, 30 deletions
diff --git a/import/Cargo.toml b/import/Cargo.toml index d0b16b4..4c638f4 100644 --- a/import/Cargo.toml +++ b/import/Cargo.toml @@ -11,22 +11,22 @@ jellydb = { path = "../database" } jellyimport-fallback-generator = { path = "fallback_generator" } jellyimport-asset-token = { path = "asset_token" } -rayon = "1.10.0" -crossbeam-channel = "0.5.14" +rayon = "1.11.0" +crossbeam-channel = "0.5.15" log = { workspace = true } -anyhow = "1.0.95" +anyhow = "1.0.100" reqwest = { workspace = true } urlencoding = "2.1.3" -bincode = { version = "2.0.0-rc.3", features = ["derive"] } -serde = { version = "1.0.217", features = ["derive"] } -serde_json = "1.0.138" +bincode = { version = "2.0.1", features = ["derive"] } +serde = { version = "1.0.228", features = ["derive"] } +serde_json = "1.0.145" serde_yaml = "0.9.34" async-recursion = "1.1.1" futures = "0.3.31" tokio = { workspace = true } -regex = "1.11.1" +regex = "1.12.2" base64 = "0.22.1" diff --git a/import/asset_token/Cargo.toml b/import/asset_token/Cargo.toml index af20507..a85fcd2 100644 --- a/import/asset_token/Cargo.toml +++ b/import/asset_token/Cargo.toml @@ -6,15 +6,15 @@ edition = "2021" [dependencies] jellycommon = { path = "../../common" } jellycache = { path = "../../cache" } -serde = { version = "1.0.217", features = ["derive"] } +serde = { version = "1.0.228", features = ["derive"] } serde_yaml = "0.9.34" log = { workspace = true } -sha2 = "0.10.8" +sha2 = "0.10.9" base64 = "0.22.1" tokio = { workspace = true } -anyhow = "1.0.95" +anyhow = "1.0.100" bincode = { version = "2.0.1", features = ["serde"] } -rand = "0.9.0" -serde_json = "1.0.138" +rand = "0.9.2" +serde_json = "1.0.145" aes-gcm-siv = "0.11.1" humansize = "2.1.3" diff --git a/import/asset_token/src/lib.rs b/import/asset_token/src/lib.rs index 6f4ad7a..0a120f0 100644 --- a/import/asset_token/src/lib.rs +++ b/import/asset_token/src/lib.rs @@ -3,10 +3,7 @@ which is licensed under the GNU Affero General Public License (version 3); see /COPYING. Copyright (C) 2025 metamuffin <metamuffin.org> */ -use aes_gcm_siv::{ - aead::{generic_array::GenericArray, Aead}, - Aes256GcmSiv, KeyInit, -}; +use aes_gcm_siv::{aead::Aead, Aes256GcmSiv, KeyInit}; use anyhow::{anyhow, bail, Context}; use base64::Engine; use bincode::{Decode, Encode}; @@ -15,6 +12,7 @@ pub use jellycommon as common; use jellycommon::{Asset, LocalTrack}; use log::warn; use serde::{Deserialize, Serialize}; +use sha2::digest::generic_array::GenericArray; use std::sync::Mutex; use std::{path::PathBuf, sync::LazyLock}; diff --git a/import/fallback_generator/Cargo.toml b/import/fallback_generator/Cargo.toml index 13823ba..6851107 100644 --- a/import/fallback_generator/Cargo.toml +++ b/import/fallback_generator/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2024" [dependencies] -ab_glyph = "0.2.29" +ab_glyph = "0.2.32" imageproc = "0.25.0" -image = { version = "0.25.6", default-features = false, features = ["qoi"] } -anyhow = "1.0.98" +image = { version = "0.25.8", default-features = false, features = ["qoi"] } +anyhow = "1.0.100" diff --git a/import/fallback_generator/src/lib.rs b/import/fallback_generator/src/lib.rs index eef40fe..0fcfaa1 100644 --- a/import/fallback_generator/src/lib.rs +++ b/import/fallback_generator/src/lib.rs @@ -28,14 +28,14 @@ pub fn generate_fallback(name: &str, output: &mut dyn Write) -> Result<()> { .unwrap(); let mut bgtext = text.to_string(); - bgtext.remove_matches(&[',', ' ']); + bgtext.remove_matches([',', ' ']); let bgtext = bgtext.repeat(3); let scale = PxScale { x: 1000., y: 1000. }; let (w, h) = text_size(scale, &font, &bgtext); for i in -1..4 { draw_text_mut( &mut image, - random_accent(&text, 0.6), + random_accent(text, 0.6), width as i32 / 2 - w as i32 / 2 + i * h as i32, i * h as i32 * 2 / 3, scale, diff --git a/import/src/acoustid.rs b/import/src/acoustid.rs index cbdfc7a..a328146 100644 --- a/import/src/acoustid.rs +++ b/import/src/acoustid.rs @@ -83,7 +83,7 @@ impl AcoustID { pub async fn get_atid_mbid(&self, fp: &Fingerprint) -> Result<Option<(String, String)>> { let res = self.lookup(fp.to_owned()).await?; for r in &res.results { - if let Some(k) = r.recordings.get(0) { + if let Some(k) = r.recordings.first() { return Ok(Some((r.id.clone(), k.id.clone()))); } } @@ -103,7 +103,7 @@ impl AcoustID { let resp = self .client - .post(format!("https://api.acoustid.org/v2/lookup")) + .post("https://api.acoustid.org/v2/lookup".to_string()) .header("Content-Type", "application/x-www-form-urlencoded") .body(body) .send() diff --git a/import/src/lib.rs b/import/src/lib.rs index 4a6d87b..1fd8bc7 100644 --- a/import/src/lib.rs +++ b/import/src/lib.rs @@ -82,7 +82,7 @@ static CONF: LazyLock<Config> = LazyLock::new(|| { .expect("import config not preloaded. logic error") }); -pub const USER_AGENT: &'static str = concat!( +pub const USER_AGENT: &str = concat!( "jellything/", env!("CARGO_PKG_VERSION"), " +https://codeberg.org/metamuffin/jellything" @@ -401,8 +401,7 @@ fn import_media_file( .transpose()?; let mut tags = m - .tags - .get(0) + .tags.first() .map(|tags| { tags.tags .iter() @@ -773,7 +772,7 @@ fn apply_musicbrainz_recording( node.title = Some(rec.title.clone()); node.external_ids .insert("musicbrainz.recording".to_string(), rec.id.to_string()); - if let Some(a) = rec.artist_credit.get(0) { + if let Some(a) = rec.artist_credit.first() { node.subtitle = Some(a.artist.name.clone()); node.external_ids .insert("musicbrainz.artist".to_string(), a.artist.id.to_string()); diff --git a/import/src/musicbrainz.rs b/import/src/musicbrainz.rs index e4f38da..934a9e8 100644 --- a/import/src/musicbrainz.rs +++ b/import/src/musicbrainz.rs @@ -191,6 +191,12 @@ pub struct MbUrl { pub resource: String, } +impl Default for MusicBrainz { + fn default() -> Self { + Self::new() + } +} + impl MusicBrainz { const MAX_PAR_REQ: usize = 4; pub fn new() -> Self { diff --git a/import/src/vgmdb.rs b/import/src/vgmdb.rs index 6278aaa..20a0038 100644 --- a/import/src/vgmdb.rs +++ b/import/src/vgmdb.rs @@ -32,6 +32,12 @@ static RE_IMAGE_URL_FROM_HTML: LazyLock<Regex> = LazyLock::new(|| { Regex::new(r#"href='(?<url>https://media.vgm.io/artists/[-/\w\.]+)'"#).unwrap() }); +impl Default for Vgmdb { + fn default() -> Self { + Self::new() + } +} + impl Vgmdb { pub fn new() -> Self { let client = ClientBuilder::new() @@ -79,11 +85,11 @@ impl Vgmdb { return Ok(Some(url.to_string())); } } - return Ok(None); + Ok(None) } pub async fn scrape_artist_page(&self, id: u64) -> Result<Arc<String>> { - async_cache_memory("api-vgmdb-artist", id.clone(), || async move { + async_cache_memory("api-vgmdb-artist", id, || async move { let _permit = self.rate_limit.clone().acquire_owned().await?; let permit_drop_ts = Instant::now() + Duration::from_secs(1); info!("scrape artist: {id}"); diff --git a/import/src/wikidata.rs b/import/src/wikidata.rs index 1b7f06e..71eef9a 100644 --- a/import/src/wikidata.rs +++ b/import/src/wikidata.rs @@ -63,6 +63,12 @@ pub mod properties { pub static IMAGE: &str = "P18"; } +impl Default for Wikidata { + fn default() -> Self { + Self::new() + } +} + impl Wikidata { pub fn new() -> Self { let client = ClientBuilder::new() @@ -118,6 +124,6 @@ impl Wikidata { .await .context("wikidata entity")?; - Ok(serde_json::from_str(&json).context("parse wikidata entity")?) + serde_json::from_str(&json).context("parse wikidata entity") } } diff --git a/import/src/wikimedia_commons.rs b/import/src/wikimedia_commons.rs index a5889fb..f8d8f53 100644 --- a/import/src/wikimedia_commons.rs +++ b/import/src/wikimedia_commons.rs @@ -17,6 +17,12 @@ use tokio::io::AsyncWriteExt; pub struct WikimediaCommons { client: Client, } +impl Default for WikimediaCommons { + fn default() -> Self { + Self::new() + } +} + impl WikimediaCommons { pub fn new() -> Self { let client = ClientBuilder::new() |