diff --git a/picard/formats/apev2.py b/picard/formats/apev2.py index ef239e9fe..01bfa124e 100644 --- a/picard/formats/apev2.py +++ b/picard/formats/apev2.py @@ -92,6 +92,7 @@ class APEv2File(File): __translate = { "albumartist": "Album Artist", "remixer": "MixArtist", + "director": "Director", "website": "Weblink", "discsubtitle": "DiscSubtitle", "bpm": "BPM", diff --git a/picard/formats/asf.py b/picard/formats/asf.py index f147eb0ec..40209ed3d 100644 --- a/picard/formats/asf.py +++ b/picard/formats/asf.py @@ -184,6 +184,7 @@ class ASFFile(File): 'djmixer': 'WM/DJMixer', 'mixer': 'WM/Mixer', 'artists': 'WM/ARTISTS', + 'director': 'WM/Director', 'work': 'WM/Work', 'website': 'WM/AuthorURL', } diff --git a/picard/formats/id3.py b/picard/formats/id3.py index 55d2b5a95..b47a8ae31 100644 --- a/picard/formats/id3.py +++ b/picard/formats/id3.py @@ -193,6 +193,7 @@ class ID3File(File): 'ASIN': 'asin', 'MusicMagic Fingerprint': 'musicip_fingerprint', 'ARTISTS': 'artists', + 'DIRECTOR': 'director', 'WORK': 'work', 'Writer': 'writer', 'SHOWMOVEMENT': 'showmovement', diff --git a/picard/formats/mp4.py b/picard/formats/mp4.py index b5254e517..1d2306a65 100644 --- a/picard/formats/mp4.py +++ b/picard/formats/mp4.py @@ -80,6 +80,7 @@ class MP4File(File): "\xa9lyr": "lyrics", "\xa9cmt": "comment", "\xa9too": "encodedby", + "\xa9dir": "director", "cprt": "copyright", "soal": "albumsort", "soaa": "albumartistsort", diff --git a/picard/mbjson.py b/picard/mbjson.py index 56ae1ab9c..6d58325c6 100644 --- a/picard/mbjson.py +++ b/picard/mbjson.py @@ -54,6 +54,7 @@ _artist_rel_types = { # "recording": "engineer", "remixer": "remixer", "sound": "engineer", + "video director": "director", "vocal arranger": "arranger", "writer": "writer", } diff --git a/picard/util/tags.py b/picard/util/tags.py index 0f426f184..ccf721e53 100644 --- a/picard/util/tags.py +++ b/picard/util/tags.py @@ -52,6 +52,7 @@ TAG_NAMES = { 'conductor': N_('Conductor'), 'copyright': N_('Copyright'), 'date': N_('Date'), + 'director': N_('Video Director'), 'discid': N_('Disc Id'), 'discnumber': N_('Disc Number'), 'discsubtitle': N_('Disc Subtitle'), diff --git a/test/data/ws_data/recording_video.json b/test/data/ws_data/recording_video.json new file mode 100644 index 000000000..8bca39f6c --- /dev/null +++ b/test/data/ws_data/recording_video.json @@ -0,0 +1,238 @@ +{ + "video": true, + "id": "370889ee-7a70-4d0a-8f4d-e514e0494d7e", + "first-release-date": "2008-05-23", + "aliases": [], + "length": 218000, + "artist-credit": [ + { + "artist": { + "disambiguation": "British metal / hard rock band", + "type-id": "e431f5f6-b5d2-343d-8b36-72607fffb74b", + "type": "Group", + "sort-name": "Paradise Lost", + "aliases": [], + "id": "10bf95b6-30e3-44f1-817f-45762cdc0de0", + "name": "Paradise Lost" + }, + "joinphrase": "", + "name": "Paradise Lost" + } + ], + "disambiguation": "official music video", + "title": "The Enemy", + "relations": [ + { + "source-credit": "", + "target-type": "artist", + "begin": null, + "direction": "backward", + "attribute-values": {}, + "target-credit": "Edward 209", + "end": null, + "type-id": "5c0ceac3-feb4-41f0-868d-dc06f6e27fc0", + "artist": { + "disambiguation": "", + "type-id": "b6e035f4-3ce9-331c-97df-83397230b0df", + "type": "Person", + "sort-name": "Mavskegg, Edward", + "name": "Edward Mavskegg", + "id": "9e26b912-16c1-4dac-991e-87f7aa184fed" + }, + "attribute-ids": {}, + "attributes": [], + "type": "producer", + "ended": false + }, + { + "direction": "backward", + "begin": null, + "target-type": "artist", + "source-credit": "", + "artist": { + "name": "Edward Mavskegg", + "id": "9e26b912-16c1-4dac-991e-87f7aa184fed", + "sort-name": "Mavskegg, Edward", + "type": "Person", + "type-id": "b6e035f4-3ce9-331c-97df-83397230b0df", + "disambiguation": "" + }, + "type-id": "578ee04d-3227-4335-ba2c-11e8ba420e0b", + "end": null, + "target-credit": "Edward 209", + "attribute-values": {}, + "attribute-ids": {}, + "ended": false, + "attributes": [], + "type": "video director" + }, + { + "target-type": "recording", + "source-credit": "", + "begin": null, + "direction": "backward", + "attribute-values": {}, + "target-credit": "", + "end": null, + "recording": { + "title": "The Enemy", + "disambiguation": "", + "artist-credit": [ + { + "artist": { + "type": null, + "type-id": null, + "disambiguation": "British metal / hard rock band", + "id": "10bf95b6-30e3-44f1-817f-45762cdc0de0", + "name": "Paradise Lost", + "sort-name": "Paradise Lost" + }, + "joinphrase": "", + "name": "Paradise Lost" + } + ], + "id": "20ac46d2-aa41-45e0-b3f4-8b660560c696", + "length": 219066, + "video": false + }, + "type-id": "ce3de655-7451-44d1-9224-87eb948c205d", + "attribute-ids": {}, + "type": "music video", + "attributes": [], + "ended": false + }, + { + "direction": "forward", + "begin": null, + "target-type": "url", + "source-credit": "", + "type-id": "7e41ef12-a124-4324-afdb-fdbae687a89c", + "end": null, + "target-credit": "", + "attribute-values": {}, + "attribute-ids": { + "video": "112054d5-e706-4dd8-99ea-09aabee36cd6" + }, + "url": { + "id": "96ebef7d-b7e5-4c58-b9d3-163715bc44bc", + "resource": "https://www.youtube.com/watch?v=O_HwMrrJ4M4" + }, + "ended": false, + "attributes": [ + "video" + ], + "type": "free streaming" + }, + { + "ended": false, + "url": { + "resource": "http://imvdb.com/video/paradise-lost/the-enemy", + "id": "6a0bcc4f-f290-4328-8ee1-c63fe45a7a46" + }, + "attributes": [], + "type": "other databases", + "attribute-ids": {}, + "type-id": "bc21877b-e993-42ed-a7ce-9187ec9b638f", + "end": null, + "target-credit": "", + "attribute-values": {}, + "direction": "forward", + "begin": null, + "target-type": "url", + "source-credit": "" + }, + { + "direction": "forward", + "source-credit": "", + "target-type": "work", + "begin": null, + "end": null, + "type-id": "a3005666-a872-32c3-ad06-98af558e99b0", + "attribute-values": {}, + "target-credit": "", + "attribute-ids": {}, + "work": { + "disambiguation": "", + "type": "Song", + "attributes": [], + "title": "The Enemy", + "relations": [ + { + "type": "composer", + "attributes": [], + "ended": false, + "attribute-ids": {}, + "attribute-values": {}, + "target-credit": "", + "end": null, + "artist": { + "type-id": "b6e035f4-3ce9-331c-97df-83397230b0df", + "type": "Person", + "disambiguation": "", + "sort-name": "Mackintosh, Gregor", + "name": "Gregor Mackintosh", + "id": "1d82791c-f3b0-4695-985a-35a3f6c7a014" + }, + "type-id": "d59d99ea-23d4-4a80-b066-edca32ee158f", + "target-type": "artist", + "source-credit": "", + "begin": null, + "direction": "backward" + }, + { + "attribute-ids": {}, + "ended": false, + "type": "lyricist", + "attributes": [], + "begin": null, + "target-type": "artist", + "source-credit": "", + "direction": "backward", + "target-credit": "", + "attribute-values": {}, + "artist": { + "id": "c77bf917-f24d-4e91-a140-12d1707f4428", + "name": "Nick Holmes", + "sort-name": "Holmes, Nick", + "disambiguation": "British metal vocalist", + "type": "Person", + "type-id": "b6e035f4-3ce9-331c-97df-83397230b0df" + }, + "type-id": "3e48faba-ec01-47fd-8e89-30e81161661c", + "end": null + }, + { + "attribute-ids": {}, + "ended": false, + "url": { + "resource": "http://lyrics.wikia.com/Paradise_Lost:The_Enemy", + "id": "ae13d5e0-075b-4d61-8102-9f66127c726f" + }, + "attributes": [], + "type": "lyrics", + "direction": "backward", + "begin": null, + "target-type": "url", + "source-credit": "", + "type-id": "e38e65aa-75e0-42ba-ace0-072aeb91a538", + "end": null, + "target-credit": "", + "attribute-values": {} + } + ], + "language": "eng", + "id": "9a186e42-bf73-3e91-9359-cc7b6579eeb8", + "iswcs": [ + "T-900.213.450-1" + ], + "languages": [ + "eng" + ], + "type-id": "f061270a-2fd6-32f1-a641-f0f8676d14e6" + }, + "attributes": [], + "type": "performance", + "ended": false + } + ] +} \ No newline at end of file diff --git a/test/formats/common.py b/test/formats/common.py index 4e1900018..da6f5835b 100644 --- a/test/formats/common.py +++ b/test/formats/common.py @@ -115,6 +115,7 @@ TAGS = { 'conductor': 'Foo', 'copyright': 'Foo', 'date': '2004', + 'director': 'Foo', 'discnumber': '1', 'discsubtitle': 'Foo', 'djmixer': 'Foo', diff --git a/test/test_mbjson.py b/test/test_mbjson.py index b79851b2d..a7613ff80 100644 --- a/test/test_mbjson.py +++ b/test/test_mbjson.py @@ -191,6 +191,7 @@ class RecordingTest(MBJSONTest): self.assertEqual(m['~length'], '4:41') self.assertEqual(m['~recordingtitle'], 'Thinking Out Loud') self.assertEqual(m['~recording_firstreleasedate'], '2014-06-20') + self.assertEqual(m['~video'], '') self.assertNotIn('originaldate', m) self.assertNotIn('originalyear', m) self.assertEqual(t.genres, { @@ -223,6 +224,19 @@ class RecordingInstrumentalTest(MBJSONTest): self.assertNotIn('lyricist', m) +class RecordingVideoTest(MBJSONTest): + + filename = 'recording_video.json' + + def test_recording(self): + m = Metadata() + t = Track('1') + recording_to_metadata(self.json_doc, m, t) + self.assertEqual(m['director'], 'Edward 209') + self.assertEqual(m['producer'], 'Edward 209') + self.assertEqual(m['~video'], '1') + + class NullRecordingTest(MBJSONTest): filename = 'recording_null.json'