[Grooveshark] declare user_id as an instance variable
This commit is contained in:
parent
42d4db47bf
commit
13ec5aca4f
2 changed files with 4 additions and 6 deletions
|
|
@ -68,7 +68,7 @@ class GroovesharkBackend(BaseBackend, ICapVideo, ICapCollection):
|
||||||
collection = self.get_collection(objs, split_path)
|
collection = self.get_collection(objs, split_path)
|
||||||
if collection.path_level == 0:
|
if collection.path_level == 0:
|
||||||
yield Collection([u'albums'], u'Search for Albums')
|
yield Collection([u'albums'], u'Search for Albums')
|
||||||
if self.browser.is_logged:
|
if self.browser.is_logged():
|
||||||
yield Collection([u'playlists'], u'Grooveshark Playlists')
|
yield Collection([u'playlists'], u'Grooveshark Playlists')
|
||||||
if collection.path_level == 1:
|
if collection.path_level == 1:
|
||||||
if collection.split_path[0] == u'playlists':
|
if collection.split_path[0] == u'playlists':
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,6 @@ class GroovesharkBrowser(BaseBrowser):
|
||||||
PROTOCOL = 'http'
|
PROTOCOL = 'http'
|
||||||
DOMAIN = 'html5.grooveshark.com'
|
DOMAIN = 'html5.grooveshark.com'
|
||||||
API_URL = 'https://html5.grooveshark.com/more.php'
|
API_URL = 'https://html5.grooveshark.com/more.php'
|
||||||
IS_LOGGED = False
|
|
||||||
|
|
||||||
#Setting the static header (country, session and uuid)
|
#Setting the static header (country, session and uuid)
|
||||||
HEADER = {}
|
HEADER = {}
|
||||||
|
|
@ -66,7 +65,6 @@ class GroovesharkBrowser(BaseBrowser):
|
||||||
GROOVESHARK_CONSTANTS = ('mobileshark', '20120830', 'gooeyFlubber')
|
GROOVESHARK_CONSTANTS = ('mobileshark', '20120830', 'gooeyFlubber')
|
||||||
COMMUNICATION_TOKEN = None
|
COMMUNICATION_TOKEN = None
|
||||||
|
|
||||||
USER_ID = None
|
|
||||||
VIDEOS_FROM_SONG_RESULTS = None
|
VIDEOS_FROM_SONG_RESULTS = None
|
||||||
|
|
||||||
def home(self):
|
def home(self):
|
||||||
|
|
@ -74,7 +72,7 @@ class GroovesharkBrowser(BaseBrowser):
|
||||||
self.get_communication_token()
|
self.get_communication_token()
|
||||||
|
|
||||||
def is_logged(self):
|
def is_logged(self):
|
||||||
return self.USER_ID is not None and self.USER_ID != 0
|
return self.user_id is not None and self.user_id != 0
|
||||||
|
|
||||||
def login(self):
|
def login(self):
|
||||||
if self.username and self.password:
|
if self.username and self.password:
|
||||||
|
|
@ -85,7 +83,7 @@ class GroovesharkBrowser(BaseBrowser):
|
||||||
parameters['password'] = self.password
|
parameters['password'] = self.password
|
||||||
|
|
||||||
response = self.API_post(method, parameters, self.create_token(method))
|
response = self.API_post(method, parameters, self.create_token(method))
|
||||||
self.USER_ID = response['result']['userID']
|
self.user_id = response['result']['userID']
|
||||||
|
|
||||||
if not self.is_logged:
|
if not self.is_logged:
|
||||||
raise BrowserIncorrectPassword()
|
raise BrowserIncorrectPassword()
|
||||||
|
|
@ -95,7 +93,7 @@ class GroovesharkBrowser(BaseBrowser):
|
||||||
method = 'userGetPlaylists'
|
method = 'userGetPlaylists'
|
||||||
|
|
||||||
parameters = {}
|
parameters = {}
|
||||||
parameters['userID'] = self.USER_ID
|
parameters['userID'] = self.user_id
|
||||||
|
|
||||||
response = self.API_post(method, parameters, self.create_token(method))
|
response = self.API_post(method, parameters, self.create_token(method))
|
||||||
return self.create_collection_from_playlists_result(response['result']['Playlists'], split_path)
|
return self.create_collection_from_playlists_result(response['result']['Playlists'], split_path)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue