From 91a85ebbc42c6c29d94f955895b4870371f9c987 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 26 Feb 2014 20:15:31 +0530 Subject: [PATCH] fix issues with unicode filename --- pandora_client/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pandora_client/__init__.py b/pandora_client/__init__.py index 3c3665b..6754af0 100644 --- a/pandora_client/__init__.py +++ b/pandora_client/__init__.py @@ -220,7 +220,7 @@ class Client(object): if not os.path.exists(os.path.dirname(db_conn)): os.makedirs(os.path.dirname(db_conn)) conn = sqlite3.connect(db_conn, timeout=10) - conn.text_factory = sqlite3.OptimizedUnicode + conn.text_factory = str return conn, conn.cursor() def media_cache(self): @@ -902,8 +902,9 @@ class API(ox.API): #upload media if os.path.exists(i['media']): size = ox.format_bytes(os.path.getsize(i['media'])) - print "uploading %s of %s (%s)" % (profile, os.path.basename(filename), size) - url = self.url + 'upload/' + '?profile=' + str(profile) + '&id=' + i['oshash'] + name = os.path.basename(filename).decode('utf-8') + print (u"uploading %s of %s (%s)" % (profile, name, size)).encode('utf-8') + url = self.url + 'upload/?profile=%s&id=%s' % (profile, i['oshash']) if not self.upload_chunks(url, i['media'], data): if DEBUG: print "failed"