import pwd
import socket
import binascii
-import sha
+import hashlib
import sys
import locale
_response = re.compile("([0-9]{3}) ?(.*)")
+# hashes
+_hashes = {
+ "sha1": hashlib.sha1,
+ "SHA1": hashlib.sha1,
+ "sha256": hashlib.sha256,
+ "SHA256": hashlib.sha256,
+ "sha384": hashlib.sha384,
+ "SHA384": hashlib.sha384,
+ "sha512": hashlib.sha512,
+ "SHA512": hashlib.sha512,
+};
+
version = "_version_"
########################################################################
password = self.config['password']
else:
password = self.password
- # TODO support algorithms other than SHA-1
- h = sha.sha()
+ h = _hashes[algo]()
h.update(password)
h.update(binascii.unhexlify(challenge))
self._simple("user", user, h.hexdigest())
res, details = self._simple("play", track)
return unicode(details) # because it's unicode in queue() output
+ def playafter(self, target, tracks):
+ """Insert tracks into a specific point in the queue.
+
+ Arguments:
+ target -- target ID or None to insert at start of queue
+ tracks -- a list of tracks to play"""
+ if target is None:
+ target = ''
+ self._simple("playafter", target, *tracks)
+
def remove(self, track):
"""Remove a track from the queue.