From 7f479d6cc756917a0321648664860818e1693eb6 Mon Sep 17 00:00:00 2001 From: Uwe Klotz Date: Thu, 11 Jan 2024 00:12:37 +0100 Subject: [PATCH] ItemKey: Distinguish between Bpm and IntegerBpm --- src/tag/item.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/tag/item.rs b/src/tag/item.rs index 03ce2a8a4..b6d022ae9 100644 --- a/src/tag/item.rs +++ b/src/tag/item.rs @@ -206,7 +206,7 @@ gen_map!( "TKEY" => InitialKey, "COLOR" => Color, "TMOO" => Mood, - "TBPM" => Bpm, + "TBPM" => IntegerBpm, "TCOP" => CopyrightMessage, "TDES" => PodcastDescription, "TCAT" => PodcastSeriesCategory, @@ -277,7 +277,8 @@ gen_map!( "\u{a9}gen" => Genre, "----:com.apple.iTunes:COLOR" => Color, "----:com.apple.iTunes:MOOD" => Mood, - "tmpo" | "----:com.apple.iTunes:BPM" => Bpm, // integer bpm (fourcc atom) vs. precise bpm (freeform atom) + "tmpo" => IntegerBpm, + "----:com.apple.iTunes:BPM" => Bpm, "----:com.apple.iTunes:initialkey" => InitialKey, "----:com.apple.iTunes:replaygain_album_gain" => ReplayGainAlbumGain, "----:com.apple.iTunes:replaygain_album_peak" => ReplayGainAlbumPeak, @@ -665,7 +666,18 @@ gen_item_keys!( InitialKey, Color, Mood, + /// Decimal BPM value with custom precision + /// + /// Only read and written if the tag format supports a field for decimal BPM values + /// that are not restricted to integer values. + /// + /// Not supported by ID3v2 that restricts BPM values to integers in `TBPM`. Bpm, + /// Non-fractional BPM value with integer precision + /// + /// Only read and written if the tag format has a field for integer BPM values, + /// e.g. ID3v2 (`TBPM`) and MP4 (`tmpo`). + IntegerBpm, // Legal CopyrightMessage,