From 4968bda92c6354b1298dd8bf2c38895b5ab64ec8 Mon Sep 17 00:00:00 2001 From: blissful Date: Fri, 26 Apr 2024 11:49:11 -0500 Subject: [PATCH] add other tag aliases from musicbrainz (#103) --- docs/TAGGING_CONVENTIONS.md | 88 +++++++++++++++++++------------------ rose/audiotags.py | 17 +++++-- 2 files changed, 60 insertions(+), 45 deletions(-) diff --git a/docs/TAGGING_CONVENTIONS.md b/docs/TAGGING_CONVENTIONS.md index e0b9053..b145822 100644 --- a/docs/TAGGING_CONVENTIONS.md +++ b/docs/TAGGING_CONVENTIONS.md @@ -12,6 +12,7 @@ Rosé manages the following tags: - Title - Release Artists - Release Year + - Composition Year (for Classical) - Release Type (e.g. Album, EP, Single) - Genre - Label @@ -105,51 +106,54 @@ world, Rosé will support reading from additional fields. ## MP3 -| Tag | Field Name | Will Ingest These Fields | -| --------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------- | -| Release Title | `TALB` | | -| Release Artists | `TPE2` | | -| Release Year | `TDRC` | `TYER` | -| Release Type | `TXXX:RELEASETYPE` | | -| Genre | `TCON` | | -| Label | `TPUB` | | -| Track Title | `TIT2` | | -| Track Artists | `TPE1` | `TPE4` (Remixer), `TCOM` (Composer), `TPE3` (Conductor), `TIPL,IPLS/producer` (producer), `TIPL,IPLS/DJ-mix` (djmixer) | -| Track Number | `TRCK` | | -| Disc Number | `TPOS` | | -| Rosé ID | `TXXX:ROSEID` | | -| Rosé Release ID | `TXXX:ROSERELEASEID` | | +| Tag | Field Name | Will Ingest These Fields | +| ---------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| Release Title | `TALB` | | +| Release Artists | `TPE2` | | +| Release Year | `TDRC` | `TYER`, `TDAT` | +| Release Type | `TXXX:RELEASETYPE` | `TXXX:MusicBrainz Album Type` | +| Genre | `TCON` | | +| Label | `TPUB` | | +| Track Title | `TIT2` | | +| Track Artists | `TPE1` | `TPE4` (Remixer), `TCOM` (Composer), `TPE3` (Conductor), `TIPL,IPLS/producer` (producer), `TIPL,IPLS/DJ-mix` (djmixer) | +| Track Number | `TRCK` | | +| Disc Number | `TPOS` | | +| Composition Year | `TXXX:COMPOSITIONYEAR ` | | +| Rosé ID | `TXXX:ROSEID` | | +| Rosé Release ID | `TXXX:ROSERELEASEID` | | ## MP4 -| Tag | Field Name | Will Ingest These Fields | -| --------------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| Release Title | `\xa9alb` | | -| Release Artists | `aART` | | -| Release Year | `\xa9day` | | -| Release Type | `----:com.apple.iTunes:RELEASETYPE` | | -| Genre | `\xa9gen` | | -| Label | `----:com.apple.iTunes:LABEL` | | -| Track Title | `\xa9nam` | | -| Track Artists | `\xa9ART` | `----:com.apple.iTunes:REMIXER` (Remixer), `\xa9wrt` (Composer), `----:com.apple.iTunes:CONDUCTOR` (Conductor), `----:com.apple.iTunes:PRODUCER` (producer), `----:com.apple.iTunes:DJMIXER` (djmixer) | -| Track Number | `trkn` | | -| Disc Number | `disk` | | -| Rosé ID | `----:net.sunsetglow.rose:ID` | | -| Rosé Release ID | `----:net.sunsetglow.rose:RELEASEID` | | +| Tag | Field Name | Will Ingest These Fields | +| ---------------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| Release Title | `\xa9alb` | | +| Release Artists | `aART` | | +| Release Year | `\xa9day` | | +| Release Type | `----:com.apple.iTunes:RELEASETYPE` | `----:com.apple.iTunes:MusicBrainz Album Type` | +| Genre | `\xa9gen` | | +| Label | `----:com.apple.iTunes:LABEL` | | +| Track Title | `\xa9nam` | | +| Track Artists | `\xa9ART` | `----:com.apple.iTunes:REMIXER` (Remixer), `\xa9wrt` (Composer), `----:com.apple.iTunes:CONDUCTOR` (Conductor), `----:com.apple.iTunes:PRODUCER` (producer), `----:com.apple.iTunes:DJMIXER` (djmixer) | +| Track Number | `trkn` | | +| Disc Number | `disk` | | +| Composition Year | `----:net.sunsetglow.rose:COMPOSITIONYEAR` | | +| Rosé ID | `----:net.sunsetglow.rose:ID` | | +| Rosé Release ID | `----:net.sunsetglow.rose:RELEASEID` | | ## Vorbis -| Tag | Field Name | Will Ingest These Fields | -| --------------- | --------------- | --------------------------------------------------------------------------------------------------------------- | -| Release Title | `release` | | -| Release Artists | `albumartist` | | -| Release Year | `date` | `year` | -| Release Type | `releasetype` | | -| Genre | `genre` | | -| Label | `organization` | `label`, `recordlabel` | -| Track Title | `title` | | -| Track Artists | `artist` | `remixer` (Remixer), `composer` (Composer), `conductor` (Conductor), `producer` (producer), `djmixer` (djmixer) | -| Track Number | `tracknumber` | | -| Disc Number | `discnumber` | | -| Rosé ID | `roseid` | | -| Rosé Release ID | `rosereleaseid` | | +| Tag | Field Name | Will Ingest These Fields | +| ---------------- | ----------------- | --------------------------------------------------------------------------------------------------------------- | +| Release Title | `release` | | +| Release Artists | `albumartist` | | +| Release Year | `date` | `year` | +| Release Type | `releasetype` | | +| Genre | `genre` | | +| Label | `label` | `organization`, `recordlabel` | +| Track Title | `title` | | +| Track Artists | `artist` | `remixer` (Remixer), `composer` (Composer), `conductor` (Conductor), `producer` (producer), `djmixer` (djmixer) | +| Track Number | `tracknumber` | | +| Disc Number | `discnumber` | | +| Composition Year | `compositionyear` | | +| Rosé ID | `roseid` | | +| Rosé Release ID | `rosereleaseid` | | diff --git a/rose/audiotags.py b/rose/audiotags.py index 81e2002..3c01b07 100644 --- a/rose/audiotags.py +++ b/rose/audiotags.py @@ -145,7 +145,7 @@ def _get_paired_frame(x: str) -> str | None: id=_get_tag(m.tags, ["TXXX:ROSEID"], first=True), release_id=_get_tag(m.tags, ["TXXX:ROSERELEASEID"], first=True), title=_get_tag(m.tags, ["TIT2"]), - releaseyear=_parse_year(_get_tag(m.tags, ["TDRC", "TYER"])), + releaseyear=_parse_year(_get_tag(m.tags, ["TDRC", "TYER", "TDAT"])), compositionyear=_parse_year(_get_tag(m.tags, ["TXXX:COMPOSITIONDATE"], first=True)), tracknumber=tracknumber, tracktotal=tracktotal, @@ -155,7 +155,11 @@ def _get_paired_frame(x: str) -> str | None: genre=_split_tag(_get_tag(m.tags, ["TCON"], split=True)), label=_split_tag(_get_tag(m.tags, ["TPUB"], split=True)), catalognumber=_get_tag(m.tags, ["TXXX:CATALOGNUMBER"], first=True), - releasetype=_normalize_rtype(_get_tag(m.tags, ["TXXX:RELEASETYPE"], first=True)), + releasetype=_normalize_rtype( + _get_tag( + m.tags, ["TXXX:RELEASETYPE", "TXXX:MusicBrainz Album Type"], first=True + ) + ), releaseartists=parse_artist_string(main=_get_tag(m.tags, ["TPE2"], split=True)), trackartists=parse_artist_string( main=_get_tag(m.tags, ["TPE1"], split=True), @@ -194,7 +198,14 @@ def _get_paired_frame(x: str) -> str | None: label=_split_tag(_get_tag(m.tags, ["----:com.apple.iTunes:LABEL"], split=True)), catalognumber=_get_tag(m.tags, ["----:com.apple.iTunes:CATALOGNUMBER"]), releasetype=_normalize_rtype( - _get_tag(m.tags, ["----:com.apple.iTunes:RELEASETYPE"], first=True) + _get_tag( + m.tags, + [ + "----:com.apple.iTunes:RELEASETYPE", + "----:com.apple.iTunes:MusicBrainz Album Type", + ], + first=True, + ) ), releaseartists=parse_artist_string(main=_get_tag(m.tags, ["aART"], split=True)), trackartists=parse_artist_string(