Skip to content

Commit

Permalink
Merge pull request #1 from vvyushmanov/main
Browse files Browse the repository at this point in the history
Added support for Russian language
  • Loading branch information
Masterain98 authored Sep 1, 2022
2 parents 3cda822 + 43a4634 commit ed5be32
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
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

0 comments on commit ed5be32

Please sign in to comment.