def test_translate(self): m = Metadata() t = Track('1') config.setting['translate_artist_names'] = True recording_to_metadata(self.json_doc, m, t) self.assertEqual(m['composer'], 'Pyotr Ilyich Tchaikovsky') self.assertEqual(m['composersort'], 'Tchaikovsky, Pyotr Ilyich')
def test_recording(self): m = Metadata() t = Track('1') recording_to_metadata(self.json_doc, m, t) self.assertIn('instrumental', m.getall('~performance_attributes')) self.assertEqual(m['language'], 'zxx') self.assertNotIn('lyricist', m)
def test_recording_solo_vocals(self): m = Metadata() t = Track("1") recording_to_metadata(self.json_doc, m, t) config.setting["standardize_artists"] = False self.assertNotIn('performer:solo', m) self.assertEqual(m['performer:solo vocals'], 'Frida')
def test_recording_instrument_credits(self): m = Metadata() t = Track('1') config.setting['standardize_instruments'] = False recording_to_metadata(self.json_doc, m, t) self.assertEqual(m['performer:vocals'], 'Ed Sheeran') self.assertEqual(m['performer:acoustic guitar'], 'Ed Sheeran')
def test_recording_standardize_artist_credits(self): m = Metadata() t = Track("1") config.setting["standardize_artists"] = True recording_to_metadata(self.json_doc, m, t) self.assertNotIn('performer:solo', m) self.assertEqual(m['performer:solo vocals'], 'Anni-Frid Lyngstad')
def test_recording(self): m = Metadata() t = Track('1') recording_to_metadata(self.json_doc, m, t) self.assertEqual(m['artist'], 'Ed Sheeran') self.assertEqual(m['artists'], 'Ed Sheeran') self.assertEqual(m['artistsort'], 'Sheeran, Ed') self.assertEqual(m['isrc'], 'GBAHS1400099') self.assertEqual(m['language'], 'eng') self.assertEqual(m['musicbrainz_artistid'], 'b8a7c51f-362c-4dcb-a259-bc6e0095f0a6') self.assertEqual(m['musicbrainz_recordingid'], 'cb2cc207-8125-445c-9ef9-6ea44eee959a') self.assertEqual(m['musicbrainz_workid'], 'dc469dc8-198e-42e5-b5a7-6be2f0a95ac0') self.assertEqual(m['performer:'], 'Ed Sheeran') self.assertEqual(m['performer:lead vocals'], 'Ed Sheeran') self.assertEqual(m['performer:guitar family'], 'Ed Sheeran') self.assertEqual(m['title'], 'Thinking Out Loud') self.assertEqual(m['work'], 'Thinking Out Loud') self.assertEqual(m['writer'], 'Ed Sheeran; Amy Wadge') self.assertEqual(m['~artists_sort'], 'Sheeran, Ed') self.assertEqual(m['~length'], '4:41') self.assertEqual(m['~recordingtitle'], 'Thinking Out Loud') self.assertEqual(t.genres, { 'blue-eyed soul': 1, 'pop': 3}) for artist in t._track_artists: self.assertEqual(artist.genres, { 'dance-pop': 1, 'guitarist': 0})
def test_recording(self): m = Metadata() t = Track('1') recording_to_metadata(self.json_doc, m, t) self.assertEqual(m['artist'], 'Ed Sheeran') self.assertEqual(m['artists'], 'Ed Sheeran') self.assertEqual(m['artistsort'], 'Sheeran, Ed') self.assertEqual(m['isrc'], 'GBAHS1400099') self.assertEqual(m['language'], 'eng') self.assertEqual(m['musicbrainz_artistid'], 'b8a7c51f-362c-4dcb-a259-bc6e0095f0a6') self.assertEqual(m['musicbrainz_recordingid'], 'cb2cc207-8125-445c-9ef9-6ea44eee959a') self.assertEqual(m['musicbrainz_workid'], 'dc469dc8-198e-42e5-b5a7-6be2f0a95ac0') self.assertEqual(m['performer:'], 'Ed Sheeran') self.assertEqual(m['performer:lead vocals'], 'Ed Sheeran') self.assertEqual(m['performer:guitar family'], 'Ed Sheeran') self.assertEqual(m['title'], 'Thinking Out Loud') self.assertEqual(m['work'], 'Thinking Out Loud') self.assertEqual(m['writer'], 'Ed Sheeran; Amy Wadge') self.assertEqual(m['~artists_sort'], 'Sheeran, Ed') self.assertEqual(m['~length'], '4:41') self.assertEqual(m['~recordingtitle'], 'Thinking Out Loud') self.assertEqual(t.genres, { 'blue-eyed soul': 1, 'pop': 3 }) for artist in t._track_artists: self.assertEqual(artist.genres, { 'dance-pop': 1, 'guitarist': 0 })
def test_recording_standardize_artist_credits(self): m = Metadata() t = Track("1") config.setting["standardize_artists"] = True recording_to_metadata(self.json_doc, m, t) self.assertTrue('performer:solo' not in m) self.assertEqual(m['performer:solo vocals'], 'Anni-Frid Lyngstad')
def test_recording_solo_vocals(self): m = Metadata() t = Track("1") recording_to_metadata(self.json_doc, m, t) config.setting["standardize_artists"] = False self.assertTrue('performer:solo' not in m) self.assertEqual(m['performer:solo vocals'], 'Frida')
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')
def test_use_credited_as(self): m = Metadata() t = Track('1') config.setting['translate_artist_names'] = False config.setting['standardize_artists'] = False recording_to_metadata(self.json_doc, m, t) self.assertEqual(m['composer'], 'Tchaikovsky') self.assertEqual(m['composersort'], 'Tchaikovsky, Pyotr Ilyich')
def _parse_recording(self, recording): m = self.metadata recording_to_metadata(recording, m, self) self._customize_metadata() run_track_metadata_processors(self.album, m, None, recording) self.orig_metadata.copy(m) self.loaded = True if self.callback: self.callback() self.callback = None self.tagger.nats.update(True)
def _parse_recording(self, recording): m = self.metadata recording_to_metadata(recording, m, self) self._customize_metadata() run_track_metadata_processors(self.album, m, recording) self.orig_metadata.copy(m) self.run_scripts(m) self.loaded = True self.status = None if self.callback: self.callback() self.callback = None self.album.update(True)
def _parse_recording(self, recording): m = self.metadata recording_to_metadata(recording, m, self) self._customize_metadata() run_track_metadata_processors(self.album, m, None, recording) for s_name, s_text in enabled_tagger_scripts_texts(): parser = ScriptParser() try: parser.eval(s_text, m) except ScriptError: log.exception("Failed to run tagger script %s on track", s_name) m.strip_whitespace() self.loaded = True if self.callback: self.callback() self.callback = None self.tagger.nats.update(True)
def _parse_recording(self, recording): m = self.metadata recording_to_metadata(recording, m, self) self.orig_metadata.copy(m) self._customize_metadata() run_track_metadata_processors(self.album, m, None, recording) for s_name, s_text in enabled_tagger_scripts_texts(): parser = ScriptParser() try: parser.eval(s_text, m) except ScriptError: log.exception("Failed to run tagger script %s on track", s_name) m.strip_whitespace() self.loaded = True self.status = None if self.callback: self.callback() self.callback = None self.album.update(True)
def parse_tracks(self, tracks): for node in tracks: if "releases" in node: for rel_node in node['releases']: track = Metadata() recording_to_metadata(node, track) release_to_metadata(rel_node, track) rg_node = rel_node['release-group'] release_group_to_metadata(rg_node, track) countries = country_list_from_node(rel_node) if countries: track["country"] = ", ".join(countries) self.search_results.append((track, node)) else: # This handles the case when no release is associated with a track # i.e. the track is an NAT track = Metadata() recording_to_metadata(node, track) track["album"] = _("Standalone Recording") self.search_results.append((track, node))
def test_recording(self): m = Metadata() t = Track("1") recording_to_metadata(self.json_doc, m, t) self.assertEqual(m['artist'], 'Ed Sheeran') self.assertEqual(m['artists'], 'Ed Sheeran') self.assertEqual(m['artistsort'], 'Sheeran, Ed') self.assertEqual(m['isrc'], 'GBAHS1400099') self.assertEqual(m['language'], 'eng') self.assertEqual(m['musicbrainz_artistid'], 'b8a7c51f-362c-4dcb-a259-bc6e0095f0a6') self.assertEqual(m['musicbrainz_recordingid'], 'cb2cc207-8125-445c-9ef9-6ea44eee959a') self.assertEqual(m['musicbrainz_workid'], 'dc469dc8-198e-42e5-b5a7-6be2f0a95ac0') self.assertEqual(m['performer:'], 'Ed Sheeran') self.assertEqual(m['performer:vocals'], 'Ed Sheeran') self.assertEqual(m['title'], 'Thinking Out Loud') self.assertEqual(m['work'], 'Thinking Out Loud') self.assertEqual(m['writer'], 'Ed Sheeran; Amy Wadge') self.assertEqual(m['~artists_sort'], 'Sheeran, Ed') self.assertEqual(m['~length'], '4:41') self.assertEqual(m['~recordingtitle'], 'Thinking Out Loud')
def _parse_recording(self, recording): m = self.metadata recording_to_metadata(recording, m, self) self._customize_metadata() run_track_metadata_processors(self.album, m, None, recording) if config.setting["enable_tagger_scripts"]: for s_pos, s_name, s_enabled, s_text in config.setting["list_of_scripts"]: if s_enabled and s_text: parser = ScriptParser() try: parser.eval(s_text, m) except: log.error(traceback.format_exc()) m.strip_whitespace() self.loaded = True if self.callback: self.callback() self.callback = None self.tagger.nats.update(True)
def _parse_recording(self, recording): m = self.metadata recording_to_metadata(recording, m, self) self._customize_metadata() run_track_metadata_processors(self.album, m, None, recording) if config.setting["enable_tagger_scripts"]: for s_pos, s_name, s_enabled, s_text in config.setting[ "list_of_scripts"]: if s_enabled and s_text: parser = ScriptParser() try: parser.eval(s_text, m) except: log.error(traceback.format_exc()) m.strip_whitespace() self.loaded = True if self.callback: self.callback() self.callback = None self.tagger.nats.update(True)
def parse_tracks(self, tracks): for node in tracks: if "releases" in node: for rel_node in node['releases']: track = Metadata() recording_to_metadata(node, track) track['score'] = node['score'] release_to_metadata(rel_node, track) rg_node = rel_node['release-group'] release_group_to_metadata(rg_node, track) countries = countries_from_node(rel_node) if countries: track["country"] = ", ".join(countries) self.search_results.append((track, node)) else: # This handles the case when no release is associated with a track # i.e. the track is an NAT track = Metadata() recording_to_metadata(node, track) track['score'] = node['score'] track["album"] = _("Standalone Recording") self.search_results.append((track, node))
def test_recording(self): m = Metadata() t = Track("1") recording_to_metadata(self.json_doc, m, t) self.assertEqual(m, {})
def test_recording(self): m = Metadata() t = Track("1") parsed_recording = parse_recording(self.json_doc) recording_to_metadata(parsed_recording, m, t) self.assertEqual(m, {})
def test_recording_instrument_decamelcase(self): m = Metadata() t = Track("1") recording_to_metadata(self.json_doc, m, t) self.assertEqual(m['performer:ewi'], 'Michael Brecker')
def test_recording_solo_vocals(self): m = Metadata() t = Track("1") recording_to_metadata(self.json_doc, m, t) self.assertTrue('performer:solo' not in m) self.assertEqual(m['performer:solo vocals'], 'Frida')