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

Added support for Russian language #1

Merged
merged 2 commits into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ English README | [中文 README](https://github.com/Masterain98/PlexMuxy/blob/ma
- Usually are external 5.1 Channel audio and audio commentary

- Subtitle
- Determine the language by file name, including Simplified Chinese, Traditional Chinese, Japanese, SC&JP, TC&JP
- Determine the language by file name, including Simplified Chinese, Traditional Chinese, Japanese, SC&JP, TC&JP, Russian
- For Simplified Chinese, track name will be `chs` , and language is marked as `chi`
- For Traditional Chinese, track name will be `cht`, and language is marked as `chi`
- For Japanese, track name will be `jpn` and language is marked as `jpn`
- For SC&JP, track name will be `jp_sc` and language is marked as `chi`
- For TC&JP, track name will be `jp_tc` and language is marked as `chi`
- For Russian, track name will be `rus` and language is marked as `rus`

- Determine the subtitle author by file name

Expand Down Expand Up @@ -77,6 +78,8 @@ English README | [中文 README](https://github.com/Masterain98/PlexMuxy/blob/ma
| `.chs`, `.sc`, `[chs]`, `[sc]`, `.gb`, `[gb]` | chs |
| `.cht`, `.tc`, `[cht]`, `[tc]`, `big5`, `[big5]` | cht |
| `.jp`, `.jpn`, `.jap`, `[jp]`, `[jpn]`, `[jap]` | jpn |
| `.ru`, `.rus`, `[ru]`, `[rus]` | rus |


- If the file name starts with `[`, and the following characters until next `]` will be considered as subtitle author and marked in the track name

Expand Down
10 changes: 10 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def subtitle_info_checker(subtitle_file_name: str) -> dict:
JP_TC_LIST = [".jptc", "[jptc]", "jp_tc", "[jp_tc]", "cht&jap", "繁日"]
# Jpn
JP_LIST = [".jp", ".jpn", ".jap", "[jp]", "[jpn]", "[jap]"]
# Rus
RU_LIST = [".ru", ".rus", "[ru]", "[rus]"]

if any(indicator in subtitle_file_name.lower() for indicator in JP_SC_LIST):
language = "jp_sc"
Expand All @@ -74,6 +76,8 @@ def subtitle_info_checker(subtitle_file_name: str) -> dict:
language = "cht"
elif any(indicator in subtitle_file_name.lower() for indicator in JP_LIST):
language = "jpn"
elif any(indicator in subtitle_file_name.lower() for indicator in RU_LIST):
language = "rus"
else:
language = ""

Expand Down Expand Up @@ -179,6 +183,9 @@ def is_font_file(f: str) -> bool:
if this_sub_info["language"] == "jpn":
this_sub_track = MKVTrack(item, track_name=track_name,
default_track=True, language="jpn")
elif this_sub_info["language"] == "rus":
this_sub_track = MKVTrack(item, track_name=track_name,
default_track=True, language="rus")
else:
this_sub_track = MKVTrack(item, track_name=track_name,
default_track=True, language="chi")
Expand Down Expand Up @@ -228,6 +235,9 @@ def is_font_file(f: str) -> bool:
if this_sub_info["language"] == "jpn":
this_sub_track = MKVTrack(item, track_name=track_name,
default_track=True, language="jpn")
elif this_sub_info["language"] == "rus":
this_sub_track = MKVTrack(item, track_name=track_name,
default_track=True, language="rus")
else:
this_sub_track = MKVTrack(item, track_name=track_name,
default_track=True, language="chi")
Expand Down