From 13ec5aca4fdb91b4dcd0ec27a4da07dcd0762614 Mon Sep 17 00:00:00 2001 From: Bezleputh Date: Wed, 16 Oct 2013 23:20:52 +0200 Subject: [PATCH] [Grooveshark] declare user_id as an instance variable --- modules/grooveshark/backend.py | 2 +- modules/grooveshark/browser.py | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/modules/grooveshark/backend.py b/modules/grooveshark/backend.py index 2be2df26..b15b959a 100644 --- a/modules/grooveshark/backend.py +++ b/modules/grooveshark/backend.py @@ -68,7 +68,7 @@ class GroovesharkBackend(BaseBackend, ICapVideo, ICapCollection): collection = self.get_collection(objs, split_path) if collection.path_level == 0: 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') if collection.path_level == 1: if collection.split_path[0] == u'playlists': diff --git a/modules/grooveshark/browser.py b/modules/grooveshark/browser.py index cbad05d3..0f8879bc 100644 --- a/modules/grooveshark/browser.py +++ b/modules/grooveshark/browser.py @@ -47,7 +47,6 @@ class GroovesharkBrowser(BaseBrowser): PROTOCOL = 'http' DOMAIN = 'html5.grooveshark.com' API_URL = 'https://html5.grooveshark.com/more.php' - IS_LOGGED = False #Setting the static header (country, session and uuid) HEADER = {} @@ -66,7 +65,6 @@ class GroovesharkBrowser(BaseBrowser): GROOVESHARK_CONSTANTS = ('mobileshark', '20120830', 'gooeyFlubber') COMMUNICATION_TOKEN = None - USER_ID = None VIDEOS_FROM_SONG_RESULTS = None def home(self): @@ -74,7 +72,7 @@ class GroovesharkBrowser(BaseBrowser): self.get_communication_token() 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): if self.username and self.password: @@ -85,7 +83,7 @@ class GroovesharkBrowser(BaseBrowser): parameters['password'] = self.password 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: raise BrowserIncorrectPassword() @@ -95,7 +93,7 @@ class GroovesharkBrowser(BaseBrowser): method = 'userGetPlaylists' parameters = {} - parameters['userID'] = self.USER_ID + parameters['userID'] = self.user_id response = self.API_post(method, parameters, self.create_token(method)) return self.create_collection_from_playlists_result(response['result']['Playlists'], split_path)