From e7d59e49793442481705f0a8bb1d24ccea30eb8f Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Thu, 14 Feb 2019 08:11:39 +0100 Subject: Music mode now plays videoclip if it exists. --- musicMode.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'musicMode.sh') diff --git a/musicMode.sh b/musicMode.sh index e634aee..574a58d 100755 --- a/musicMode.sh +++ b/musicMode.sh @@ -1,7 +1,7 @@ #!/bin/sh [ "$(pgrep -x musicMode.sh)" != "$$" ] && notify-send -t 3000 "Already running! Exiting this new instance." && exit 0 #Check if already running -[ -z "$(pgrep -x cmus)" ] && notify-send -t 3000 "cmus not running: No music mode." && exit 0 #Check that cmus is running +[ -z "$(pgrep -x cmus)" ] && notify-send -t 3000 "cmus not running. Open it first." && exit 0 #Check that cmus is running mkdir /tmp/musicMode coverPath="/tmp/musicMode/cover.jpg" @@ -22,6 +22,17 @@ do notify-send -h string:x-canonical-private-synchronous:musicMode -t 0 "$(~/scripts/i3blocks/i3music.sh)" ffmpeg -i "$file" $coverPath >/dev/null feh --no-fehbg --bg-max $coverPath >/dev/null - sleep 1 + videoFile="$(ls -d ~/videos/music/* | grep "$title")" + if [ "$videoFile" ]; then # videoclip found + cmus-remote -u + mpv --fs "$videoFile" + while [ "$(pgrep -x mpv)" ] + do + sleep 1 + done + cmus-remote -n + fi fi + [ -z "$(pgrep -x cmus)" ] && notify-send "Cmus closed." && closeMusicMode.sh + sleep 1 done -- cgit v1.2.1