Removed commit history
Signed-off-by: Marko Korhonen <marko.korhonen@reekynet.com>
This commit is contained in:
commit
b1335a3628
199 changed files with 36930 additions and 0 deletions
33
home/Scripts/mpvqueue
Executable file
33
home/Scripts/mpvqueue
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
MPVPIPE=/tmp/mpvqueue.playlist
|
||||
|
||||
notify="notify-send -i mpv -a mpv"
|
||||
|
||||
# if link is a youtube playlist, open recursively
|
||||
if [[ ${1} =~ (^.*(youtu.be\/|list=)([^#\&\?]*).*) ]]; then
|
||||
$notify "Adding playlist ${@}"
|
||||
/usr/local/bin/mpvqueue $(youtube-dl -j --flat-playlist "${1}" | jq -r '.id' | sed 's_^_https://youtube.com/watch?v=_')
|
||||
exit
|
||||
fi
|
||||
|
||||
# See if MPV is already running
|
||||
if [ -z "$(pidof mpv)" ]; then
|
||||
# mpv is not running
|
||||
# remove fifo
|
||||
rm -f $MPVPIPE && mkfifo $MPVPIPE
|
||||
|
||||
# start mpv
|
||||
/usr/bin/mpv --no-terminal --input-file="${MPVPIPE}" "${@}" & disown
|
||||
|
||||
# Wait for mpv to be up before moving on to adding anything else to playlist
|
||||
while [ -z "$(pidof mpv)" ]; do
|
||||
sleep 1
|
||||
done
|
||||
$notify "Playing ${@}"
|
||||
|
||||
else
|
||||
# mpv is running, so add stuff to playlist
|
||||
$notify "Adding ${@}"
|
||||
echo "loadfile \"${@}\" append-play" >> "${MPVPIPE}"
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue