Better unicode handling for scan code
This commit is contained in:
parent
dd259d0797
commit
7767dd1ae4
@ -147,7 +147,7 @@ def _add_to_tag_cache(result, folders, files):
|
||||
def tracks_to_directory_tree(tracks):
|
||||
directories = ({}, [])
|
||||
for track in tracks:
|
||||
path = ''
|
||||
path = u''
|
||||
current = directories
|
||||
|
||||
local_folder = os.path.expanduser(settings.LOCAL_MUSIC_FOLDER)
|
||||
|
||||
@ -83,7 +83,7 @@ class Scanner(object):
|
||||
def process_tags(self, bus, message):
|
||||
data = message.parse_tag()
|
||||
data = dict([(k, data[k]) for k in data.keys()])
|
||||
data['uri'] = self.uribin.get_property('uri')
|
||||
data['uri'] = unicode(self.uribin.get_property('uri'))
|
||||
data['duration'] = self.get_duration()
|
||||
self.data_callback(data)
|
||||
self.next_uri()
|
||||
|
||||
@ -49,13 +49,17 @@ def find_files(path):
|
||||
path = os.path.expanduser(path)
|
||||
if os.path.isfile(path):
|
||||
filename = os.path.abspath(path)
|
||||
yield filename.decode('utf-8')
|
||||
if not isinstance(filename, unicode):
|
||||
filename = filename.decode('utf-8')
|
||||
yield filename
|
||||
else:
|
||||
for dirpath, dirnames, filenames in os.walk(path):
|
||||
for filename in filenames:
|
||||
dirpath = os.path.abspath(dirpath)
|
||||
filename = os.path.join(dirpath, filename)
|
||||
yield filename.decode('utf-8')
|
||||
if not isinstance(filename, unicode):
|
||||
filename = filename.decode('utf-8')
|
||||
yield filename
|
||||
|
||||
class Mtime(object):
|
||||
def __init__(self):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user