grooveshark: force mp3 extension, many code style fixes
This commit is contained in:
parent
bfe3ac6bcd
commit
8d501ed1e4
1 changed files with 21 additions and 15 deletions
|
|
@ -31,9 +31,16 @@ import datetime
|
||||||
__all__ = ['GroovesharkBrowser']
|
__all__ = ['GroovesharkBrowser']
|
||||||
|
|
||||||
|
|
||||||
|
class GroovesharkVideo(BaseVideo):
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
BaseVideo.__init__(self, *args, **kwargs)
|
||||||
|
self.ext = u'mp3'
|
||||||
|
|
||||||
|
|
||||||
class APIError(Exception):
|
class APIError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class GroovesharkBrowser(BaseBrowser):
|
class GroovesharkBrowser(BaseBrowser):
|
||||||
PROTOCOL = 'http'
|
PROTOCOL = 'http'
|
||||||
DOMAIN = 'html5.grooveshark.com'
|
DOMAIN = 'html5.grooveshark.com'
|
||||||
|
|
@ -85,7 +92,7 @@ class GroovesharkBrowser(BaseBrowser):
|
||||||
self.VIDEOS_FROM_SONG_RESULTS = []
|
self.VIDEOS_FROM_SONG_RESULTS = []
|
||||||
|
|
||||||
for song in songs:
|
for song in songs:
|
||||||
video = BaseVideo(song['SongID'])
|
video = GroovesharkVideo(song['SongID'])
|
||||||
video.title = u'Song - %s' % song['SongName'].encode('ascii', 'replace')
|
video.title = u'Song - %s' % song['SongName'].encode('ascii', 'replace')
|
||||||
video.author = u'%s' % song['ArtistName'].encode('ascii', 'replace')
|
video.author = u'%s' % song['ArtistName'].encode('ascii', 'replace')
|
||||||
video.description = u'%s - %s - %s' % (video.author, song['AlbumName'].encode('ascii', 'replace'), song['Year'].encode('ascii', 'replace'))
|
video.description = u'%s - %s - %s' % (video.author, song['AlbumName'].encode('ascii', 'replace'), song['Year'].encode('ascii', 'replace'))
|
||||||
|
|
@ -103,7 +110,7 @@ class GroovesharkBrowser(BaseBrowser):
|
||||||
def create_video_from_playlist_result(self, playlists):
|
def create_video_from_playlist_result(self, playlists):
|
||||||
videos = []
|
videos = []
|
||||||
for playlist in playlists:
|
for playlist in playlists:
|
||||||
video = BaseVideo(playlist['PlaylistID'])
|
video = GroovesharkVideo(playlist['PlaylistID'])
|
||||||
video.title = u'Playlist - %s' % (playlist['Name'])
|
video.title = u'Playlist - %s' % (playlist['Name'])
|
||||||
video.description = playlist['Artists']
|
video.description = playlist['Artists']
|
||||||
videos.append(video)
|
videos.append(video)
|
||||||
|
|
@ -112,13 +119,12 @@ class GroovesharkBrowser(BaseBrowser):
|
||||||
def create_video_from_albums_result(self, albums):
|
def create_video_from_albums_result(self, albums):
|
||||||
videos = []
|
videos = []
|
||||||
for album in albums:
|
for album in albums:
|
||||||
video = BaseVideo(album['AlbumID'])
|
video = GroovesharkVideo(album['AlbumID'])
|
||||||
video.title = u'Album - %s' % (album['Name'])
|
video.title = u'Album - %s' % (album['Name'])
|
||||||
video.description = album['Year']
|
video.description = album['Year']
|
||||||
videos.append(video)
|
videos.append(video)
|
||||||
return videos
|
return videos
|
||||||
|
|
||||||
|
|
||||||
def get_communication_token(self):
|
def get_communication_token(self):
|
||||||
parameters = {'secretKey': hashlib.md5(self.HEADER["session"]).hexdigest()}
|
parameters = {'secretKey': hashlib.md5(self.HEADER["session"]).hexdigest()}
|
||||||
result = self.API_post('getCommunicationToken', parameters)
|
result = self.API_post('getCommunicationToken', parameters)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue