startmpv script to start youtube-mix playlists reliably
This commit is contained in:
parent
9758909ae7
commit
7418258fa1
@ -11,11 +11,11 @@ settings:
|
||||
normal:
|
||||
',C': spawn -d st castyt {url}
|
||||
',S': spawn -d mpvallvids {url}
|
||||
',V': spawn -d mpv {url}
|
||||
',V': spawn -d startmpv {url}
|
||||
',X': spawn -d dmenuhandler {url}
|
||||
',c': hint links spawn -d st castyt {hint-url}
|
||||
',s': hint links spawn -d mpvallvids {hint-url}
|
||||
',v': hint links spawn -d mpv {hint-url}
|
||||
',v': hint links spawn -d startmpv {hint-url}
|
||||
',x': hint links spawn -d dmenuhandler {hint-url}
|
||||
content.desktop_capture:
|
||||
global: ask
|
||||
|
12
.local/bin/tools/startmpv
Executable file
12
.local/bin/tools/startmpv
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/zsh
|
||||
js_plalist_index_loc="/home/alex/src/youtube-playlist-video-ids"
|
||||
API_key="$(pass show 'Misc/Youtube Data API v3')"
|
||||
if echo "$1" | grep -qE 'youtube.*list'; then
|
||||
echo "$1"
|
||||
playlist_id="$( echo "$1" | perl -pe "s|^.*?(\?\|&)list=(.*?)|\2|; s|&index=[0-9]+||" )"
|
||||
echo PL_id:$playlist_id
|
||||
notify-send "startmpv" "Searching for all videos in playlist..."
|
||||
npm start --prefix "$js_plalist_index_loc" -- --api-key "$API_key" --playlist-id $playlist_id | xargs -L1 echo 'https://www.youtube.com/watch?v=' | sed 's/ //' | xargs mpv || notify-send "startmpv" "An error has occured with playlist $playlist_id"
|
||||
else
|
||||
mpv "$1"
|
||||
fi
|
Loading…
Reference in New Issue
Block a user