mirror of
https://github.com/SinTan1729/movie-rename.git
synced 2024-12-25 19:58:36 -06:00
fix: Properly output Option enums
This commit is contained in:
parent
d2fc60b709
commit
89d15e9fb7
1 changed files with 12 additions and 2 deletions
|
@ -64,12 +64,21 @@ impl fmt::Display for MovieEntry {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let mut buffer = String::new();
|
let mut buffer = String::new();
|
||||||
buffer.push_str(&format!("{} ", self.title));
|
buffer.push_str(&format!("{} ", self.title));
|
||||||
buffer.push_str(&format!("({:?}), ", self.year));
|
|
||||||
|
if self.year.is_some() {
|
||||||
|
buffer.push_str(&format!("({}), ", self.year.as_ref().unwrap()));
|
||||||
|
}
|
||||||
buffer.push_str(&format!(
|
buffer.push_str(&format!(
|
||||||
"Language: {}, ",
|
"Language: {}, ",
|
||||||
get_long_lang(self.language.as_str())
|
get_long_lang(self.language.as_str())
|
||||||
));
|
));
|
||||||
buffer.push_str(&format!("Directed by: {:?}, ", self.director));
|
|
||||||
|
if self.director.is_some() {
|
||||||
|
buffer.push_str(&format!(
|
||||||
|
"Directed by: {}, ",
|
||||||
|
self.director.as_ref().unwrap()
|
||||||
|
));
|
||||||
|
}
|
||||||
buffer.push_str(&format!("TMDB ID: {}", self.id));
|
buffer.push_str(&format!("TMDB ID: {}", self.id));
|
||||||
// buffer.push_str(&format!("Synopsis: {}", self.overview));
|
// buffer.push_str(&format!("Synopsis: {}", self.overview));
|
||||||
write!(f, "{buffer}")
|
write!(f, "{buffer}")
|
||||||
|
@ -112,6 +121,7 @@ pub fn get_long_lang(short: &str) -> String {
|
||||||
"ja" => "Japanese",
|
"ja" => "Japanese",
|
||||||
"de" => "German",
|
"de" => "German",
|
||||||
"sp" => "Spanish",
|
"sp" => "Spanish",
|
||||||
|
"fa" => "Persian",
|
||||||
"none" => "None",
|
"none" => "None",
|
||||||
other => other,
|
other => other,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue