supermihi / pytaglib

Python audio tagging library
GNU General Public License v3.0
187 stars 29 forks source link

OSError reading file with äüö´` and even chinese signs #64

Closed music-fan closed 5 years ago

music-fan commented 5 years ago

Hi I'm trying to use TagLib/pytaglib but I'm stuck with my mp3 and flac filenames. They have all sort of encoding including `´äü and even chinese. Unfortunately, 5% of my music library files can not be read with TagLib (song.tag[...] returns OSError "can not read file"). Can you help a newbie? I can read my files with Mp3Tag, Kodi, raspberry/osmc(Debian kind) and Windows 10. My Python 3.7 is running on my windows 10 PC. thank you in advance Georg

supermihi commented 5 years ago

So far I did not run into problems with filename encondings, even on windows. Could you send me one of the failing files so I can test it by myself?

music-fan commented 5 years ago

thank you for the fast reply! the difficult character ist after ...Dell'Anna mp3.zip

music-fan commented 5 years ago

here some other filenames: bad_name Out[132]: ['.\An cunta che10 - Crëps Slauris.mp3', '.\An cunta che6 - La Pesc Gnará.mp3', '.\An cunta cheGanes-T\x810Š5mp impormet¨¹.mp3', '.\Caprize01 - Nëi.mp3', '.\Caprize10 - Cuncè Le Cör.mp3', '.\Mai Guai (Special Edition [Disc 2])04 Tristeza É.mp3', '.\Mai Guai (Special Edition [Disc 2])08 Chissà.mp3', ".\Mai Guai (Special Edition [Disc 2])09 En Pü 'd' Amur.mp3", '.\Mai Guai (Special Edition [Disc 2])10 Lüna.mp3', '.\Parores & Neores03 - Paóm.mp3', '.\Parores & Neores05 - Fortüna.mp3', '.\Parores & Neores06 - Corù.mp3', ".\Parores & Neores08 - Giré L'Cör.mp3", '.\Parores & Neores11 - A Té.mp3']

music-fan commented 5 years ago

they are tagged with MusicBrainz/Picard and files named according song title.

music-fan commented 5 years ago

I just now saw, that I'm not "Replace non-ASCII characters" for file names in Picard; I will do in the future.

music-fan commented 5 years ago

Hi, The replacing of diacritics in MusicBrainz/Picard is at least for German Umlaute not satisfying (e.g., ä -> a and not ae).

But I solved my problem. Spyder setting was ok (UTF-8) but my Windows was running (standard) cp1252. I checked in Anaconda Prompt and it was the same. Changing Windows (in Regions) to UTF-8, restart, et voilà, both Spyder and Anaconda are set to UTF-8 and the TagLib can read all my files and tags, even including filenames in chinese.

supermihi commented 5 years ago

Thanks for posting your solution; sorry, I was to slow to investigate by myself before. :-) I'll add a note to the readme and/or think about a better detection of OS encoding.