Skip to content

Commit bfd2666

Browse files
Avoid throwing an exception on tracks without an explicitRating key
Without this patch I get some responses from the server that lack an explicitRating key, causing an exception to be thrown that results in these tracks being dropped from the user interface. This simply checks to see if the explicitRating key exists before attempting to read it. Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
1 parent c271cec commit bfd2666

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clay/gp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def __init__(self, source, data):
128128
self.artist_art_filename = sha1(
129129
self.artist_art_url.encode('utf-8')
130130
).hexdigest() + u'.jpg'
131-
self.explicit_rating = (int(data['explicitType']))
131+
self.explicit_rating = (int(data['explicitType'])) if 'explicitType' in data else 0
132132

133133
if self.rating == 5:
134134
gp.cached_liked_songs.add_liked_song(self)

0 commit comments

Comments
 (0)