-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fails on filenames that use a character encoding different from the system #28
Comments
Thanks for reporting. Non UTF-8 file names are definitely something the script should be able to deal with. You're probably right, that your friend won't be the only one. This problem should be solvable by making use of PEP 383. |
@StyXman Unfortunately I could not reproduce your issue yet. I tried to create files with random bytes as filenames, but did not succeed either - ran into a different issue: $ python
Python 3.8.6 (default, Sep 25 2020, 09:36:53)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.listdir()
['album-tag.mp3']
>>> os.rename('album-tag.mp3', os.urandom(4)+b'.mp3')
>>> os.listdir()
['\udcdb\udcc3\udcc0L.mp3'] $ env/bin/collectiongain /tmp/tmp.iEg1y395Tw
Collecting files ...
[1] ���L.mp3 |Test Album
Dispatching jobs ...
Now waiting for results ...
Unfortunately, there were some errors:
Test Album:Checking for Replay Gain information ...
/tmp/tmp.iEg1y395Tw/���L.mp3:none
Calculating Replay Gain information ...
Traceback (most recent call last):
File "/home/christian/sandbox/chaudum/rgain/rgain3/replaygain.py", line 112, in do_gain
tracks_data, albumdata = calculate_gain(files, ref_level)
File "/home/christian/sandbox/chaudum/rgain/rgain3/replaygain.py", line 53, in calculate_gain
rg.start()
File "/home/christian/sandbox/chaudum/rgain/rgain3/lib/rgcalc.py", line 93, in start
if not self._next_file():
File "/home/christian/sandbox/chaudum/rgain/rgain3/lib/rgcalc.py", line 184, in _next_file
self.src.set_property("location", fname)
TypeError: could not convert '/tmp/tmp.iEg1y395Tw/\udcdb\udcc3\udcc0L.mp3' to type 'gchararray' when setting property 'GstFileSrc.location'
0 successful, 1 failed.
All finished. |
Could you provide information about your Python version and encoding?
|
@StyXman ⬆️ |
Sorry, busy with life :(
I was pretty sure at least |
Ah:
|
Thanks, will have another try whether I can reproduce the issue on my machine. |
I am also having this problem. My OS is Ubuntu 22.04.4. I installed rgain via My failing output:
python3 -version:
python3 -c "import sys; print(sys.getfilesystemencoding(), sys.getdefaultencoding())":
locale:
I am happy to report any other information that can help diagnose this problem. |
How can I try to use PEP 383 to try to solve this issue? |
I have a friend that has a audio collection that predates the general availability of UTF-8 on OSs. He also has a lot of music with band, album and son names that include non ascii chars. Combine those two and you get:
Notice that these are valid filenames (from the OS point of view; on Unix, any char except
\0x00
and/
can be part of the path), just not valid UTF-8. Yes, he could sit down and rename all those files and directories, but I guess he won't be the only one.OTOH, you could say 'go fix your filenames' and we will understand. Cheers!
The text was updated successfully, but these errors were encountered: