The branch, dharma has been updated
via cc11bab8f6cbe301417debdb6b4690fd14b99ab7 (commit)
from 54c1b26f5ee1cfe20bb48975d0323b9cfe0d3ee2 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=cc11bab8f6cbe301417debdb6b4690fd14b99ab7
commit cc11bab8f6cbe301417debdb6b4690fd14b99ab7
Author: amet <[email protected]>
Date: Thu Jul 28 00:55:24 2011 +0200
[script.audio.grooveshark] -v 0.4.2
- Fixed API changes.
diff --git a/script.audio.grooveshark/GrooveShark.py
b/script.audio.grooveshark/GrooveShark.py
index 4781c95..1db704b 100644
--- a/script.audio.grooveshark/GrooveShark.py
+++ b/script.audio.grooveshark/GrooveShark.py
@@ -390,7 +390,7 @@ class Playlists(GS_Playlists):
if playlist.about == None:
l2 = ''
else:
- l2 = str(playlist.about)
+ l2 = playlist.about
item = xbmcgui.ListItem (label=playlist.name,
label2=l2, thumbnailImage=self.defaultCoverArt, iconImage=self.defaultCoverArt)
listItems.append(item)
return [self, listItems]
diff --git a/script.audio.grooveshark/addon.xml
b/script.audio.grooveshark/addon.xml
index c2988dc..71f02e1 100644
--- a/script.audio.grooveshark/addon.xml
+++ b/script.audio.grooveshark/addon.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.audio.grooveshark"
name="GrooveShark"
- version="0.4.1"
+ version="0.4.2"
provider-name="Solver">
<requires>
<import addon="xbmc.python" version="1.0"/>
diff --git a/script.audio.grooveshark/changelog.txt
b/script.audio.grooveshark/changelog.txt
index a15fe31..eaa3872 100644
--- a/script.audio.grooveshark/changelog.txt
+++ b/script.audio.grooveshark/changelog.txt
@@ -1,3 +1,7 @@
+0.4.2:
+
+ - Fixed API changes.
+
0.4.1:
- Fixed a bug that prevented windows users in logging in.
diff --git a/script.audio.grooveshark/resources/lib/GrooveAPI.py
b/script.audio.grooveshark/resources/lib/GrooveAPI.py
index f1f935f..bb820f8 100644
--- a/script.audio.grooveshark/resources/lib/GrooveAPI.py
+++ b/script.audio.grooveshark/resources/lib/GrooveAPI.py
@@ -8,8 +8,10 @@ import traceback
from gw import Request as Request
from gw import JsonRPC as gwAPI
-CLIENT_NAME = "gslite" #htmlshark #jsqueue
-CLIENT_VERSION = "20101012.37" #"20100831.25"
+CLIENT_NAME = "jsqueue"#"gslite" #htmlshark #jsqueue
+CLIENT_VERSION = "20110606.04"#"20101012.37" #"20100831.25"
+SECRET_KEY_JS = "bewareOfBearsharktopus"
+SECRET_KEY = "backToTheScienceLab"
RANDOM_CHARS = "1234567890abcdef"
VALIDITY_SESSION = 172800 #2 days
@@ -42,7 +44,7 @@ class AuthRequest(Request):
clientVersion = CLIENT_VERSION
postData = {
"header": {
- "client": CLIENT_NAME,
+ "client": "htmlshark",
"clientRevision": clientVersion,
"uuid": api._uuid,
"session": api._session},
@@ -54,10 +56,10 @@ class AuthRequest(Request):
headers = {
"Content-Type": "application/json",
"User-Agent": "Mozilla/5.0 (Windows; U; Windows NT 6.1;
en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 (.NET CLR 3.5.30729)",
- "Referer":
"http://listen.grooveshark.com/main.swf?cowbell=fe87233106a6cef919a1294fb2c3c05f"
+ "Referer": "http://grooveshark.com/"
}
- url = 'https://cowbell.grooveshark.com/more.php?' + method
- postData["header"]["token"] = api._generateToken(method)
+ url = 'https://grooveshark.com/more.php?' + method
+ postData["header"]["token"] = api._generateToken(method,
"htmlshark")
postData = json.dumps(postData)
self._request = urllib2.Request(url, postData, headers)
@@ -135,19 +137,26 @@ class GrooveAPI(gwAPI):
def isLoggedIn(self):
return self._isAuthenticated
- def _generateToken(self, method):
+ def _generateToken(self, method, client = None):
#Overload _generateToken()
+ print '############### generateToken()'
if (time.time() - self._lastTokenTime) >= VALIDITY_TOKEN:
self.debug('_generateToken(): Token has expired')
self._token = self._getToken()
+ print 'Token: ' + str(self._token)
self._lastTokenTime = time.time()
self.saveInstance()
+ if client == 'jsqueue':
+ secretKey = SECRET_KEY_JS
+ else:
+ secretKey = SECRET_KEY
+ print "Client: " + str(client) + ", key: " + str(secretKey)
randomChars = ""
while 6 > len(randomChars):
randomChars = randomChars + random.choice(RANDOM_CHARS)
- token = sha.new(method + ":" + self._token +
":quitStealinMahShit:" + randomChars).hexdigest()
+ token = sha.new(method + ":" + self._token + ":" + secretKey +
":" + randomChars).hexdigest()
#:quitBasinYoBidnessPlanOnBuildingALargeUserbaseViaCopyrightInfringment:
if (time.time() - self._lastSessionTime) >= VALIDITY_SESSION:
diff --git a/script.audio.grooveshark/resources/lib/GrooveLib.py
b/script.audio.grooveshark/resources/lib/GrooveLib.py
index 43f2323..ba1b943 100644
--- a/script.audio.grooveshark/resources/lib/GrooveLib.py
+++ b/script.audio.grooveshark/resources/lib/GrooveLib.py
@@ -529,7 +529,9 @@ class GS_Search:
self.queryText = query
parameters = {
"query": query,
- "type": type}
+ "type": "Songs",
+ "guts":0,
+ "ppOverride":"false"}
self.resultRaw = ''
self.resultRaw = gsapi.request(parameters,
"getSearchResultsEx").send()
return self.resultRaw
diff --git a/script.audio.grooveshark/resources/lib/gw/__init__.py
b/script.audio.grooveshark/resources/lib/gw/__init__.py
index 716ce6f..9df6d1d 100644
--- a/script.audio.grooveshark/resources/lib/gw/__init__.py
+++ b/script.audio.grooveshark/resources/lib/gw/__init__.py
@@ -27,15 +27,18 @@ import time
# Constants
DOMAIN = "grooveshark.com"
HOME_URL = "http://listen." + DOMAIN
-TOKEN_URL = "http://cowbell." + DOMAIN + "/more.php" #"https://cowbell." +
DOMAIN + "/service.php"
-API_URL = "http://cowbell." + DOMAIN + "/more.php"
-SERVICE_URL = "http://cowbell." + DOMAIN + "/service.php"
+TOKEN_URL = "https://" + DOMAIN + "/more.php" #"https://cowbell." + DOMAIN +
"/service.php"
+#API_URL = "http://cowbell." + DOMAIN + "/more.php"
+API_URL = "http://" + DOMAIN + "/more.php"
+SERVICE_URL = "http://" + DOMAIN + "/service.php"
RANDOM_CHARS = "1234567890abcdef"
-
-CLIENT_NAME = "gslite" #htmlshark #jsqueue
-CLIENT_VERSION = "20101012.37" #"20100831.25"
-
+SECRET_KEY_JS = "bewareOfBearsharktopus"
+SECRET_KEY = "backToTheScienceLab"
+CLIENT_NAME = "gslite" #"gslite" #htmlshark #jsqueue
+#CLIENT_VERSION = "20101012.37" #"20100831.25"
+CLIENT_VERSION = "20110606"#.04"
+#CLIENT_VERSION = "20110718.01"
RE_SESSION = re.compile('"sessionID":"\s*?([A-z0-9]+)"')
#re.compile('sessionID:\s*?\'([A-z0-9]+)\',')
@@ -44,16 +47,28 @@ class Request:
def __init__(self, api, parameters, method, type="default",
clientVersion=None):
"""function: Initiates the Request"""
-
+ print '############### Method: ' + str(method)
if clientVersion != None:
if float(clientVersion) < float(CLIENT_VERSION):
clientVersion = CLIENT_VERSION
if clientVersion == None:
clientVersion = CLIENT_VERSION
+ clientName = 'htmlshark'
+ if method == 'getStreamKeyFromSongIDEx':
+ clientName = 'jsqueue'
+ clientVersion = "20110606.04"
+ if method == 'getCommunicationToken' or type == "token":
+ clientName = 'htmlshark'
+ if method == 'getSearchResultsEx':
+ clientName = 'htmlshark'
+ if method == "albumGetSongs":
+ clientName = 'htmlshark'
+# clientName = CLIENT_NAME
+ print '############### ' + clientName
postData = {
"header": {
- "client": CLIENT_NAME,
+ "client": clientName,
"clientRevision": clientVersion,
"uuid": api._uuid,
"session": api._session},
@@ -61,17 +76,17 @@ class Request:
"privacy": 1,
"parameters": parameters,
"method": method}
-
+ referer = "http://grooveshark.com/"#JSQueue.swf?20110718.01"
headers = {
"Content-Type": "application/json",
"User-Agent": "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US;
rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 (.NET CLR 3.5.30729)",
- "Referer":
"http://listen.grooveshark.com/main.swf?cowbell=fe87233106a6cef919a1294fb2c3c05f"
+ "Referer": referer
}
if "token" == type:
- url = TOKEN_URL
+ url = TOKEN_URL + "?" + method
else:
- postData["header"]["token"] = api._generateToken(method)
+ postData["header"]["token"] = api._generateToken(method,
clientName)
if "service" == type:
url = SERVICE_URL + "?" + method
@@ -79,9 +94,10 @@ class Request:
url = API_URL + "?" + method
postData = json.dumps(postData)
- print url
+ print '########### ' + url
+ #print '############### ' + self._token
#print headers
- #print postData
+ print postData
self._request = urllib2.Request(url, postData, headers)
def send(self):
@@ -99,6 +115,7 @@ class Request:
except KeyError:
return response
else:
+ print response
raise StandardError("API error: " + response["fault"]["message"])
@@ -146,7 +163,7 @@ class JsonRPC:
def _generateToken(self, method):
"""function: Make a token ready for a request header"""
- if 1000 <= (time.time() - self._lastTokenTime):
+ if 1 <= (time.time() - self._lastTokenTime):
self._token = self._getToken()
self._lastTokenTime = time.time()
@@ -154,9 +171,11 @@ class JsonRPC:
while 6 > len(randomChars):
randomChars = randomChars + random.choice(RANDOM_CHARS)
+
token = hashlib.sha1(method + ":" + self._token +
- ":quitStealinMahShit:" + randomChars).hexdigest()
+ ":" + SECRET_KEY + ":" + randomChars).hexdigest()
#:quitBasinYoBidnessPlanOnBuildingALargeUserbaseViaCopyrightInfringment:
+ #:quitStealinMahShit:
return randomChars + token
def _generateSecretKey(self, session):
@@ -165,6 +184,7 @@ class JsonRPC:
def _getSession(self, html):
"""function: Parse a sessionId from some HTML"""
+ print "################# Getting session"
html = RE_SESSION.search(html)
if html:
@@ -194,10 +214,8 @@ class JsonRPC:
"type": type}
response = Request(self, parameters, "getSearchResultsEx").send()
-
- return {
- "query": query,
- "songs": self._parseSongs(response["result"]["Return"])}
+ #print response
+ return response
def getPopular(self):
"""function: Get popular songs from Grooveshark"""
-----------------------------------------------------------------------
Summary of changes:
script.audio.grooveshark/GrooveShark.py | 2 +-
script.audio.grooveshark/addon.xml | 2 +-
script.audio.grooveshark/changelog.txt | 4 +
.../resources/lib/GrooveAPI.py | 25 ++++++---
.../resources/lib/GrooveLib.py | 4 +-
.../resources/lib/gw/__init__.py | 60 +++++++++++++-------
6 files changed, 65 insertions(+), 32 deletions(-)
hooks/post-receive
--
Scripts
------------------------------------------------------------------------------
Got Input? Slashdot Needs You.
Take our quick survey online. Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons