Posted: Sun Dec 04, 2011 1:33 am Post subject: Music files with foreign characters
I'm having problems with music files with foreign characters in them. Most annoying was that pyTivo would terminate its file scan upon the first error hit and ignore the other 1000 songs in the library.
It has to do with the defined behavior of os.listdir(). The documentation says it may return unicode or it may return <something else?> if it can't be converted to unicode. I'm not sure what that something else is on my system. I assumed it would be an 8859-1 variant or utf-8, but couldn't manually encode the string back to unicode. Maybe it was flagged as ASCII, but my environment has LC_CTYPE=en_US.UTF-8. I've been using a samba share and dropping files there from various versions of windows.
File "/opt/pytivo/plugins/music/music.py", line 459, in get_files
filelist = SortList(build_recursive_list(path, recurse))
File "/opt/pytivo/plugins/music/music.py", line 404, in build_recursive_list
f = os.path.join(path, f)
File "/usr/lib64/python2.7/posixpath.py", line 70, in join
path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xa1 in position 2: ordinal not in range(128)
I'm attaching a patch which I think will be safe for all OS's. It skips the bad files and logs a warning line for each file skipped. I didn't get them loading properly and can live without a few mp3 files.
I don't know if the same issue will be seen with video files.
Diff vs. 03-Dec-2011 git://repo.or.cz/pyTivo/wmcbrine
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum