Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding artist disambiguation because it's right beside name and sort-… #2

Open
wants to merge 1 commit into
base: 2.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,21 @@ def process_artists(album_id, source_metadata, destination_metadata, source_type
# Initialize variables to default values
sort_pri_artist = ''
std_artist = ''
dis_artist = ''
cred_artist = ''
sort_artist = ''
additional_std_artist = ''
additional_cred_artist = ''
std_artist_list = []
dis_artist_list = []
cred_artist_list = []
sort_artist_list = []
artist_count = 0
artist_ids = []
for artist_credit in source_metadata['artist-credit']:
# Initialize temporary variables for each loop.
temp_std_name = ''
temp_dis_name = ''
temp_cred_name = ''
temp_sort_name = ''
temp_phrase = ''
Expand All @@ -87,6 +90,10 @@ def process_artists(album_id, source_metadata, destination_metadata, source_type
temp_std_name = artist_credit['artist']['name']
else:
metadata_error(album_id, 'artist-credit.artist.name', source_type)
if 'disambiguation' in artist_credit['artist']:
temp_dis_name = artist_credit['artist']['disambiguation']
else:
metadata_error(album_id, 'artist-credit.artist.disambiguation', source_type)
if 'sort-name' in artist_credit['artist']:
temp_sort_name = artist_credit['artist']['sort-name']
else:
Expand All @@ -95,10 +102,13 @@ def process_artists(album_id, source_metadata, destination_metadata, source_type
# No 'artist' specified. Log as an error.
metadata_error(album_id, 'artist-credit.artist', source_type)
std_artist += temp_std_name + temp_phrase
dis_artist += temp_dis_name + temp_phrase
cred_artist += temp_cred_name + temp_phrase
sort_artist += temp_sort_name + temp_phrase
if temp_std_name:
std_artist_list.append(temp_std_name,)
if temp_dis_name:
dis_artist_list.append(temp_dis_name,)
if temp_cred_name:
cred_artist_list.append(temp_cred_name,)
if temp_sort_name:
Expand All @@ -109,6 +119,7 @@ def process_artists(album_id, source_metadata, destination_metadata, source_type
if temp_id:
destination_metadata['~artists_{0}_primary_id'.format(source_type,)] = temp_id
destination_metadata['~artists_{0}_primary_std'.format(source_type,)] = temp_std_name
destination_metadata['~artists_{0}_primary_dis'.format(source_type,)] = temp_dis_name
destination_metadata['~artists_{0}_primary_cred'.format(source_type,)] = temp_cred_name
destination_metadata['~artists_{0}_primary_sort'.format(source_type,)] = temp_sort_name
sort_pri_artist += temp_sort_name + temp_phrase
Expand Down Expand Up @@ -138,6 +149,8 @@ def process_artists(album_id, source_metadata, destination_metadata, source_type
destination_metadata['~artists_{0}_additional_sort_multi'.format(source_type,)] = additional_sort_artist_list
if std_artist:
destination_metadata['~artists_{0}_all_std'.format(source_type,)] = std_artist
if dis_artist:
destination_metadata['~artists_{0}_all_dis'.format(source_type,)] = dis_artist
if cred_artist:
destination_metadata['~artists_{0}_all_cred'.format(source_type,)] = cred_artist
if sort_artist:
Expand Down