about summary refs log tree commit diff stats
path: root/src/select
diff options
context:
space:
mode:
Diffstat (limited to 'src/select')
-rw-r--r--src/select/cmds.rs25
-rw-r--r--src/select/selection_file/help.str6
2 files changed, 18 insertions, 13 deletions
diff --git a/src/select/cmds.rs b/src/select/cmds.rs
index 40e5b17..85e655f 100644
--- a/src/select/cmds.rs
+++ b/src/select/cmds.rs
@@ -25,41 +25,46 @@ pub async fn handle_select_cmd(
     cmd: SelectCommand,
     line_number: Option<i64>,
 ) -> Result<()> {
+    fn compute_priority(line_number: Option<i64>, priority: Option<i64>) -> Option<i64> {
+        if let Some(pri) = priority {
+            Some(pri)
+        } else if let Some(pri) = line_number {
+            Some(pri)
+        } else {
+            None
+        }
+    }
+
     match cmd {
         SelectCommand::Pick { shared } => {
+            let priority = compute_priority(line_number, shared.priority);
             set_video_status(
                 app,
                 &shared.hash.realize(app).await?,
                 VideoStatus::Pick,
-                line_number,
+                priority,
             )
             .await?
         }
         SelectCommand::Drop { shared } => {
+            let priority = compute_priority(line_number, shared.priority);
             set_video_status(
                 app,
                 &shared.hash.realize(app).await?,
                 VideoStatus::Drop,
-                line_number,
+                priority,
             )
             .await?
         }
         SelectCommand::Watch {
             shared,
-            priority,
             subtitle_langs,
             speed,
         } => {
             let hash = shared.hash.realize(&app).await?;
             let video = get_video_by_hash(app, &hash).await?;
             let video_options = VideoOptions::new(subtitle_langs, speed);
-            let priority = if let Some(pri) = priority {
-                Some(pri)
-            } else if let Some(pri) = line_number {
-                Some(pri)
-            } else {
-                None
-            };
+            let priority = compute_priority(line_number, shared.priority);
 
             if let Some(_) = video.cache_path {
                 set_video_status(app, &hash, VideoStatus::Cached, priority).await?;
diff --git a/src/select/selection_file/help.str b/src/select/selection_file/help.str
index 6e296f6..295bc4d 100644
--- a/src/select/selection_file/help.str
+++ b/src/select/selection_file/help.str
@@ -1,8 +1,8 @@
 # Commands:
 #   w, watch [-p,-s,-l]   Mark the video given by the hash to be watched
-#   d, drop               Mark the video given by the hash to be dropped
-#   u, url                Open the video URL in Firefox's `timesinks.youtube` profile
-#   p, pick               Reset the videos status to 'Pick'
+#   d, drop  [-p]         Mark the video given by the hash to be dropped
+#   u, url   [-p]         Open the video URL in Firefox's `timesinks.youtube` profile
+#   p, pick  [-p]         Reset the videos status to 'Pick'
 #
 # See `yt select <cmd_name> --help` for more help.
 #