Skip to content

Commit 55b024c

Browse files
ItemKey: Add ItemKey::ReleaseCountry (#573)
Co-authored-by: Serial <69764315+Serial-ATA@users.noreply.github.com>
1 parent 0805a4c commit 55b024c

File tree

3 files changed

+89
-79
lines changed

3 files changed

+89
-79
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
- In formats like Vorbis Comments, `ItemKey::Lyrics` may actually contain synchronized lyrics in LRC format. To help with the ambiguity, some
1616
apps may write a separate field containing normal, unsynchronized lyrics.
1717
- In other formats where the difference doesn't matter (like ID3v2), this will act exactly the same as `ItemKey::Lyrics`.
18+
- `ItemKey::ReleaseCountry` ([PR](https://github.com/Serial-ATA/lofty-rs/pull/573))
19+
- Currently, this maps to the [fields](https://picard-docs.musicbrainz.org/en/appendices/tag_mapping.html#id30) used by MusicBrainz Picard, which expect an
20+
ISO 3166-1 code.
1821
- **Serde**: [Serde] support for `*Type` enums (`FileType`, `TagType`, `PictureType`)
1922
- Support can be enabled with the new `serde` feature (not enabled by default)
2023
- **Probe**: `Probe::read_bound()` ([PR](https://github.com/Serial-ATA/lofty-rs/pull/557))

lofty/src/id3/v2/tag.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,6 +1420,7 @@ impl MergeTag for SplitTagRemainder {
14201420
ItemKey::MusicBrainzArtistId,
14211421
ItemKey::MusicBrainzReleaseArtistId,
14221422
ItemKey::MusicBrainzWorkId,
1423+
ItemKey::ReleaseCountry,
14231424
] {
14241425
let frame_id = item_key.map_key(TagType::Id3v2).expect("valid frame id");
14251426
if let Some(text) = join_text_items(&mut tag, [item_key]) {

lofty/src/tag/item.rs

Lines changed: 85 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ gen_map!(
9393
"MOVEMENTNAME" => Movement,
9494
"MOVEMENT" => MovementNumber,
9595
"MOVEMENTTOTAL" => MovementTotal,
96+
"RELEASECOUNTRY" => ReleaseCountry,
9697
"ALBUMSORT" => AlbumTitleSortOrder,
9798
"ALBUMARTISTSORT" => AlbumArtistSortOrder,
9899
"TITLESORT" => TrackTitleSortOrder,
@@ -244,91 +245,93 @@ gen_map!(
244245
"MusicBrainz Release Group Id" => MusicBrainzReleaseGroupId,
245246
"MusicBrainz Artist Id" => MusicBrainzArtistId,
246247
"MusicBrainz Album Artist Id" => MusicBrainzReleaseArtistId,
247-
"MusicBrainz Work Id" => MusicBrainzWorkId
248+
"MusicBrainz Work Id" => MusicBrainzWorkId,
249+
"MusicBrainz Album Release Country" => ReleaseCountry
248250
);
249251

250252
gen_map!(
251253
ILST_MAP;
252254

253-
"\u{a9}alb" => AlbumTitle,
254-
"----:com.apple.iTunes:DISCSUBTITLE" => SetSubtitle,
255-
"tvsh" => ShowName,
256-
"\u{a9}grp" => ContentGroup,
257-
"\u{a9}nam" => TrackTitle,
258-
"----:com.apple.iTunes:SUBTITLE" => TrackSubtitle,
259-
"\u{a9}wrk" => Work,
260-
"\u{a9}mvn" => Movement,
261-
"\u{a9}mvi" => MovementNumber,
262-
"\u{a9}mvc" => MovementTotal,
263-
"soal" => AlbumTitleSortOrder,
264-
"soaa" => AlbumArtistSortOrder,
265-
"sonm" => TrackTitleSortOrder,
266-
"soar" => TrackArtistSortOrder,
267-
"sosn" => ShowNameSortOrder,
268-
"soco" => ComposerSortOrder,
269-
"aART" => AlbumArtist,
270-
"----:com.apple.iTunes:ALBUMARTISTS" => AlbumArtists,
271-
"\u{a9}ART" => TrackArtist,
272-
"----:com.apple.iTunes:ARTISTS" => TrackArtists,
273-
"\u{a9}wrt" => Composer,
274-
"\u{a9}dir" => Director,
275-
"----:com.apple.iTunes:CONDUCTOR" => Conductor,
276-
"----:com.apple.iTunes:ENGINEER" => Engineer,
277-
"----:com.apple.iTunes:LYRICIST" => Lyricist,
278-
"----:com.apple.iTunes:DJMIXER" => MixDj,
279-
"----:com.apple.iTunes:MIXER" => MixEngineer,
280-
"----:com.apple.iTunes:PRODUCER" => Producer,
281-
"----:com.apple.iTunes:LABEL" => Label,
282-
"----:com.apple.iTunes:REMIXER" => Remixer,
283-
"disk" => DiscNumber,
284-
"disk" => DiscTotal,
285-
"trkn" => TrackNumber,
286-
"trkn" => TrackTotal,
287-
"rate" => Popularimeter,
288-
"rtng" => ParentalAdvisory,
289-
"\u{a9}day" => RecordingDate,
290-
"----:com.apple.iTunes:ORIGINALDATE" => OriginalReleaseDate, // TagLib v2.0
291-
"----:com.apple.iTunes:RELEASEDATE" => ReleaseDate,
292-
"----:com.apple.iTunes:ISRC" => Isrc,
293-
"----:com.apple.iTunes:BARCODE" => Barcode,
294-
"----:com.apple.iTunes:CATALOGNUMBER" => CatalogNumber,
295-
"cpil" => FlagCompilation,
296-
"pcst" => FlagPodcast,
297-
"----:com.apple.iTunes:MEDIA" => OriginalMediaType,
298-
"\u{a9}enc" => EncodedBy,
299-
"\u{a9}too" => EncoderSoftware,
300-
"\u{a9}gen" => Genre,
301-
"----:com.apple.iTunes:COLOR" => Color,
302-
"----:com.apple.iTunes:MOOD" => Mood,
303-
"tmpo" => IntegerBpm,
304-
"----:com.apple.iTunes:BPM" => Bpm,
305-
"----:com.apple.iTunes:initialkey" => InitialKey,
306-
"----:com.apple.iTunes:replaygain_album_gain" => ReplayGainAlbumGain,
307-
"----:com.apple.iTunes:replaygain_album_peak" => ReplayGainAlbumPeak,
308-
"----:com.apple.iTunes:replaygain_track_gain" => ReplayGainTrackGain,
309-
"----:com.apple.iTunes:replaygain_track_peak" => ReplayGainTrackPeak,
310-
"cprt" => CopyrightMessage,
311-
"----:com.apple.iTunes:LICENSE" => License,
312-
"ldes" => PodcastDescription,
313-
"catg" => PodcastSeriesCategory,
314-
"purl" => PodcastUrl,
315-
"egid" => PodcastGlobalUniqueId,
316-
"keyw" => PodcastKeywords,
317-
"\u{a9}cmt" => Comment,
318-
"desc" => Description,
319-
"----:com.apple.iTunes:LANGUAGE" => Language,
320-
"----:com.apple.iTunes:SCRIPT" => Script,
255+
"\u{a9}alb" => AlbumTitle,
256+
"----:com.apple.iTunes:DISCSUBTITLE" => SetSubtitle,
257+
"tvsh" => ShowName,
258+
"\u{a9}grp" => ContentGroup,
259+
"\u{a9}nam" => TrackTitle,
260+
"----:com.apple.iTunes:SUBTITLE" => TrackSubtitle,
261+
"\u{a9}wrk" => Work,
262+
"\u{a9}mvn" => Movement,
263+
"\u{a9}mvi" => MovementNumber,
264+
"\u{a9}mvc" => MovementTotal,
265+
"soal" => AlbumTitleSortOrder,
266+
"soaa" => AlbumArtistSortOrder,
267+
"sonm" => TrackTitleSortOrder,
268+
"soar" => TrackArtistSortOrder,
269+
"sosn" => ShowNameSortOrder,
270+
"soco" => ComposerSortOrder,
271+
"aART" => AlbumArtist,
272+
"----:com.apple.iTunes:ALBUMARTISTS" => AlbumArtists,
273+
"\u{a9}ART" => TrackArtist,
274+
"----:com.apple.iTunes:ARTISTS" => TrackArtists,
275+
"\u{a9}wrt" => Composer,
276+
"\u{a9}dir" => Director,
277+
"----:com.apple.iTunes:CONDUCTOR" => Conductor,
278+
"----:com.apple.iTunes:ENGINEER" => Engineer,
279+
"----:com.apple.iTunes:LYRICIST" => Lyricist,
280+
"----:com.apple.iTunes:DJMIXER" => MixDj,
281+
"----:com.apple.iTunes:MIXER" => MixEngineer,
282+
"----:com.apple.iTunes:PRODUCER" => Producer,
283+
"----:com.apple.iTunes:LABEL" => Label,
284+
"----:com.apple.iTunes:REMIXER" => Remixer,
285+
"disk" => DiscNumber,
286+
"disk" => DiscTotal,
287+
"trkn" => TrackNumber,
288+
"trkn" => TrackTotal,
289+
"rate" => Popularimeter,
290+
"rtng" => ParentalAdvisory,
291+
"\u{a9}day" => RecordingDate,
292+
"----:com.apple.iTunes:ORIGINALDATE" => OriginalReleaseDate, // TagLib v2.0
293+
"----:com.apple.iTunes:RELEASEDATE" => ReleaseDate,
294+
"----:com.apple.iTunes:ISRC" => Isrc,
295+
"----:com.apple.iTunes:BARCODE" => Barcode,
296+
"----:com.apple.iTunes:CATALOGNUMBER" => CatalogNumber,
297+
"cpil" => FlagCompilation,
298+
"pcst" => FlagPodcast,
299+
"----:com.apple.iTunes:MEDIA" => OriginalMediaType,
300+
"\u{a9}enc" => EncodedBy,
301+
"\u{a9}too" => EncoderSoftware,
302+
"\u{a9}gen" => Genre,
303+
"----:com.apple.iTunes:COLOR" => Color,
304+
"----:com.apple.iTunes:MOOD" => Mood,
305+
"tmpo" => IntegerBpm,
306+
"----:com.apple.iTunes:BPM" => Bpm,
307+
"----:com.apple.iTunes:initialkey" => InitialKey,
308+
"----:com.apple.iTunes:replaygain_album_gain" => ReplayGainAlbumGain,
309+
"----:com.apple.iTunes:replaygain_album_peak" => ReplayGainAlbumPeak,
310+
"----:com.apple.iTunes:replaygain_track_gain" => ReplayGainTrackGain,
311+
"----:com.apple.iTunes:replaygain_track_peak" => ReplayGainTrackPeak,
312+
"cprt" => CopyrightMessage,
313+
"----:com.apple.iTunes:LICENSE" => License,
314+
"ldes" => PodcastDescription,
315+
"catg" => PodcastSeriesCategory,
316+
"purl" => PodcastUrl,
317+
"egid" => PodcastGlobalUniqueId,
318+
"keyw" => PodcastKeywords,
319+
"\u{a9}cmt" => Comment,
320+
"desc" => Description,
321+
"----:com.apple.iTunes:LANGUAGE" => Language,
322+
"----:com.apple.iTunes:SCRIPT" => Script,
321323
// Don't know of any key for synchronized lyrics, nor if any apps actually support them, so
322324
// just treat both keys the same like ID3v2.
323-
"\u{a9}lyr" => Lyrics | UnsyncLyrics,
324-
"xid " => AppleXid,
325-
"----:com.apple.iTunes:MusicBrainz Track Id" => MusicBrainzRecordingId,
326-
"----:com.apple.iTunes:MusicBrainz Release Track Id" => MusicBrainzTrackId,
327-
"----:com.apple.iTunes:MusicBrainz Album Id" => MusicBrainzReleaseId,
328-
"----:com.apple.iTunes:MusicBrainz Release Group Id" => MusicBrainzReleaseGroupId,
329-
"----:com.apple.iTunes:MusicBrainz Artist Id" => MusicBrainzArtistId,
330-
"----:com.apple.iTunes:MusicBrainz Album Artist Id" => MusicBrainzReleaseArtistId,
331-
"----:com.apple.iTunes:MusicBrainz Work Id" => MusicBrainzWorkId
325+
"\u{a9}lyr" => Lyrics | UnsyncLyrics,
326+
"xid " => AppleXid,
327+
"----:com.apple.iTunes:MusicBrainz Track Id" => MusicBrainzRecordingId,
328+
"----:com.apple.iTunes:MusicBrainz Release Track Id" => MusicBrainzTrackId,
329+
"----:com.apple.iTunes:MusicBrainz Album Id" => MusicBrainzReleaseId,
330+
"----:com.apple.iTunes:MusicBrainz Release Group Id" => MusicBrainzReleaseGroupId,
331+
"----:com.apple.iTunes:MusicBrainz Artist Id" => MusicBrainzArtistId,
332+
"----:com.apple.iTunes:MusicBrainz Album Artist Id" => MusicBrainzReleaseArtistId,
333+
"----:com.apple.iTunes:MusicBrainz Work Id" => MusicBrainzWorkId,
334+
"----:com.apple.iTunes:MusicBrainz Album Release Country" => ReleaseCountry
332335
);
333336

334337
gen_map!(
@@ -351,7 +354,8 @@ gen_map!(
351354
"IGNR" => Genre,
352355
"ICOP" => CopyrightMessage,
353356
"ICMT" => Comment,
354-
"ILNG" => Language
357+
"ILNG" => Language,
358+
"ICNT" => ReleaseCountry
355359
);
356360

357361
gen_map!(
@@ -366,6 +370,7 @@ gen_map!(
366370
"MOVEMENTNAME" => Movement,
367371
"MOVEMENT" => MovementNumber,
368372
"MOVEMENTTOTAL" => MovementTotal,
373+
"RELEASECOUNTRY" => ReleaseCountry,
369374
"ALBUMSORT" => AlbumTitleSortOrder,
370375
"ALBUMARTISTSORT" => AlbumArtistSortOrder,
371376
"TITLESORT" => TrackTitleSortOrder,
@@ -605,6 +610,7 @@ gen_item_keys!(
605610
Movement,
606611
MovementNumber,
607612
MovementTotal,
613+
ReleaseCountry,
608614

609615
///////////////////////////////////////////////////////////////
610616
// MusicBrainz Identifiers

0 commit comments

Comments
 (0)