summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO6
-rw-r--r--PKGBUILD8
-rw-r--r--exiftool.patch202
3 files changed, 90 insertions, 126 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 04adb769930f..9e06f8898921 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = kunst-git
pkgdesc = kunst is a daemon that extracts the album art from the songs playing in mpd.
- pkgver = 20200821
- pkgrel = 4
+ pkgver = 20221018
+ pkgrel = 1
url = https://github.com/sdushantha/kunst
arch = any
license = MIT
@@ -18,6 +18,6 @@ pkgbase = kunst-git
source = git+https://github.com/sdushantha/kunst.git
source = exiftool.patch
sha512sums = SKIP
- sha512sums = 94e554c8e13bc8c9b9d12ee904545a66c3b984dc2083d5103f82746b783719c505694092f0271f4ea165e0e229184fc11e99dae96cb2f0ab9788b61567cf4f9d
+ sha512sums = d703f6cf4e51e24ae9dcfd5b1cbf9421581a45bfa8f3579b9a1a1695ed7405fec935b2e02b81206ca05157bb24b4323abf97b43adad49c86a9476ed9e2ef03ed
pkgname = kunst-git
diff --git a/PKGBUILD b/PKGBUILD
index 17f467047d48..75bfabd6cebe 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,7 +3,7 @@
pkgname=kunst-git
_pkgname=kunst
-pkgver=20210624
+pkgver=20221018
pkgrel=1
pkgdesc="kunst is a daemon that extracts the album art from the songs playing in mpd."
arch=('any')
@@ -17,10 +17,8 @@ source=(
"git+https://github.com/sdushantha/kunst.git"
exiftool.patch
)
-sha512sums=(
- 'SKIP'
- '94e554c8e13bc8c9b9d12ee904545a66c3b984dc2083d5103f82746b783719c505694092f0271f4ea165e0e229184fc11e99dae96cb2f0ab9788b61567cf4f9d'
-)
+sha512sums=('SKIP'
+ 'd703f6cf4e51e24ae9dcfd5b1cbf9421581a45bfa8f3579b9a1a1695ed7405fec935b2e02b81206ca05157bb24b4323abf97b43adad49c86a9476ed9e2ef03ed')
pkgver() {
cd "$srcdir/$_pkgname"
diff --git a/exiftool.patch b/exiftool.patch
index 8fa2f9470367..edc003317968 100644
--- a/exiftool.patch
+++ b/exiftool.patch
@@ -1,130 +1,96 @@
---- kunst/kunst 2021-02-02 12:40:50.127158706 +0100
-+++ /usr/bin/kunst 2021-02-02 12:33:26.573815292 +0100
-@@ -9,10 +9,12 @@
-
- VERSION=1.3.2
- COVER=/tmp/kunst.jpg
--MUSIC_DIR=~/Music
--SIZE=250x250
--POSITION="+0+0"
- ONLINE_ALBUM_ART=false
-+MUSIC_DIR=${KUNST_MUSIC_DIR:-"~/Music/"}
-+SIZE=${KUNST_SIZE:-"250x250"}
-+POSITION=${KUNST_POSITION:-"+0+0"}
+diff --git a/kunst b/kunst
+index 9d0a8f4..9b12827 100755
+--- a/kunst
++++ b/kunst
+@@ -12,6 +12,8 @@ COVER=/tmp/kunst.jpg
+ MUSIC_DIR="${KUNST_MUSIC_DIR:-~/Music}"
+ SIZE="${KUNST_SIZE:-250x250}"
+ POSITION="${KUNST_POSITION:-+0+0}"
+COVER_NAMES=${KUNST_COVER_NAMES:-"folder|cover|front"}
+COVER_EXT=${KUNST_COVER_EXT:-"jpg|png"}
-
- show_help() {
- printf "%s" "\
-@@ -138,33 +140,52 @@
-
- # Extract the album art from the mp3 file and dont show the messsy
- # output of ffmpeg
-- ffmpeg -i "$MUSIC_DIR$(mpc current -f %file%)" "$COVER" -y &> /dev/null
-+ if [ "$(type -p exiftool &>/dev/null)" ]; then
-+ SONG="$MUSIC_DIR/$(mpc --format "%file%" current)"
-+ PICTURE_TAG="-Picture"
+ ONLINE_ALBUM_ART=""
+ PROG_NAME=$(basename "$0")
+
+@@ -152,7 +154,23 @@ find_album_art(){
+
+ # Extract the album art from the mp3 file and dont show the messsy
+ # output of ffmpeg
+- ffmpeg -i "$MUSIC_DIR$(mpc current -f %file%)" "$COVER" -y &> /dev/null
++ if [ "$(type -p exiftool &>/dev/null)" ]; then
++ SONG="$MUSIC_DIR/$(mpc --format "%file%" current)"
++ PICTURE_TAG="-Picture"
+
-+ if [ "$SONG" = *".m4a" ]; then
-+ PICTURE_TAG="-CoverArt"
-+ fi
-+ # Extract album cover using perl-image-exiftool
-+ exiftool -b "$PICTURE_TAG" "$SONG" > "$COVER"
-+ # Check if image is valid
-+ img_data=$(identify "$COVER" 2>&1)
-+ if [ "$img_data" = *"insufficient"* ]; then
-+ return 1
-+ fi
-+ else
-+ ffmpeg -i "$MUSIC_DIR/$(mpc current -f %file%)" "$COVER" -y &> /dev/null
-+ fi
-
-- # Get the status of the previous command
-- STATUS=$?
-+ STATUS=$?
-
- # Check if the file has a embbeded album art
- if [ "$STATUS" -eq 0 ];then
-- [ ! "$SILENT" ] && echo "kunst: extracted album art"
-+ [ ! "$SILENT" ] && echo "kunst: extracted album art"
- ARTLESS=false
- else
++ if [ "$SONG" = *".m4a" ]; then
++ PICTURE_TAG="-CoverArt"
++ fi
++ # Extract album cover using perl-image-exiftool
++ exiftool -b "$PICTURE_TAG" "$SONG" > "$COVER"
++ # Check if image is valid
++ img_data=$(identify "$COVER" 2>&1)
++ if [ "$img_data" = *"insufficient"* ]; then
++ return 1
++ fi
++ else
++ ffmpeg -i "$MUSIC_DIR/$(mpc current -f %file%)" "$COVER" -y &> /dev/null
++ fi
+
+ # Get the status of the previous command
+ STATUS=$?
+@@ -162,19 +180,21 @@ find_album_art(){
+ log "extracted album art"
+ ARTLESS=false
+ else
- DIR="$MUSIC_DIR$(dirname "$(mpc current -f %file%)")"
-- [ ! "$SILENT" ] && echo "kunst: inspecting $DIR"
-+ DIR="$MUSIC_DIR/$(dirname "$(mpc current -f %file%)")"
-+
-+ # prevent iterating the entire $MUSIC_DIR if mpc experiences an error
-+ [ "$DIR" == "$MUSIC_DIR"/. ] && ARTLESS=true && return 1
-+
-+ [ ! "$SILENT" ] && echo "kunst: inspecting $DIR"
-
- # Check if there is an album cover/art in the folder.
-- # Look at issue #9 for more details
++ DIR="$MUSIC_DIR/$(dirname "$(mpc current -f %file%)")"
++ # prevent iterating the entire $MUSIC_DIR if mpc experiences an error
++ [ "$DIR" == "$MUSIC_DIR"/. ] && ARTLESS=true && return 1
+ log "inspecting $DIR"
+
+ # Check if there is an album cover/art in the folder.
+- # Look at issue #9 for more details
- for CANDIDATE in "$DIR/cover."{png,jpg}; do
-- if [ -f "$CANDIDATE" ]; then
-- STATUS=0
-- ARTLESS=false
-- convert "$CANDIDATE" $COVER &> /dev/null
-- [ ! "$SILENT" ] && echo "kunst: found cover.png"
-- fi
++ # Look at issues #9 and #45 for more details
++ while IFS= read -r CANDIDATE; do
+ if [ -f "$CANDIDATE" ]; then
+ STATUS=0
+ ARTLESS=false
+ convert "$CANDIDATE" $COVER &> /dev/null
+- log "found cover.png"
++ log "found $(basename "$CANDIDATE")"
+ fi
- done
-+ # Look at issues #9 and #45 for more details
-+ while IFS= read -r CANDIDATE; do
-+ if [ -f "$CANDIDATE" ]; then
-+ STATUS=0
-+ ARTLESS=false
-+ convert "$CANDIDATE" $COVER &> /dev/null
-+ [ ! "$SILENT" ] && echo "kunst: found $(basename "$CANDIDATE")"
-+ fi
-+ done < <(find "$DIR" -type f | grep -i -E -- "($COVER_NAMES).($COVER_EXT)")
++ done < <(find "$DIR" -type f | grep -i -E -- "($COVER_NAMES).($COVER_EXT)")
fi
-
- if [ "$STATUS" -ne 0 ];then
-- [ ! "$SILENT" ] && echo "error: file does not have an album art"
-+ [ ! "$SILENT" ] && echo "error: file does not have an album art"
- get_cover_online
- fi
- }
-@@ -200,10 +221,6 @@
- }
- done
-
-- [ "$KUNST_MUSIC_DIR" != "" ] && MUSIC_DIR="$KUNST_MUSIC_DIR"
-- [ "$KUNST_SIZE" != "" ] && SIZE="$KUNST_SIZE"
-- [ "$KUNST_POSITION" != "" ] && POSITION="$KUNST_POSITION"
--
- # Flag to run some commands only once in the loop
- FIRST_RUN=true
-
-@@ -211,12 +228,9 @@
- update_cover
-
- if [ "$ARTLESS" == true ];then
-- # Dhange the path to COVER because the music note
-- # image is a png not jpg
-- COVER=/tmp/kunst.png
-
- # Decode the base64 encoded image and save it
-- # to /tmp/kunst.png
-+ # to /tmp/kunst.jpg
- echo "$MUSIC_NOTE" | base64 --decode > "$COVER"
- fi
-
-@@ -229,8 +243,9 @@
- FIRST_RUN=false
-
- # Display the album art using sxiv
-- sxiv -g "$SIZE$POSITION" -b "$COVER" -N "Kunst" &
+
+ if [ "$STATUS" -ne 0 ];then
+@@ -220,12 +240,8 @@ main() {
+ update_cover
+
+ if [ "$ARTLESS" == true ];then
+- # Dhange the path to COVER because the music note
+- # image is a png not jpg
+- COVER=/tmp/kunst.png
-
-+ # If sxiv is closed, kill the script as well with the trap at the end of
-+ # the script (see issue #48).
-+ (sxiv -g "$SIZE$POSITION" -b "$COVER" -N "Kunst"; kill -USR1 0) &
- # Save the process ID so that we can kill
- # sxiv when the user exits the script
- echo $! >/tmp/kunst.pid
-@@ -251,4 +266,6 @@
+ # Decode the base64 encoded image and save it
+- # to /tmp/kunst.png
++ # to /tmp/kunst.jpg
+ echo "$MUSIC_NOTE" | base64 --decode > "$COVER"
+ fi
+
+@@ -235,7 +251,9 @@ main() {
+ FIRST_RUN=false
+
+ # Display the album art using sxiv
+- sxiv -g "$SIZE$POSITION" -b "$COVER" -N "Kunst" &
++ # If sxiv is closed, kill the script as well with the trap at the end of
++ # the script (see issue #48).
++ (sxiv -g "$SIZE$POSITION" -b "$COVER" -N "Kunst"; kill -USR1 0) &
+
+ # Save the process ID so that we can kill
+ # sxiv when the user exits the script
+@@ -257,4 +275,6 @@ main() {
trap "" SIGTSTP
-
+
trap pre_exit EXIT
+trap 'exit 1' TERM HUP INT
+trap 'exit 0' USR1