aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2019-02-14 08:11:39 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2019-02-14 15:51:01 +0100
commite7d59e49793442481705f0a8bb1d24ccea30eb8f (patch)
treecbc650c499701205fcca338414f45971be7bc80b
parentb4f6c2e0a01059345ef73a76a49240cbbdb6d257 (diff)
downloadscripts-e7d59e49793442481705f0a8bb1d24ccea30eb8f.tar.gz
scripts-e7d59e49793442481705f0a8bb1d24ccea30eb8f.zip
Music mode now plays videoclip if it exists.
-rwxr-xr-xcloseMusicMode.sh2
-rwxr-xr-xmusicMode.sh15
2 files changed, 14 insertions, 3 deletions
diff --git a/closeMusicMode.sh b/closeMusicMode.sh
index 620f667..a07cf00 100755
--- a/closeMusicMode.sh
+++ b/closeMusicMode.sh
@@ -1,5 +1,5 @@
#!/bin/sh
kill $(pgrep -x musicMode.sh) # End the music mode process
i3-msg "bar mode dock" # Restore the i3bar
-exec feh --bg-fill ~/images/wallpapers/bg* # Restore default wallpaper
+exec feh --bg-max ~/images/wallpapers/bg* # Restore default wallpaper
notify-send -h string:x-canonical-private-synchronous:musicMode -t 1000 "Closed music mode."
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