From b49e98693bb2ca8e7e2a63091871ef8ac595716e Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Thu, 12 Mar 2015 10:52:28 -0400 Subject: [PATCH] Ignore artist_name and track_titles that aren't strings (fixes playout for empty artist name or track titles) --- python_apps/pypo/telnetliquidsoap.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/python_apps/pypo/telnetliquidsoap.py b/python_apps/pypo/telnetliquidsoap.py index 391efe31d..6845cd091 100644 --- a/python_apps/pypo/telnetliquidsoap.py +++ b/python_apps/pypo/telnetliquidsoap.py @@ -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