async fn cut_file(&self, file: &PathBuf) -> Result<PathBuf, Box<dyn std::error::Error + Send>> {
        let mut new_path = file.clone();
        let mut ext = file.extension().unwrap();
        // nicer for discord, because discord doesn't embed mkvs
        if ext.eq("mkv") {
            ext = &OsStr::new("mp4");
        }
        new_path.pop();
        new_path.push(format!("cut_file.{}", ext.to_str().unwrap()));
        let mut ffmpeg = FFmpeg::new(file)?;

        if let Some(start) = self.start {
            ffmpeg.set_interval(start, self.end);
        }

        ffmpeg.cut_file(&mut new_path, crate::CONFIG.copy_codec())?;

        Ok(new_path)
    }
///
/// Cuts the downloaded file to the given timestamps.
/// If no end stamp was given, the cut goes from the given start time to the end.
///
/// uses ffmpeg in ['crate::model::ffmpeg::FFmpeg'] to cut the files
Cuts the downloaded file to the given timestamps.
If no end stamp was given, the cut goes from the given start time to the end.


Cuts the downloaded file to the given timestamps . If no end stamp was given the cut goes from the given start time to the end .
async fn cut_file(&self, file: &PathBuf) -> Result<PathBuf, Box<dyn std::error::Error + Send>> {
        let mut new_path = file.clone();
        let mut ext = file.extension().unwrap();
        // nicer for discord, because discord doesn't embed mkvs
        if ext.eq("mkv") {
            ext = &OsStr::new("mp4");
        }
        new_path.pop();
        new_path.push(format!("cut_file.{}", ext.to_str().unwrap()));
        let mut ffmpeg = FFmpeg::new(file)?;
        if let Some(start) = self.start {
            ffmpeg.set_interval(start, self.end);
        }
        ffmpeg.cut_file(&mut new_path, crate::CONFIG.copy_codec())?;
        Ok(new_path)
    }
async fn cut_file ( & self , file : & PathBuf ) -> Result < PathBuf , Box < dyn std :: error :: Error + Send > > { let mut new_path = file . clone ( ) ; let mut ext = file . extension ( ) . unwrap ( ) ; // nicer for discord, because discord doesn't embed mkvs if ext . eq ( " " ) { ext = & OsStr :: new ( " " ) ; } new_path . pop ( ) ; new_path . push ( format ! ( " " ext to_str ( ) unwrap ( ) ) ) ; let mut ffmpeg = FFmpeg :: new ( file ) ? ; if let Some ( start ) = self . start { ffmpeg . set_interval ( start , self . end ) ; } ffmpeg . cut_file ( & mut new_path , crate :: CONFIG . copy_codec ( ) ) ? ; Ok ( new_path ) }
Cuts the downloaded file to the given timestamps.
Cuts the downloaded file to the given timestamps .
&self
file
&PathBuf
&self
file
&PathBuf