fix: update lofty 0.18 API calls to lofty 0.23

- Imports reorganized: use lofty::prelude::*, lofty::tag::*, lofty::picture::*
- Picture::new_unchecked -> Picture::unchecked().pic_type().mime_type().build()
- set_year/remove_year -> set_date/remove_date with Timestamp
- ItemKey::Unknown("ISRC") -> ItemKey::Isrc
- save_to_path(path) -> save_to_path(path, WriteOptions::default())
- get_string/remove_key now take ItemKey by value
- Bump qbz-library crate lofty dep to 0.23

cc
This commit is contained in:
victorrhgap committed 2026-03-31 09:32:02 -06:00
1 parent e229bbd7c3
commit a99d558e37
7 files changed
+40 -29

No files matched your search

+1 -1
View File
@@ -24,7 +24,7 @@ walkdir = "2"
dirs = "5"
# Audio metadata
lofty = "0.18"
lofty = "0.23"
# Image processing (thumbnails)
image = { version = "0.25", default-features = false, features = ["png", "jpeg", "webp"] }
+6 -4
View File
@@ -1,6 +1,8 @@
//! Metadata extraction for audio files
use lofty::{Accessor, AudioFile, ItemKey, Probe, TaggedFileExt};
use lofty::prelude::*;
use lofty::probe::Probe;
use lofty::tag::ItemKey;
use std::fs;
use std::path::{Path, PathBuf};
use std::time::{SystemTime, UNIX_EPOCH};
@@ -452,7 +454,7 @@ impl MetadataExtractor {
.or_else(|| fallback_artist.clone())
.unwrap_or_else(|| "Unknown Artist".to_string()),
album: album_title,
album_artist: tag.get_string(&ItemKey::AlbumArtist).map(|s| s.to_string()),
album_artist: tag.get_string(ItemKey::AlbumArtist).map(|s| s.to_string()),
album_group_key,
album_group_title,
track_number: tag
@@ -463,10 +465,10 @@ impl MetadataExtractor {
.disk()
.and_then(|d| if d > 0 { Some(d as u32) } else { None })
.or(inferred_disc),
year: tag.year().map(|y| y as u32),
year: tag.date().map(|ts| ts.year as u32),
genre: tag.genre().map(|s| s.to_string()),
catalog_number: tag
.get_string(&ItemKey::CatalogNumber)
.get_string(ItemKey::CatalogNumber)
.map(|s| s.to_string()),
duration_secs,
format,