summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlshprung <lshprung@yahoo.com>2020-07-31 14:37:38 -0700
committerlshprung <lshprung@yahoo.com>2020-07-31 14:37:38 -0700
commit3920bbc24739d993863de93ac781bfb2b2626706 (patch)
tree5358b145f80b4f87e7868574543bd50032d2ede2
First CommitHEADmaster
-rw-r--r--README.md6
-rwxr-xr-xshow_album_art.sh22
2 files changed, 28 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..00730c5
--- /dev/null
+++ b/README.md
@@ -0,0 +1,6 @@
+show_album_art.sh is a simple bash script that uses ffmpeg and sxiv to open the embedded album art of an audio file currently playing in MOC in a separate window
+
+### Usage
+
+1. Open mocp and hit play
+2. run `show_album_art.sh`
diff --git a/show_album_art.sh b/show_album_art.sh
new file mode 100755
index 0000000..3fa04f3
--- /dev/null
+++ b/show_album_art.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+SONG="$(mocp -i | head -n 2 | tail -n 1 | cut -c 7-)"
+RUN=0
+echo $RUN
+if [ -z "$SONG" ] || [ ! -e "$SONG" ]; then
+ echo "mocp is not currently running or is stopped"
+ exit
+fi
+ffmpeg -y -i "$SONG" /tmp/now_playing.jpg
+sxiv -b -s f /tmp/now_playing.jpg &
+PID=$(echo $!)
+
+while [[ "$RUN" == "0" ]]; do
+ if [[ $SONG != "$(mocp -i | head -n 2 | tail -n 1 | cut -c 7-)" ]]; then
+ SONG="$(mocp -i | head -n 2 | tail -n 1 | cut -c 7-)"
+ ffmpeg -y -i "$SONG" /tmp/now_playing.jpg &
+ fi
+ sleep 1
+ RUN=$(ps --pid $PID; echo $?)
+ RUN=$(echo $RUN | rev | cut -c 1)
+done