Skip to content

Commit

Permalink
Fix for songs with no english title
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas Iturralde authored and Tomas Iturralde committed Jun 24, 2022
1 parent e45188a commit 7be4338
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion kara_api/kara_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,15 @@ def get_kara_data(kara_id: str) -> Dict[str, str]:

data = json.loads(response.content)

# Get title in english first, or in the default language if no english title exists
try:
kara_title = data['titles']['eng']
except KeyError:
default_lang = data['titles_default_language']
kara_title = data['titles'][default_lang]

kara_data = {
'title': data['titles']['eng'],
'title': kara_title,
'sub_file': data['subfile'],
'media_file': data['mediafile'],
'language': data['langs'][0]['i18n']['eng']
Expand Down

0 comments on commit 7be4338

Please sign in to comment.