diff --git a/picard/formats/id3.py b/picard/formats/id3.py index 3568fc664..f4b8f2ae9 100644 --- a/picard/formats/id3.py +++ b/picard/formats/id3.py @@ -25,6 +25,7 @@ from picard.metadata import Metadata from picard.file import File from picard.formats.mutagenext import compatid3 from picard.util import encode_filename, sanitize_date +from urlparse import urlparse # Ugly, but... I need to save the text in ISO-8859-1 even if it contains @@ -92,6 +93,7 @@ class ID3File(File): 'TMED': 'media', 'TBPM': 'bpm', 'WOAR': 'website', + 'WCOP': 'license', 'TSRC': 'isrc', 'TENC': 'encodedby', 'TCOP': 'copyright', @@ -119,6 +121,7 @@ class ID3File(File): 'Acoustid Fingerprint': 'acoustid_fingerprint', 'Acoustid Id': 'acoustid_id', 'SCRIPT': 'script', + 'LICENSE': 'license', 'CATALOGNUMBER': 'catalognumber', 'BARCODE': 'barcode', 'ASIN': 'asin', @@ -287,7 +290,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 URL, otherwise use TXXX:LICENSE + if frameid == 'WCOP' and len(values) == 1 and all(urlparse(values[0])[:2]): + tags.add(getattr(id3, frameid)(url=values[0])) + else: + tags.add(id3.TXXX(encoding=encoding, desc=self.__rtranslate_freetext[name], text=values)) elif frameid.startswith('T'): tags.add(getattr(id3, frameid)(encoding=encoding, text=values)) if frameid == 'TSOA': 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'),