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

Correctly handle unicode chapters #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

throwawayay
Copy link

Also fixes potential bug of Error: '--chapter-charset' must be given before '--chapters' in '--chapter-charset UTF-8'.

@sheldonkwoodward sheldonkwoodward self-assigned this Jun 27, 2020
@sheldonkwoodward
Copy link
Owner

Hi @throwawayay, could you provide some unicode chapter files for me to test with?

@throwawayay
Copy link
Author

Note that my approach is not the cleanest but it does end up needing the smallest code change. I've attached two sample files (in the "simple") chapter format.

sample1.txt
sample2.txt

P.S. Related to internationalization - there's another issue where pymkv cannot set the character encoding on subtitles (--sub-charset 0:ISO-8859-15, for example), but it's not related to this specifically. I'll open up another issue for that if you're interested in that discussion.

@sheldonkwoodward
Copy link
Owner

Thanks for the files, I’ll take a look here in the next few days. Also, that would be great if you can open an issue with a detailed description of the issue regarding internationalization.

@sheldonkwoodward sheldonkwoodward added the bug Something isn't working label Jun 27, 2020
Copy link
Owner

@sheldonkwoodward sheldonkwoodward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be best to fully develop the --chapter-charset option in the object so users will have more options when it comes to different charsets.

Comment on lines +221 to 224
if self._chapters_file is not None:
command.extend(['--chapter-charset UTF-8 --chapters', self._chapters_file])
if self._chapter_language is not None:
command.extend(['--chapter-language', self._chapter_language])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of combining the --chapter-charset option here with the --chapters option, lets give the user more control by creating a new self._chapters_charset variable that is stored in the MKVFile object. It can be initialized to None when the object is created and have property methods similar to the chapter language property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants