mirror of
https://github.com/SinTan1729/movie-rename.git
synced 2024-12-27 04:38:35 -06:00
Add subtitles support
This commit is contained in:
parent
d0a937bc52
commit
e529ab2100
2 changed files with 13 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
/target
|
/target
|
||||||
*.mp4
|
*.mp4
|
||||||
|
*.srt
|
||||||
*.key
|
*.key
|
13
src/main.rs
13
src/main.rs
|
@ -91,9 +91,20 @@ fn main() {
|
||||||
.preview(display)
|
.preview(display)
|
||||||
.preview_label(filename.to_string());
|
.preview_label(filename.to_string());
|
||||||
let choice = menu.show()[0];
|
let choice = menu.show()[0];
|
||||||
|
|
||||||
|
let mut extension = metadata.extension().unwrap_or("").to_string();
|
||||||
|
if ["srt", "ssa"].contains(&extension.as_str()) {
|
||||||
|
let languages = Vec::from(["en", "hi", "bn", "de", "fr", "sp", "ja", "n/a"]);
|
||||||
|
let mut lang_menu = youchoose::Menu::new(languages.iter());
|
||||||
|
let lang_choice = lang_menu.show()[0];
|
||||||
|
if languages[lang_choice] != "none" {
|
||||||
|
extension = format!("{}.{}", languages[lang_choice], extension);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let mut new_name_vec = vec![
|
let mut new_name_vec = vec![
|
||||||
movie_list[choice].rename_format(pattern.to_string()),
|
movie_list[choice].rename_format(pattern.to_string()),
|
||||||
metadata.extension().unwrap_or("").to_string(),
|
extension,
|
||||||
];
|
];
|
||||||
new_name_vec.retain(|x| !x.is_empty());
|
new_name_vec.retain(|x| !x.is_empty());
|
||||||
let new_name = new_name_vec.join(".");
|
let new_name = new_name_vec.join(".");
|
||||||
|
|
Loading…
Reference in a new issue