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

Japanese characters in chapters.txt cause runtime issue #6

Open
GaProgMan opened this issue Jul 10, 2020 · 2 comments
Open

Japanese characters in chapters.txt cause runtime issue #6

GaProgMan opened this issue Jul 10, 2020 · 2 comments

Comments

@GaProgMan
Copy link

GaProgMan commented Jul 10, 2020

10kft view of error

When Japanese characters are added to the test.chapters.txt file (where test is the name of the mp3), and the mp3chaps -i test.mp3 is used, a runtime error happens, and the chapter marker is not added to the mp3 file.

Steps to recreate

  • Create a valid mp3 file called test.mp3
  • Create a text file called test.chapters.txt
  • Insert the following line into the text file:
    • 00:00:00.000 I N e e d Y o u 私の側て by G.H
  • Run the following command:
    • mp3chaps -i test.mp3

Full output from error

λ mp3chaps -i test.mp3
Traceback (most recent call last):
  File "c:\python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Python39\Scripts\mp3chaps.exe\__main__.py", line 7, in <module>
  File "c:\python39\lib\site-packages\mp3chaps.py", line 81, in main
    add_chapters(tag, args["<filename>"])
  File "c:\python39\lib\site-packages\mp3chaps.py", line 45, in add_chapters
    chaps = parse_chapters_file(fname)
  File "c:\python39\lib\site-packages\mp3chaps.py", line 39, in parse_chapters_file
    for line in f.readlines():
  File "c:\python39\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 31: character maps to <undefined>

Expected result

test.mp3 should have a single chapter marker called I N e e d Y o u 私の側て by G.H, and running mp3chaps -l test.mp3 should show:

λ mp3chaps -l test.mp3
Chapters:
I N e e d Y o u 私の側て by G.H

Machine details

  • Windows 10 (build number: 19041.329)
    • Will also test on my Ubuntu 20.04 machine and report back
  • mp3chaps vLatest from pip3 (at time of reporting)
  • Python 3.9.0b4
@GaProgMan
Copy link
Author

Tested on my Ubuntu 20.04 machine, running vLatest of Python 3 and cannot recreate.

I'll continue to use mp3chaps on my Ubuntu machine (daily driver - I hardly ever use my Windows machine).

@SimplexPL

This comment has been minimized.

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

No branches or pull requests

2 participants