diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2019-02-14 08:11:39 +0100 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2019-02-14 15:51:01 +0100 |
commit | e7d59e49793442481705f0a8bb1d24ccea30eb8f (patch) | |
tree | cbc650c499701205fcca338414f45971be7bc80b /musicMode.sh | |
parent | b4f6c2e0a01059345ef73a76a49240cbbdb6d257 (diff) | |
download | scripts-e7d59e49793442481705f0a8bb1d24ccea30eb8f.tar.gz scripts-e7d59e49793442481705f0a8bb1d24ccea30eb8f.zip |
Music mode now plays videoclip if it exists.
Diffstat (limited to 'musicMode.sh')
-rwxr-xr-x | musicMode.sh | 15 |
1 files changed, 13 insertions, 2 deletions
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 |