diff options
-rw-r--r-- | yt/src/select/cmds/mod.rs | 13 | ||||
-rw-r--r-- | yt/src/select/mod.rs | 15 | ||||
-rw-r--r-- | yt/src/storage/video_database/get/mod.rs | 6 | ||||
-rw-r--r-- | yt/src/watch/mod.rs | 18 | ||||
-rw-r--r-- | yt/src/watch/playlist_handler/mod.rs | 29 |
5 files changed, 51 insertions, 30 deletions
diff --git a/yt/src/select/cmds/mod.rs b/yt/src/select/cmds/mod.rs index ea41f99..aabcd3d 100644 --- a/yt/src/select/cmds/mod.rs +++ b/yt/src/select/cmds/mod.rs @@ -51,10 +51,15 @@ pub async fn handle_select_cmd( is_focused, } = video.status { - handle_status_change(app, shared, line_number, VideoStatus::Cached { - cache_path, - is_focused, - }) + handle_status_change( + app, + shared, + line_number, + VideoStatus::Cached { + cache_path, + is_focused, + }, + ) .await?; } else { handle_status_change(app, shared, line_number, VideoStatus::Watch).await?; diff --git a/yt/src/select/mod.rs b/yt/src/select/mod.rs index 54db65c..8db9ae3 100644 --- a/yt/src/select/mod.rs +++ b/yt/src/select/mod.rs @@ -53,12 +53,15 @@ pub async fn select(app: &App, done: bool, use_last_selection: bool) -> Result<( let matching_videos = if done { get::videos(app, VideoStatusMarker::ALL).await? } else { - get::videos(app, &[ - VideoStatusMarker::Pick, - // - VideoStatusMarker::Watch, - VideoStatusMarker::Cached, - ]) + get::videos( + app, + &[ + VideoStatusMarker::Pick, + // + VideoStatusMarker::Watch, + VideoStatusMarker::Cached, + ], + ) .await? }; diff --git a/yt/src/storage/video_database/get/mod.rs b/yt/src/storage/video_database/get/mod.rs index 759c048..a1871e2 100644 --- a/yt/src/storage/video_database/get/mod.rs +++ b/yt/src/storage/video_database/get/mod.rs @@ -64,7 +64,11 @@ macro_rules! video_from_record { let optional = if let Some(cache_path) = &$record.cache_path { Some(( PathBuf::from(cache_path), - if $record.is_focused == Some(1) { true } else { false }, + if $record.is_focused == Some(1) { + true + } else { + false + }, )) } else { None diff --git a/yt/src/watch/mod.rs b/yt/src/watch/mod.rs index 6827b2c..c32a76f 100644 --- a/yt/src/watch/mod.rs +++ b/yt/src/watch/mod.rs @@ -58,9 +58,12 @@ fn init_mpv(app: &App) -> Result<(Mpv, EventContext)> { let config_path = &app.config.paths.mpv_config_path; if config_path.try_exists()? { info!("Found mpv.conf at '{}'!", config_path.display()); - mpv.command("load-config-file", &[config_path - .to_str() - .context("Failed to parse the config path is utf8-stringt")?])?; + mpv.command( + "load-config-file", + &[config_path + .to_str() + .context("Failed to parse the config path is utf8-stringt")?], + )?; } else { warn!( "Did not find a mpv.conf file at '{}'", @@ -71,9 +74,12 @@ fn init_mpv(app: &App) -> Result<(Mpv, EventContext)> { let input_path = &app.config.paths.mpv_input_path; if input_path.try_exists()? { info!("Found mpv.input.conf at '{}'!", input_path.display()); - mpv.command("load-input-conf", &[input_path - .to_str() - .context("Failed to parse the input path as utf8 string")?])?; + mpv.command( + "load-input-conf", + &[input_path + .to_str() + .context("Failed to parse the input path as utf8 string")?], + )?; } else { warn!( "Did not find a mpv.input.conf file at '{}'", diff --git a/yt/src/watch/playlist_handler/mod.rs b/yt/src/watch/playlist_handler/mod.rs index 2672ff5..29b8f39 100644 --- a/yt/src/watch/playlist_handler/mod.rs +++ b/yt/src/watch/playlist_handler/mod.rs @@ -41,10 +41,10 @@ pub enum Status { } fn mpv_message(mpv: &Mpv, message: &str, time: Duration) -> Result<()> { - mpv.command("show-text", &[ - message, - time.as_millis().to_string().as_str(), - ])?; + mpv.command( + "show-text", + &[message, time.as_millis().to_string().as_str()], + )?; Ok(()) } @@ -139,15 +139,18 @@ pub(super) async fn reload_mpv_playlist( debug!("Will add {} videos to playlist.", playlist.len()); playlist.into_iter().try_for_each(|cache_path| { - mpv.command("loadfile", &[ - cache_path.to_str().with_context(|| { - format!( - "Failed to parse the video cache path ('{}') as valid utf8", - cache_path.display() - ) - })?, - "append-play", - ])?; + mpv.command( + "loadfile", + &[ + cache_path.to_str().with_context(|| { + format!( + "Failed to parse the video cache path ('{}') as valid utf8", + cache_path.display() + ) + })?, + "append-play", + ], + )?; Ok::<(), anyhow::Error>(()) })?; |