From 857071ff5f1333906b8571d6d7faf90d4aa62a80 Mon Sep 17 00:00:00 2001 From: Ayase <166034664+AyaseFile@users.noreply.github.com> Date: Sun, 14 Sep 2025 02:27:42 +0800 Subject: [PATCH 1/2] fix: incorrect disc number handling in ape tag writer --- lofty/src/ape/tag/mod.rs | 22 ++++++++++++++---- lofty/tests/files/wavpack.rs | 44 ++++++++++++++++++++++++++++++++++-- 2 files changed, 60 insertions(+), 6 deletions(-) diff --git a/lofty/src/ape/tag/mod.rs b/lofty/src/ape/tag/mod.rs index bf779a0af..04ff62c24 100644 --- a/lofty/src/ape/tag/mod.rs +++ b/lofty/src/ape/tag/mod.rs @@ -285,11 +285,11 @@ impl Accessor for ApeTag { } fn remove_disk_total(&mut self) { - let existing_track_number = self.track(); + let existing_disk_number = self.disk(); self.remove("Disc"); - if let Some(track) = existing_track_number { - self.insert(ApeItem::text("Disc", track.to_string())); + if let Some(disk) = existing_disk_number { + self.insert(ApeItem::text("Disc", disk.to_string())); } } @@ -564,7 +564,7 @@ pub(crate) fn tagitems_into_ape(tag: &Tag) -> impl Iterator Date: Mon, 15 Sep 2025 14:40:48 -0400 Subject: [PATCH 2/2] changelog: Add entry for APE tag fixes --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e4fc927d..705ad4b3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Some encoders will only write a BOM to the frame's description, rather than to every string in the frame. This was previously only supported in `SYLT` frames, and has been extended to `COMM` and `USLT`. - **Vorbis Comments**: Parse `TRACKNUMBER` with respect to `ParseOptions::implicit_conversions` ([issue](https://github.com/Serial-ATA/lofty-rs/issues/540)) ([PR](https://github.com/Serial-ATA/lofty-rs/issues/542)) +- **APE**: Fix disc number removal/writing ([issue](https://github.com/Serial-ATA/lofty-rs/issues/545)) ([PR](https://github.com/Serial-ATA/lofty-rs/pull/546)) ### Removed