nicfit / eyeD3

eyeD3 is a Python module and command line program for processing ID3 tags. Information about mp3 files (i.e bit rate, sample frequency, play time, etc.) is also provided. The formats supported are ID3v1 (1.0/1.1) and ID3v2 (2.3/2.4).
http://eyed3.nicfit.net/
GNU General Public License v3.0
547 stars 59 forks source link

eyeD3 cannot handle special characters in filenames #218

Open Sirove opened 6 years ago

Sirove commented 6 years ago

eyeD3 (0.8.7) cannot handle german special characters in filenames:

eyeD3 --title "Test" "Testäöü.mp3"
Nothing to do

But it works the other way around:

eyeD3 --title "Testäöü" "Test.mp3"
...D:\Downloads\Test.mp3[ 16.93 MB ]
-------------------------
Setting title: Testäöü
Time: 18:32     MPEG1, Layer III        [ 128 kb/s @ 44100 Hz - Joint stereo ]
-------------------------
ID3 v2.3:
title: Testäöü
artist:
album:
track:
Writing ID3 version v2.3
-------------------------
nicfit commented 6 years ago

What's your platform? Here's my quick tests.

$ touch "Testäöü.id3"
$ eyeD3 --title "Test" "Testäöü.id3"
/home/travis/devel/eyeD3/git/Testäöü.id3                                                                        [ 0.00 Bytes ]
-------------------------------------------------------------------------------------------------------------------------------
Setting title: Test
ID3 v2.4:
title: Test
artist: 
album: 
track:      
Writing ID3 version v2.4
-------------------------------------------------------------------------------------------------------------------------------

$ eyeD3 ./Testäöü.id3 
/home/travis/devel/eyeD3/git/Testäöü.id3                                                                      [ 281.00 Bytes ]
-------------------------------------------------------------------------------------------------------------------------------
ID3 v2.4:
title: Test
artist: 
album: 
track:      
-------------------------------------------------------------------------------------------------------------------------------

$ eyeD3 --title "Testäöü" Testäöü.id3
/home/travis/devel/eyeD3/git/Testäöü.id3                                                                      [ 281.00 Bytes ]
-------------------------------------------------------------------------------------------------------------------------------
Setting title: Testäöü
ID3 v2.4:
title: Testäöü
artist: 
album: 
track:      
Writing ID3 version v2.4
Sirove commented 6 years ago

Strange... I'm on Windows 10 1709 x64.

Sirove commented 6 years ago

Any suggestions about how I could try to troubleshoot this issue?

ssstain commented 6 years ago

Same here... Kinda. I'm unable to process non-ascii files and dirs with a python script under Windows 10. Here's the answer. https://stackoverflow.com/questions/34836792/python-magic-cant-identify-unicode-filename from_file() and libmagic under Windows are the cause. from_buffer() may help but with an overhead. As far as I've debugged the code, here's the call stack of my problem:

from_file (c:\<script_path>\.venv\Lib\site-packages\magic\magic.py:89)
guess_type (c:\<script_path>\.venv\Lib\site-packages\eyed3\utils\__init__.py:52)
guessMimetype (c:\<script_path>\.venv\Lib\site-packages\eyed3\utils\__init__.py:66)
load (c:\<script_path>\.venv\Lib\site-packages\eyed3\core.py:73)
<module> (c:\<script_path>\my_script.py:14)
nicfit commented 6 years ago

@Sirove / @ssstain Does this PR help? https://github.com/nicfit/eyeD3/pull/241

If you're able to apply and test that'd be great.

ssstain commented 6 years ago

@nicfit That worked for me! Under Windows 10. Finally i could traverse the whole dir of mp3s with "special characters". Though the committed code checks for "cannot open" error message to invoke a workaround... Is it language and locale independent? Does it always read "cannot open" no matter what the language of your windows is? Guess, it does. I have only english and cannot check another language. Anyway, it works. Hope, they will patch libmagic eventually.