dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 56c1c0d823f4854cc94442c81e132e6f2731b3ff
parent af6fdc6990a2d2c87ba5fbcf58b1981fd3b6c05e
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Thu, 10 Sep 2020 14:50:05 +0200

mpvq: allow multiple input arguments at once

Former-commit-id: 5f72b45b0a94e6aa7ee9561cb861b82350c0750c
Diffstat:
Mscripts/mpvq | 26+++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/scripts/mpvq b/scripts/mpvq @@ -1,19 +1,27 @@ #!/bin/bash -if [[ ! -p $HOME/.cache/mpv/input ]]; then - mkfifo $HOME/.cache/mpv/input +if [[ ! -p "$HOME"/.cache/mpv/input ]]; then + mkfifo "$HOME"/.cache/mpv/input fi -if pgrep -f MPV-Q > /dev/null; then - printf "%s\n" "loadfile \"$1\" append-play" > $HOME/.cache/mpv/input + +# queue the video +play() { + if pgrep -f MPV-Q > /dev/null; then + printf "%s\n" "loadfile \"$1\" append-play" > "$HOME"/.cache/mpv/input terminal-notifier -title "Video queued" -message "Added to queue successfully" -group "mpv" &>/dev/null -else + else terminal-notifier -title "Playing video" -message "MPV is launching..." -group "mpv" &>/dev/null - mpv --idle=yes --volume=50 --no-terminal --x11-name=MPV-Q --input-file=$HOME/.cache/mpv/input --player-operation-mode=pseudo-gui "$1" & -fi + mpv --idle=yes --volume=50 --no-terminal --x11-name=MPV-Q --input-file="$HOME"/.cache/mpv/input --player-operation-mode=pseudo-gui "$1" & + fi +} -#link archive +# link archive arc(){ title=$(youtube-dl --ignore-config --get-title "$1" 2>/dev/null) printf "%b\n" "$title\t$1" >> "$HOME/.cache/mpv/linkarchive" } -arc "$1" & + +for l in "$@"; do + play "$l" + arc "$1" & +done exit 0