mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 12:12:00 -06:00
Add padding
This commit is contained in:
parent
8bb2c9c750
commit
af9aca4d0c
3 changed files with 44 additions and 23 deletions
|
|
@ -58,16 +58,18 @@ pub struct Archive {
|
||||||
#[arg(help = "Name of the output file")]
|
#[arg(help = "Name of the output file")]
|
||||||
#[arg(long_help = "Name of the output file.\
|
#[arg(long_help = "Name of the output file.\
|
||||||
If you use one of the following pattern they will get replaced:\n \
|
If you use one of the following pattern they will get replaced:\n \
|
||||||
{title} → Title of the video\n \
|
{title} → Title of the video\n \
|
||||||
{series_name} → Name of the series\n \
|
{series_name} → Name of the series\n \
|
||||||
{season_name} → Name of the season\n \
|
{season_name} → Name of the season\n \
|
||||||
{audio} → Audio language of the video\n \
|
{audio} → Audio language of the video\n \
|
||||||
{resolution} → Resolution of the video\n \
|
{resolution} → Resolution of the video\n \
|
||||||
{season_number} → Number of the season\n \
|
{padded_season_number} → Number of the season padded to double digits\n \
|
||||||
{episode_number} → Number of the episode\n \
|
{season_number} → Number of the season\n \
|
||||||
{series_id} → ID of the series\n \
|
{padded_episode_number} → Number of the episode padded to double digits\n \
|
||||||
{season_id} → ID of the season\n \
|
{episode_number} → Number of the episode\n \
|
||||||
{episode_id} → ID of the episode")]
|
{series_id} → ID of the series\n \
|
||||||
|
{season_id} → ID of the season\n \
|
||||||
|
{episode_id} → ID of the episode")]
|
||||||
#[arg(short, long, default_value = "{title}.mkv")]
|
#[arg(short, long, default_value = "{title}.mkv")]
|
||||||
output: String,
|
output: String,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,16 +36,18 @@ pub struct Download {
|
||||||
#[arg(help = "Name of the output file")]
|
#[arg(help = "Name of the output file")]
|
||||||
#[arg(long_help = "Name of the output file.\
|
#[arg(long_help = "Name of the output file.\
|
||||||
If you use one of the following pattern they will get replaced:\n \
|
If you use one of the following pattern they will get replaced:\n \
|
||||||
{title} → Title of the video\n \
|
{title} → Title of the video\n \
|
||||||
{series_name} → Name of the series\n \
|
{series_name} → Name of the series\n \
|
||||||
{season_name} → Name of the season\n \
|
{season_name} → Name of the season\n \
|
||||||
{audio} → Audio language of the video\n \
|
{audio} → Audio language of the video\n \
|
||||||
{resolution} → Resolution of the video\n \
|
{resolution} → Resolution of the video\n \
|
||||||
{season_number} → Number of the season\n \
|
{padded_season_number} → Number of the season padded to double digits\n \
|
||||||
{episode_number} → Number of the episode\n \
|
{season_number} → Number of the season\n \
|
||||||
{series_id} → ID of the series\n \
|
{padded_episode_number} → Number of the episode padded to double digits\n \
|
||||||
{season_id} → ID of the season\n \
|
{episode_number} → Number of the episode\n \
|
||||||
{episode_id} → ID of the episode")]
|
{series_id} → ID of the series\n \
|
||||||
|
{season_id} → ID of the season\n \
|
||||||
|
{episode_id} → ID of the episode")]
|
||||||
#[arg(short, long, default_value = "{title}.ts")]
|
#[arg(short, long, default_value = "{title}.ts")]
|
||||||
output: String,
|
output: String,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,9 +77,26 @@ pub fn format_string(s: String, format: &Format, sanitize: bool) -> String {
|
||||||
.replace("{series_name}", &sanitize_func(&format.series_name))
|
.replace("{series_name}", &sanitize_func(&format.series_name))
|
||||||
.replace("{season_name}", &sanitize_func(&format.season_title))
|
.replace("{season_name}", &sanitize_func(&format.season_title))
|
||||||
.replace("{audio}", &sanitize_func(&format.audio.to_string()))
|
.replace("{audio}", &sanitize_func(&format.audio.to_string()))
|
||||||
.replace("{resolution}", &sanitize_func(&format.stream.resolution.to_string()))
|
.replace(
|
||||||
.replace("{season_number}", &sanitize_func(&format.season_number.to_string()))
|
"{resolution}",
|
||||||
.replace("{episode_number}", &sanitize_func(&format.number.to_string()))
|
&sanitize_func(&format.stream.resolution.to_string()),
|
||||||
|
)
|
||||||
|
.replace(
|
||||||
|
"{padded_season_number}",
|
||||||
|
&sanitize_func(&format!("{:0>2}", format.season_number.to_string())),
|
||||||
|
)
|
||||||
|
.replace(
|
||||||
|
"{season_number}",
|
||||||
|
&sanitize_func(&format.season_number.to_string()),
|
||||||
|
)
|
||||||
|
.replace(
|
||||||
|
"{padded_episode_number}",
|
||||||
|
&sanitize_func(&format!("{:0>2}", format.number.to_string())),
|
||||||
|
)
|
||||||
|
.replace(
|
||||||
|
"{episode_number}",
|
||||||
|
&sanitize_func(&format.number.to_string()),
|
||||||
|
)
|
||||||
.replace("{series_id}", &sanitize_func(&format.series_id))
|
.replace("{series_id}", &sanitize_func(&format.series_id))
|
||||||
.replace("{season_id}", &sanitize_func(&format.season_id))
|
.replace("{season_id}", &sanitize_func(&format.season_id))
|
||||||
.replace("{episode_id}", &sanitize_func(&format.id))
|
.replace("{episode_id}", &sanitize_func(&format.id))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue