From 290e2313c119bd4a1dd8ff8f18d23eb98aa8580c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Cezar=20Mois=C3=A9s?= Date: Mon, 26 Aug 2024 01:55:09 +0000 Subject: Upload files to ".config/cmus/cover-art" --- .config/cmus/cover-art/README.md | 49 ++++++++++++++++++++++++++++++++++++++ .config/cmus/cover-art/demo.gif | Bin 0 -> 1085543 bytes .config/cmus/cover-art/display.sh | 30 +++++++++++++++++++++++ .config/cmus/cover-art/install.sh | 7 ++++++ .config/cmus/cover-art/observe.sh | 20 ++++++++++++++++ 5 files changed, 106 insertions(+) create mode 100644 .config/cmus/cover-art/README.md create mode 100644 .config/cmus/cover-art/demo.gif create mode 100644 .config/cmus/cover-art/display.sh create mode 100644 .config/cmus/cover-art/install.sh create mode 100644 .config/cmus/cover-art/observe.sh 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="" + ``` + +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 new file mode 100644 index 0000000..f44c41e Binary files /dev/null and b/.config/cmus/cover-art/demo.gif differ 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 + -- cgit v1.2.3