Remove deprecated class. Its main functions were removed in #211.

This commit is contained in:
Hugo 2017-09-19 10:26:10 +03:00
parent 5622611abb
commit 4d92dcfc83

View file

@ -4265,60 +4265,4 @@ class _ScrobblerRequest(object):
raise ScrobblingError(reason) raise ScrobblingError(reason)
class Scrobbler(object):
"""A class for scrobbling tracks to Last.fm"""
session_id = None
nowplaying_url = None
submissions_url = None
def __init__(self, network, client_id, client_version):
self.client_id = client_id
self.client_version = client_version
self.username = network.username
self.password = network.password_hash
self.network = network
def _do_handshake(self):
"""Handshakes with the server"""
timestamp = str(int(time.time()))
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}
if self.network.session_key and self.network.api_key:
params["sk"] = self.network.session_key
params["api_key"] = self.network.api_key
server = self.network.submission_server
response = _ScrobblerRequest(
server, params, self.network, "GET").execute().split("\n")
self.session_id = response[1]
self.nowplaying_url = response[2]
self.submissions_url = response[3]
def _get_session_id(self, new=False):
"""
Returns a handshake. If new is true, then it will be requested from
the server even if one was cached.
"""
if not self.session_id or new:
self._do_handshake()
return self.session_id
# End of file # End of file