mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 04:02:00 -06:00
Fmt
This commit is contained in:
parent
4cd46f19ac
commit
91f8a82ca4
3 changed files with 12 additions and 3 deletions
|
|
@ -68,7 +68,12 @@ impl Execute for Download {
|
||||||
fn pre_check(&self) -> Result<()> {
|
fn pre_check(&self) -> Result<()> {
|
||||||
if has_ffmpeg() {
|
if has_ffmpeg() {
|
||||||
debug!("FFmpeg detected")
|
debug!("FFmpeg detected")
|
||||||
} else if PathBuf::from(&self.output).extension().unwrap_or_default().to_string_lossy() != "ts" {
|
} else if PathBuf::from(&self.output)
|
||||||
|
.extension()
|
||||||
|
.unwrap_or_default()
|
||||||
|
.to_string_lossy()
|
||||||
|
!= "ts"
|
||||||
|
{
|
||||||
bail!("File extension is not '.ts'. If you want to use a custom file format, please install ffmpeg")
|
bail!("File extension is not '.ts'. If you want to use a custom file format, please install ffmpeg")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,9 @@ pub use cli::{archive::Archive, download::Download, login::Login};
|
||||||
|
|
||||||
#[async_trait::async_trait(?Send)]
|
#[async_trait::async_trait(?Send)]
|
||||||
trait Execute {
|
trait Execute {
|
||||||
fn pre_check(&self) -> Result<()> { Ok(()) }
|
fn pre_check(&self) -> Result<()> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
async fn execute(self, ctx: Context) -> Result<()>;
|
async fn execute(self, ctx: Context) -> Result<()>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,5 +51,7 @@ pub fn free_file(mut path: PathBuf) -> PathBuf {
|
||||||
|
|
||||||
/// Sanitizes the given path to not contain any invalid file character.
|
/// Sanitizes the given path to not contain any invalid file character.
|
||||||
pub fn sanitize_file(path: PathBuf) -> PathBuf {
|
pub fn sanitize_file(path: PathBuf) -> PathBuf {
|
||||||
path.with_file_name(sanitize_filename::sanitize(path.file_name().unwrap().to_string_lossy()))
|
path.with_file_name(sanitize_filename::sanitize(
|
||||||
|
path.file_name().unwrap().to_string_lossy(),
|
||||||
|
))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue