From 90a57e23cc44704f46b77d2b11f6c5a3adac997b Mon Sep 17 00:00:00 2001 From: mitchell Date: Fri, 5 Jul 2024 05:54:32 -0400 Subject: [PATCH] Update ytmpv function --- .config/fish/functions/ytmpv.fish | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.config/fish/functions/ytmpv.fish b/.config/fish/functions/ytmpv.fish index 29e7d4f..d098493 100644 --- a/.config/fish/functions/ytmpv.fish +++ b/.config/fish/functions/ytmpv.fish @@ -1,5 +1,6 @@ function ytmpv -d 'A script to help queue youtube videos on MPV' set -l queue ~/.ytmpv_queue + set -l downloads ~/.ytmpv_downloads/ if command --query prime-run set --function --export __NV_PRIME_RENDER_OFFLOAD 1 @@ -11,6 +12,10 @@ function ytmpv -d 'A script to help queue youtube videos on MPV' touch $queue end + if not test -d $downloads + mkdir $downloads + end + while read -P 'url(s)/command (play)> ' -l video switch $video case cl clear @@ -21,6 +26,9 @@ function ytmpv -d 'A script to help queue youtube videos on MPV' case d destroy rm -r $queue break + case dd destroy-downloads + rm -r $downloads + break case e edit $EDITOR $queue case f fg @@ -31,6 +39,22 @@ function ytmpv -d 'A script to help queue youtube videos on MPV' cat $queue case q quit return + case dl download + tmux attach -t ytmpv + tmux new-session -s ytmpv -- \ + yt-dlp \ + --format-sort 'height:1080' \ + --batch-file $queue \ + --path $downloads + break + case pd play-downloads + tmux attach -t ytmpv + tmux new-session -s ytmpv -- \ + mpv \ + --ytdl \ + --save-position-on-quit \ + $downloads + break case p play tmux attach -t ytmpv tmux new-session -s ytmpv -- \