mirror of https://github.com/mitchell/dotfiles.git
Update ytmpv function
This commit is contained in:
parent
e6ad00b8d9
commit
90a57e23cc
|
@ -1,5 +1,6 @@
|
||||||
function ytmpv -d 'A script to help queue youtube videos on MPV'
|
function ytmpv -d 'A script to help queue youtube videos on MPV'
|
||||||
set -l queue ~/.ytmpv_queue
|
set -l queue ~/.ytmpv_queue
|
||||||
|
set -l downloads ~/.ytmpv_downloads/
|
||||||
|
|
||||||
if command --query prime-run
|
if command --query prime-run
|
||||||
set --function --export __NV_PRIME_RENDER_OFFLOAD 1
|
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
|
touch $queue
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not test -d $downloads
|
||||||
|
mkdir $downloads
|
||||||
|
end
|
||||||
|
|
||||||
while read -P 'url(s)/command (play)> ' -l video
|
while read -P 'url(s)/command (play)> ' -l video
|
||||||
switch $video
|
switch $video
|
||||||
case cl clear
|
case cl clear
|
||||||
|
@ -21,6 +26,9 @@ function ytmpv -d 'A script to help queue youtube videos on MPV'
|
||||||
case d destroy
|
case d destroy
|
||||||
rm -r $queue
|
rm -r $queue
|
||||||
break
|
break
|
||||||
|
case dd destroy-downloads
|
||||||
|
rm -r $downloads
|
||||||
|
break
|
||||||
case e edit
|
case e edit
|
||||||
$EDITOR $queue
|
$EDITOR $queue
|
||||||
case f fg
|
case f fg
|
||||||
|
@ -31,6 +39,22 @@ function ytmpv -d 'A script to help queue youtube videos on MPV'
|
||||||
cat $queue
|
cat $queue
|
||||||
case q quit
|
case q quit
|
||||||
return
|
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
|
case p play
|
||||||
tmux attach -t ytmpv
|
tmux attach -t ytmpv
|
||||||
tmux new-session -s ytmpv -- \
|
tmux new-session -s ytmpv -- \
|
||||||
|
|
Loading…
Reference in New Issue