Skip to content
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

Filename Error when downloading #138

Closed
raymonddong opened this issue Sep 4, 2023 · 3 comments · Fixed by #140
Closed

Filename Error when downloading #138

raymonddong opened this issue Sep 4, 2023 · 3 comments · Fixed by #140

Comments

@raymonddong
Copy link

raymonddong commented Sep 4, 2023

Describe the bug
When downloading "Violet Evergarden Gaiden: Eien to Jidou Shuki Ningyou" this error would occur:
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\Users\raymo\Documents\GitHub\anipy-cli\anipy_cli\download\Violet Evergarden Gaiden Eien to Jidou Shuki Ningyou\t'

To Reproduce
Steps to reproduce the behavior:

Download Mode
Downloads are stored in: C:\Users\raymo\Documents\GitHub\anipy-cli\anipy_cli\download
Search MyAnimeList for anime in Season? (y|n):

n
Search: violet evergarden
Add another search: (y|n)
n

Current: violet evergarden
[1] Violet Evergarden
[2] Violet Evergarden Movie
[3] Violet Evergarden: Recollections
[4] Violet Evergarden Gaiden: Eien to Jidou Shuki Ningyou
Enter Number: 4
Episode (Range with '-') [1-1]

1
Traceback (most recent call last):
File "C:\Users\raymo\Documents\GitHub\anipy-cli\anipy_cli.py", line 14, in
main()
File "C:\Users\raymo\Documents\GitHub\anipy-cli\anipy_cli.py", line 8, in main
cli.run_cli()
File "C:\Users\raymo\Documents\GitHub\anipy-cli\anipy_cli\cli\cli.py", line 37, in run_cli
cli_class(options=args, rpc_client=rpc_client).run()
File "C:\Users\raymo\Documents\GitHub\anipy-cli\anipy_cli\cli\clis\base_cli.py", line 36, in run
self.process()
File "C:\Users\raymo\Documents\GitHub\anipy-cli\anipy_cli\cli\clis\download_cli.py", line 86, in process
download(entry, self.options.quality, self.options.ffmpeg).download()
File "C:\Users\raymo\Documents\GitHub\anipy-cli\anipy_cli\download.py", line 57, in download
self.show_folder.mkdir(exist_ok=True)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.496.0_x64__qbz5n2kfra8p0\Lib\pathlib.py", line 1116, in mkdir
os.mkdir(self, mode)
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\Users\raymo\Documents\GitHub\anipy-cli\anipy_cli\download\Violet Evergarden Gaiden Eien to Jidou Shuki Ningyou\t'

C:\Windows\System32>

Expected behavior
File would download

Info
Name: anipy-cli
Version: 2.7.22
Summary: Little tool in python to watch anime from the terminal (the better way to watch anime)
Home-page: https://github.com/sdaqo/anipy-cli
Author: sdaqo
Author-email: sdaqo.dev@protonmail.com
License: GPL-3.0
Location: C:\Users\raymo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages
Requires: beautifulsoup4, better-ffmpeg-progress, m3u8, moviepy, pycryptodomex, pypresence, python-dateutil, python-mpv, pyyaml, requests, setuptools, tqdm
Required-by:

Platform

  • OS: Windows

Additional context
Seems to occur only with this title. All other titles I've tried work fine.

@raymonddong
Copy link
Author

Another weird title I found that fails is
5-toubun no Hanayome∽
Tho different error

Search MyAnimeList for anime in Season? (y|n):

n
Search: hanayome
Add another search: (y|n)
n

Current: hanayome
[1] Seto No Hanayome
[2] Gotoubun no Hanayome
[3] Seto No Hanayome Ova
[4] 5-toubun no Hanayome 2
[5] 5-toubun no Hanayome∽
[6] 5-toubun no Hanayome Movie
[7] Ranma 1/2: Nihao my Concubine
[8] Detective Conan Movie 25: Halloween no Hanayome
[9] UFO Ultramaiden Valkyrie 3: Bride of Celestial Souls` Day
[10] Crayon Shin-chan Movie 18: Chou Jikuu! Arashi wo Yobu Ora no Hanayome
Enter Number: 5
Episode (Range with '-') [1-1]

1


Downloading: 5-toubun no Hanayome∽ EP: 1 - hls
Traceback (most recent call last):
File "C:\Users\raymo\Documents\GitHub\anipy-cli\anipy_cli.py", line 14, in
main()
File "C:\Users\raymo\Documents\GitHub\anipy-cli\anipy_cli.py", line 8, in main
cli.run_cli()
File "C:\Users\raymo\Documents\GitHub\anipy-cli\anipy_cli\cli\cli.py", line 37, in run_cli
cli_class(options=args, rpc_client=rpc_client).run()
File "C:\Users\raymo\Documents\GitHub\anipy-cli\anipy_cli\cli\clis\base_cli.py", line 36, in run
self.process()
File "C:\Users\raymo\Documents\GitHub\anipy-cli\anipy_cli\cli\clis\download_cli.py", line 86, in process
download(entry, self.options.quality, self.options.ffmpeg).download()
File "C:\Users\raymo\Documents\GitHub\anipy-cli\anipy_cli\download.py", line 94, in download
self.multithread_m3u8_dl()
File "C:\Users\raymo\Documents\GitHub\anipy-cli\anipy_cli\download.py", line 301, in multithread_m3u8_dl
input_file = self._dump_m3u8(self._m3u8_content)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\raymo\Documents\GitHub\anipy-cli\anipy_cli\download.py", line 398, in _dump_m3u8
content.dump(filename)
File "C:\Users\raymo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\m3u8\model.py", line 371, in dump
fileobj.write(self.dumps())
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.496.0_x64__qbz5n2kfra8p0\Lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'charmap' codec can't encode character '\u223d' in position 153: character maps to

@DragonOfShuu
Copy link
Contributor

Okay, so basically it looks like anipy-cli is trying to save the file as the exact name for the anime, but some OS's don't support the characters being written (tab key, or tilda). I'll go ahead and see if I can fix it and make a pull request if I can. Thanks for the highlight!

@sdaqo
Copy link
Owner

sdaqo commented Sep 5, 2023

Okay, so basically it looks like anipy-cli is trying to save the file as the exact name for the anime, but some OS's don't support the characters being written (tab key, or tilda). I'll go ahead and see if I can fix it and make a pull request if I can. Thanks for the highlight!

That would be nice. We already have a function that takes care of cleaning filenames in download.py. what you could do is to get rid of Unicode chars by encoding it to ASCII, something like that :encode("ascii", "ignore"). I would do it but currently not at home and editing with my phone is no fun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants