1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-22 17:06:17 +00:00

Fix LastFM support on tracks with non ASCII info

This commit is contained in:
Alban 2012-12-09 16:13:50 +01:00
parent d5ae79778d
commit f938e34b0a
2 changed files with 8 additions and 2 deletions

View File

@ -87,7 +87,10 @@ def scrobble():
else: else:
time = int(now()) time = int(now())
user = User.query.filter(User.name == u).one() if u:
user = User.query.filter(User.name == u).one()
else:
user = User.query.filter(User.name == request.authorization.username).one()
lfm = LastFm(user, app.logger) lfm = LastFm(user, app.logger)
if submission in (None, '', True, 'true', 'True', 1, '1'): if submission in (None, '', True, 'true', 'True', 1, '1'):

View File

@ -57,7 +57,10 @@ class LastFm:
sig_str = '' sig_str = ''
for k, v in sorted(kwargs.iteritems()): for k, v in sorted(kwargs.iteritems()):
sig_str += k + str(v) if type(v) is unicode:
sig_str += k + v.encode('utf-8')
else:
sig_str += k + str(v)
sig = hashlib.md5(sig_str + self.__api_secret).hexdigest() sig = hashlib.md5(sig_str + self.__api_secret).hexdigest()
kwargs['api_sig'] = sig kwargs['api_sig'] = sig