Skip to content

Commit

Permalink
handle possible errors in last.fm plugin when scrobbling
Browse files Browse the repository at this point in the history
  • Loading branch information
jdodds committed Nov 9, 2012
1 parent a6af0eb commit d7ecad2
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions pyrana/plugins/lastfmscrobbler.py
Expand Up @@ -31,9 +31,14 @@ def metadataread(self, payload):
self.metadata = payload

def songend(self, payload=None):
self.network.scrobble(
self.metadata['artist'][0],
self.metadata['title'][0],
self.started_at,
self.metadata['album'][0]
)
try:
self.network.scrobble(
self.metadata['artist'][0],
self.metadata['title'][0],
self.started_at,
self.metadata['album'][0]
)
except KeyError:
pass
except WSError: # this seems to mean that last.fm is temporarily unavailable
pass

0 comments on commit d7ecad2

Please sign in to comment.