[grooveshark] catch exception when id is not an integer
This commit is contained in:
parent
d1b5ea7d7d
commit
079bab9710
1 changed files with 15 additions and 10 deletions
|
|
@ -116,11 +116,14 @@ class GroovesharkBrowser(BaseBrowser):
|
||||||
def get_audio_from_song_id(self, _id):
|
def get_audio_from_song_id(self, _id):
|
||||||
audio = GroovesharkAudio(_id)
|
audio = GroovesharkAudio(_id)
|
||||||
audio.url = self.get_stream_url_from_song_id(_id)
|
audio.url = self.get_stream_url_from_song_id(_id)
|
||||||
|
if audio.url is not None:
|
||||||
return audio
|
return audio
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
def get_stream_url_from_song_id(self, _id):
|
def get_stream_url_from_song_id(self, _id):
|
||||||
method = 'getStreamKeyFromSongIDEx'
|
method = 'getStreamKeyFromSongIDEx'
|
||||||
|
try:
|
||||||
parameters = {}
|
parameters = {}
|
||||||
parameters['prefetch'] = False
|
parameters['prefetch'] = False
|
||||||
parameters['mobile'] = True
|
parameters['mobile'] = True
|
||||||
|
|
@ -132,6 +135,8 @@ class GroovesharkBrowser(BaseBrowser):
|
||||||
self.mark_song_downloaded_ex(response['result'])
|
self.mark_song_downloaded_ex(response['result'])
|
||||||
|
|
||||||
return u'http://%s/stream.php?streamKey=%s' % (response['result']['ip'], response['result']['streamKey'])
|
return u'http://%s/stream.php?streamKey=%s' % (response['result']['ip'], response['result']['streamKey'])
|
||||||
|
except ValueError:
|
||||||
|
return
|
||||||
|
|
||||||
def search_albums(self, pattern):
|
def search_albums(self, pattern):
|
||||||
method = 'getResultsFromSearch'
|
method = 'getResultsFromSearch'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue