Just a small script for my daily use.
It can rename the subtitle file using the video file name.
It uses regular expression.
rename.py
with python 2.x.
ui.py
with python 3.x.
- If no config.ini exists, use
python rename.py
to create it. - Fill the config.ini.
- Execute
python rename.py
to rename.
More details may be found in config.ini.
Just execute python3 ui.py
.
- Fill the blank entry
- Click button Src match, to list the matched video files.
- Click button Dst match, to list the matched subtitle files.
- Click button List Todo, to list the rename actions to do.
- Click button Run, to do the rename actions.
src pattern
: match the video files. Use the group name(?P<name>)
to specify the subtitle's namedst pattern
: match the subtitle files. Use the group name(?P<ext>)
to specify the subtitle's extsrc key pattern
: the regex pattern for key in video's filename. Use the group name(?P<key>)
to specify the keydst key pattern
: the regex pattern for key in subtitle's filename. Use the group name(?P<key>)
to specify the keykey collect
: the match key collect. You can use multiple keys as one key for match
For example,
src pattern: (?P<name>.+)\.(mp4|mkv|avi)
dst pattern: .+chs(?P<ext>\.(ass|ssa|srt))
key collect: key1,key2,suffix
src key pattern: (?P<key1>\d{2})xxx(?P<key2>\w+)-(?P<suffix>\w+)
dst key pattern: (?P<key1>\d{2})---(?P<suffix>\w+)xxx(?P<key2>\w+)