Skip to content

Commit

Permalink
Avoid throwing an exception on tracks without an explicitRating key
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
palmer-dabbelt committed Jul 18, 2019
1 parent c271cec commit bfd2666
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clay/gp.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def __init__(self, source, data):
self.artist_art_filename = sha1(
self.artist_art_url.encode('utf-8')
).hexdigest() + u'.jpg'
self.explicit_rating = (int(data['explicitType']))
self.explicit_rating = (int(data['explicitType'])) if 'explicitType' in data else 0

if self.rating == 5:
gp.cached_liked_songs.add_liked_song(self)
Expand Down

0 comments on commit bfd2666

Please sign in to comment.