Aha i found it. it’s a plugin that i guess isn’t compatible with 2.x. i wonder how i could go and update it.
I can’t even find any info on it online which i strange.
PLUGIN_NAME = 'Song is cover of...'
PLUGIN_AUTHOR = 'Rodolfo Gonella Diaza'
PLUGIN_DESCRIPTION = 'Obtain information about the original performer of a song. In case of cover creates "original_performer" tag. In case of medley creates "medleyof" tag.'
PLUGIN_VERSION = '0.2'
PLUGIN_API_VERSIONS = ["1.3"]
from picard.metadata import register_track_metadata_processor
from picard.log import debug
from picard.log import warning
import re
def get_element_by_targettype(source, t_type):
for e in source:
if e.target_type == t_type:
return e
return -1
def get_original_artist(source, track_artist):
orig_artist = []
orig_artist_all = []
for p in source.work[0].relation_list:
if p.target_type == "recording":
debug("\ttrack has %d recordings" % (len(p.relation),) )
for r in p.relation:
if hasattr(r, "attribute_list"):
continue
try:
if hasattr(r.recording[0].artist_credit[0].name_credit[0], "joinphrase"):
continue
if r.recording[0].artist_credit[0].name_credit[0].artist[0].name[0].text in track_artist:
debug(r.recording[0].artist_credit[0].name_credit[0].artist[0].name[0].text + " in " + " - ".join(track_artist))
continue
debug (r.recording[0].id)
if r.recording[0].artist_credit[0].name_credit[0].artist[0].name[0].text not in orig_artist:
orig_artist.append(r.recording[0].artist_credit[0].name_credit[0].artist[0].name[0].text)
orig_artist_all.append(r.recording[0].artist_credit[0].name_credit[0].artist[0].name[0].text)
except Exception as ex:
debug("Something wrong among the nested elements")
template = "An exception of type {0} occured. Arguments:\n{1!r}"
message = template.format(type(ex).__name__, ex.args)
debug(message)
return -1
break
if len(orig_artist) == 1:
return orig_artist[0]
else:
debug("\t" + str(len(orig_artist)) + " original recordings found by " + ", ".join(orig_artist))
mostcommon = max(set(orig_artist_all), key=orig_artist_all.count)
debug("Most common: " + str(mostcommon))
return mostcommon
return -1
def get_medley_songs(source, track_artist):
songs = []
for s in source:
medley = False
for c in s.attribute_list[0].attribute:
if c.text == "medley":
medley = True
break
try:
if medley:
songs.append(s.work[0].title[0].text)
except Exception as ex:
debug("Something wrong among the nested elements")
template = "An exception of type {0} occured. Arguments:\n{1!r}"
message = template.format(type(ex).__name__, ex.args)
debug(message)
continue
return songs
def add_trackisacover(album_id, metadata, track, release):
c_original_artist = ""
c_cover_type = ""
c_songs_in_the_medley = ""
debug(metadata['title'])
if not metadata['~performance_attributes']:
debug("\tNo '~performance_attributes' found in metadata")
return
if "cover" in metadata['~performance_attributes']:
c_cover_type = "cover"
if "medley" in metadata['~performance_attributes']:
c_cover_type = "medley"
if c_cover_type == "":
debug("\tNo cover type for in '~performance_attributes'")
return
if not hasattr(track, 'recording'):
debug("\tNo 'recording' attribute found in 'track'")
return
for r in track.recording[0].relation_list:
if r.target_type == "work":
work = r
if work == -1:
debug ("\tNo 'work' among the track relationships")
return
relations=work.relation
if c_cover_type == "cover":
c_original_artist = get_original_artist(relations[0], metadata['artist'])
if c_original_artist <> -1:
metadata['original_performer']=c_original_artist
elif c_cover_type == "medley":
all_medley_artist = []
for s in relations:
cur_orig_art = get_original_artist(s, metadata['artist'])
if cur_orig_art == -1:
continue
if cur_orig_art not in all_medley_artist:
all_medley_artist.append(cur_orig_art)
if len(all_medley_artist) == 1:
metadata['original_performer'] = all_medley_artist[0]
else:
debug("\tMedley artists: " + " - ".join(all_medley_artist))
OriginalSongs = get_medley_songs(relations, metadata['artist'])
if len(OriginalSongs) > 0:
#c_songs_in_the_medley = "(" + " - ".join(OriginalSongs) + ")"
metadata['medleyof']=OriginalSongs
return
register_track_metadata_processor(add_trackisacover)