diff --git a/picard/formats/id3.py b/picard/formats/id3.py index 30d2e85cd..67deb71d5 100644 --- a/picard/formats/id3.py +++ b/picard/formats/id3.py @@ -88,6 +88,7 @@ class ID3File(File): 'TMED': 'media', 'TBPM': 'bpm', 'WOAR': 'website', + 'WCOP': 'license', 'TSRC': 'isrc', 'TENC': 'encodedby', 'TCOP': 'copyright', @@ -114,6 +115,7 @@ class ID3File(File): 'Acoustid Fingerprint': 'acoustid_fingerprint', 'Acoustid Id': 'acoustid_id', 'SCRIPT': 'script', + 'LICENSE': 'license', 'ALBUMARTISTSORT': 'albumartistsort', 'CATALOGNUMBER': 'catalognumber', 'BARCODE': 'barcode', @@ -284,7 +286,11 @@ class ID3File(File): elif name in self.__rtranslate: frameid = self.__rtranslate[name] if frameid.startswith('W'): - tags.add(getattr(id3, frameid)(url=values[0])) + # Only add WCOP if there is only one license, otherwise use TXXX:LICENSE + if frameid == 'WCOP' and len(values) > 1: + tags.add(id3.TXXX(encoding=encoding, desc=self.__rtranslate_freetext[name], text=values)) + else: + tags.add(getattr(id3, frameid)(url=values[0])) elif frameid.startswith('T'): tags.add(getattr(id3, frameid)(encoding=encoding, text=values)) elif name in self.__rtranslate_freetext: diff --git a/picard/formats/mp4.py b/picard/formats/mp4.py index 7063cc08f..e85a426cf 100644 --- a/picard/formats/mp4.py +++ b/picard/formats/mp4.py @@ -89,6 +89,7 @@ class MP4File(File): "----:com.apple.iTunes:ISRC": "isrc", "----:com.apple.iTunes:MEDIA": "media", "----:com.apple.iTunes:LABEL": "label", + "----:com.apple.iTunes:LICENSE": "license", "----:com.apple.iTunes:CATALOGNUMBER": "catalognumber", "----:com.apple.iTunes:SUBTITLE": "subtitle", "----:com.apple.iTunes:DISCSUBTITLE": "discsubtitle", diff --git a/picard/mbxml.py b/picard/mbxml.py index 2efcf6ff7..dc33a0d00 100644 --- a/picard/mbxml.py +++ b/picard/mbxml.py @@ -109,6 +109,9 @@ def _relations_to_metadata(relation_lists, m, config): match = AMAZON_ASIN_URL_REGEX.match(url) if match is not None and 'asin' not in m: m['asin'] = match.group(2) + if relation.type == 'license': + url = relation.target[0].text + m.add('license', url) def _translate_artist_node(node, config=None): diff --git a/picard/util/tags.py b/picard/util/tags.py index 06115ae20..716784e39 100644 --- a/picard/util/tags.py +++ b/picard/util/tags.py @@ -39,6 +39,7 @@ tag_names = { 'mood': N_('Mood'), 'bpm': N_('BPM'), 'copyright': N_('Copyright'), + 'license': N_('License'), 'composer': N_('Composer'), 'conductor': N_('Conductor'), 'lyricist': N_('Lyricist'),