Ignore artist_name and track_titles that aren't strings (fixes playout

for empty artist name or track titles)
This commit is contained in:
Albert Santoni 2015-03-12 10:52:28 -04:00
parent a29d464eb2
commit b49e98693b
1 changed files with 7 additions and 2 deletions

View File

@ -20,10 +20,15 @@ def create_liquidsoap_annotation(media):
# with the metadata we get from Airtime. (You can modify metadata in Airtime's library,
# which doesn't get saved back to the file.)
if 'metadata' in media:
if 'artist_name' in media['metadata']:
annotation += ',artist="%s"' % (media['metadata']['artist_name'].replace('"', '\\"'))
artist_name = media['metadata']['artist_name']
if isinstance(artist_name, str):
annotation += ',artist="%s"' % (artist_name.replace('"', '\\"'))
if 'track_title' in media['metadata']:
annotation += ',title="%s"' % (media['metadata']['track_title'].replace('"', '\\"'))
track_title = media['metadata']['track_title']
if isinstance(track_title, str):
annotation += ',title="%s"' % (track_title.replace('"', '\\"'))
annotation += ":" + filename