Fixed scrobbling with webservices authentication

This commit is contained in:
Amr Hassan 2010-02-19 06:34:27 +00:00
parent 7a2fad0110
commit f3b4182317
2 changed files with 9 additions and 3 deletions

2
.build
View file

@ -1 +1 @@
21
22

View file

@ -3580,11 +3580,17 @@ class Scrobbler(object):
"""Handshakes with the server"""
timestamp = str(int(time.time()))
token = md5(self.password + timestamp)
if self.password and self.username:
token = md5(self.password + timestamp)
elif self.network.api_key and self.network.api_secret and self.network.session_key:
if not self.username:
self.username = self.network.get_authenticated_user().get_name()
token = md5(self.network.api_secret + timestamp)
params = {"hs": "true", "p": "1.2.1", "c": self.client_id,
"v": self.client_version, "u": self.username, "t": timestamp,
"a": token}
"a": token, "sk": self.network.session_key, "api_key": self.network.api_key}
server = self.network.submission_server
response = _ScrobblerRequest(server, params, self.network, "GET").execute().split("\n")