diff options
Diffstat (limited to '.config/cmus/cover-art')
-rw-r--r-- | .config/cmus/cover-art/README.md | 49 | ||||
-rw-r--r-- | .config/cmus/cover-art/demo.gif | bin | 0 -> 1085543 bytes | |||
-rw-r--r-- | .config/cmus/cover-art/display.sh | 30 | ||||
-rw-r--r-- | .config/cmus/cover-art/install.sh | 7 | ||||
-rw-r--r-- | .config/cmus/cover-art/observe.sh | 20 |
5 files changed, 106 insertions, 0 deletions
diff --git a/.config/cmus/cover-art/README.md b/.config/cmus/cover-art/README.md new file mode 100644 index 0000000..d8d264b --- /dev/null +++ b/.config/cmus/cover-art/README.md @@ -0,0 +1,49 @@ +# cmus-cover-art + +Experimental [Cmus](https://github.com/cmus/cmus) plugin for displaying cover arts + +> **📝 NOTE:** Only works with image view supported terminals + +## Demo + +![alt text](https://raw.githubusercontent.com/nogizhopaboroda/cmus-cover-art/master/demo.gif "Demo") + +## Dependencies + +- `ffmpeg` + +### macOS + +- iTerm2 (3.x+) + +### Linux + +- [info](http://askubuntu.com/questions/97542/how-do-i-make-my-terminal-display-graphical-pictures) + +## Installation + +1. Go to cmus home directory (`~/.cmus` or `~/.config/cmus`) +1. Clone repository + + ```shell script + git clone https://github.com/nogizhopaboroda/cmus-cover-art.git + cd cmus-cover-art + ``` + +1. _(macOS only)_ Install plugin here using installation script + + ```shell script + sh install.sh + ``` + +1. Set your image viewer in `display.sh` + + ```shell script + IMAGE_VIEWER="<your-image-viewer>" + ``` + +1. Set `observe.sh` as `status_display_program` + - [example](https://github.com/cmus/cmus/wiki/status-display-programs#usage--installation) + +1. Run `display.sh` + diff --git a/.config/cmus/cover-art/demo.gif b/.config/cmus/cover-art/demo.gif Binary files differnew file mode 100644 index 0000000..f44c41e --- /dev/null +++ b/.config/cmus/cover-art/demo.gif diff --git a/.config/cmus/cover-art/display.sh b/.config/cmus/cover-art/display.sh new file mode 100644 index 0000000..739ff07 --- /dev/null +++ b/.config/cmus/cover-art/display.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +CURRENT_DIR=`dirname "$BASH_SOURCE"` +COVERS_DIR="$CURRENT_DIR/.cover" + +PREVIOUS="" +CURRENT="" + +IMAGE_VIEWER="$CURRENT_DIR/imagemagick" + +clear +while (true) +do + CURRENT=$(ls ${COVERS_DIR}) + if [ "$CURRENT" != "$PREVIOUS" ] + then + pkill -TERM -P $$ + clear + if [ "$CURRENT" != "" ] + then + PREVIOUS=$CURRENT + $IMAGE_VIEWER $COVERS_DIR/$CURRENT & + else + echo "::: NO COVER ART :::" + PREVIOUS="" + fi + fi + sleep 1 +done + diff --git a/.config/cmus/cover-art/install.sh b/.config/cmus/cover-art/install.sh new file mode 100644 index 0000000..87bbf26 --- /dev/null +++ b/.config/cmus/cover-art/install.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +curl https://iterm2.com/utilities/imgcat > imgcat +chmod 777 imgcat +mkdir .cover +echo "cover art plugin installed successfuly" + diff --git a/.config/cmus/cover-art/observe.sh b/.config/cmus/cover-art/observe.sh new file mode 100644 index 0000000..5777f6c --- /dev/null +++ b/.config/cmus/cover-art/observe.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +CURRENT_DIR=`dirname "$BASH_SOURCE"` +COVERS_DIR="$CURRENT_DIR/.cover" + +status=$2 +file_path=$(echo "$@" | grep -o "file .*\...." | sed s/file\ //) +timestamp=`date +%s` + +rm $COVERS_DIR/* +if [ $status == "playing" ] +then + ffmpeg -i "${file_path}" -an -vcodec copy $COVERS_DIR/${timestamp}.jpg + if [ ! -f "$COVERS_DIR/${timestamp}.jpg" ] + then + file_dir=$(dirname "${file_path}") + cp "${file_dir}/cover.jpg" $COVERS_DIR/${timestamp}.jpg || cp "${file_dir}/folder.jpg" $COVERS_DIR/${timestamp}.jpg + fi +fi + |