Pad the left side of hours/minutes/seconds with 0 and handle no description
This commit is contained in:
parent
64763e014f
commit
71727a7b6f
|
@ -202,7 +202,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hanimers"
|
name = "hanimers"
|
||||||
version = "0.1.6"
|
version = "0.1.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"quick-xml",
|
"quick-xml",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "hanimers"
|
name = "hanimers"
|
||||||
version = "0.1.6"
|
version = "0.1.7"
|
||||||
authors = ["blank X <theblankx@protonmail.com>"]
|
authors = ["blank X <theblankx@protonmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
|
|
@ -135,15 +135,18 @@ impl fmt::Display for HentaiInfo {
|
||||||
}
|
}
|
||||||
let mut duration = String::new();
|
let mut duration = String::new();
|
||||||
if hours > 0 {
|
if hours > 0 {
|
||||||
duration.push_str(&format!("{}:", hours));
|
duration.push_str(&format!("{:02}:", hours));
|
||||||
}
|
}
|
||||||
if minutes > 0 {
|
if minutes > 0 {
|
||||||
duration.push_str(&format!("{}:", minutes));
|
duration.push_str(&format!("{:02}:", minutes));
|
||||||
}
|
}
|
||||||
duration.push_str(&seconds.to_string());
|
text.push_str(&format!("Duration: {}{:02}\n", &duration, seconds));
|
||||||
text.push_str(&format!("Duration: {}\n", &duration));
|
|
||||||
}
|
}
|
||||||
formatter.write_str(&format!("{}Tags: {}\nDescription: {}", &text, video.hentai_tags.iter().map(|i| i.text.as_str()).collect::<Vec<_>>().join(", "), &video.description))
|
text.push_str(&format!("Tags: {}", video.hentai_tags.iter().map(|i| i.text.as_str()).collect::<Vec<_>>().join(", ")));
|
||||||
|
if !video.description.is_empty() {
|
||||||
|
text.push_str(&format!("\nDescription: {}", &video.description));
|
||||||
|
}
|
||||||
|
formatter.write_str(&text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue