diff --git a/.config/fish/functions/redisco.fish b/.config/fish/functions/redisco.fish index ec7d0d0..f252dfa 100644 --- a/.config/fish/functions/redisco.fish +++ b/.config/fish/functions/redisco.fish @@ -1,8 +1,20 @@ function redisco - while pgrep Discord >/dev/null 2>&1 - pkill Discord - sleep 1 + set -l to_kill discord + + if test -n "$argv" + set to_kill $argv end - discord >/dev/null 2>&1 & disown + pgrep -fia $to_kill + or return + + read -P 'continue? [Y/n]> ' -l confirm + + if test "$confirm" = 'n' + return + end + + pkill -fi $to_kill + + nohup $to_kill &> /dev/null & disown end diff --git a/.config/fish/functions/ytmpv.fish b/.config/fish/functions/ytmpv.fish index 18f264e..c7c7ecb 100644 --- a/.config/fish/functions/ytmpv.fish +++ b/.config/fish/functions/ytmpv.fish @@ -1,39 +1,19 @@ function ytmpv -d 'A script to help queue youtube videos on MPV' set -l queue ~/.ytmpv_queue - set -l downloads ~/.ytmpv_downloads/ if not test -f $queue 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 clear case c copy set -l video (fromcb) - string split ' ' $video >> $queue + string split ' ' $video >>$queue case d destroy - rm -r $queue $downloads - break - case dl download - set -l urls (cat $queue) - read -P 'username> ' -l username - read -P 'password> ' -s -l password - - tmux attach -t ytdlp - tmux new-session -s ytdlp -- \ - yt-dlp \ - --username="$username" \ - --password="$password" \ - --paths=$downloads \ - --write-subs \ - $urls - + rm -r $queue break case e edit $EDITOR $queue @@ -43,24 +23,49 @@ function ytmpv -d 'A script to help queue youtube videos on MPV' functions ytmpv case l list cat $queue - case p play - tmux attach -t ytmpv - tmux new-session -s ytmpv -- mpv --save-position-on-quit --playlist=$queue - break - case pdl play-downloads - tmux attach -t ytmpv - tmux new-session -s ytmpv -- mpv --save-position-on-quit $downloads - break case q quit return + case p play + tmux attach -t ytmpv + tmux new-session -s ytmpv -- \ + mpv \ + --ytdl \ + --save-position-on-quit \ + --playlist=$queue + break + case pl play-login + read -P 'username> ' -l username + read -P 'password> ' -s -l password + + tmux attach -t ytmpv + tmux new-session -s ytmpv -- \ + mpv \ + --ytdl \ + --ytdl-raw-options=username=$username,password=$password \ + --save-position-on-quit \ + --playlist=$queue + + break + case s stream + tmux attach -t ytmpv + tmux new-session -s ytmpv -- \ + streamlink \ + --player mpv \ + (cat $queue) \ + best + break case '*' if test -z "$video" tmux attach -t ytmpv - tmux new-session -s ytmpv -- mpv --save-position-on-quit --playlist=$queue + tmux new-session -s ytmpv -- \ + mpv \ + --ytdl \ + --save-position-on-quit \ + --playlist=$queue break end - string split ' ' $video >> $queue + string split ' ' $video >>$queue end end diff --git a/scripts/redisco b/scripts/redisco index e3271ce..5a72a59 100755 --- a/scripts/redisco +++ b/scripts/redisco @@ -1,2 +1,2 @@ #!/usr/bin/env fish -redisco +kitty fish -c "redisco $argv"