diff options
author | Francesco Minnocci | 2021-01-28 15:56:06 +0100 |
---|---|---|
committer | Francesco Minnocci | 2021-01-28 15:56:06 +0100 |
commit | daf667bf0954766a3c343a84bc2f5d14312a7b26 (patch) | |
tree | 69bd1d395efc32ae57fd07535c001fd8a802877d | |
parent | d29f6d9acd249527c8b74936378ad60a2be25ff6 (diff) | |
download | aur-daf667bf0954766a3c343a84bc2f5d14312a7b26.tar.gz |
Add optional exiftool support
-rw-r--r-- | .SRCINFO | 8 | ||||
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | PKGBUILD | 27 | ||||
-rw-r--r-- | exiftool.patch | 61 |
4 files changed, 88 insertions, 9 deletions
@@ -1,7 +1,7 @@ pkgbase = kunst-git pkgdesc = kunst is a deamon that extracts the album art from the songs playing in mpd. pkgver = 20200821 - pkgrel = 1 + pkgrel = 2 url = https://github.com/sdushantha/kunst arch = any license = MIT @@ -13,9 +13,11 @@ pkgbase = kunst-git depends = mpd depends = mpc depends = jq + optdepends = perl-image-exiftool: for accurate extraction of cover images provides = kunst source = git+https://github.com/sdushantha/kunst.git - md5sums = SKIP + source = exiftool.patch + sha256sums = SKIP + sha256sums = 86b3a1bd0ad87a9cb6a5466805a55ec87b2369c654eb492a7297fdaf51c068b7 pkgname = kunst-git - diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..72e8ffc0db8a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +* @@ -3,24 +3,39 @@ pkgname=kunst-git _pkgname=kunst pkgver=20200821 -pkgrel=1 +pkgrel=2 pkgdesc="kunst is a deamon that extracts the album art from the songs playing in mpd." arch=('any') url="https://github.com/sdushantha/kunst" license=('MIT') depends=('sxiv' 'imagemagick' 'bash' 'ffmpeg' 'mpd' 'mpc' 'jq') +optdepends=('perl-image-exiftool: for accurate extraction of cover images') makedepends=('git') provides=($_pkgname) -source=("git+https://github.com/sdushantha/kunst.git") -md5sums=('SKIP') +source=( + "git+https://github.com/sdushantha/kunst.git" + exiftool.patch +) +sha256sums=( + 'SKIP' + '86b3a1bd0ad87a9cb6a5466805a55ec87b2369c654eb492a7297fdaf51c068b7' +) + +pkgver() { + cd "$srcdir/$_pkgname" -pkgver() -{ - cd $_pkgname git log -1 --format="%cd" --date=short | sed "s|-||g" } +prepare() { + cd "$srcdir/$_pkgname" + + patch -Np1 -i "$srcdir/exiftool.patch" +} + package() { cd "$srcdir/$_pkgname" install -D -t "$pkgdir/usr/bin" "$_pkgname" + install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" } +# vim:set ts=2 sw=2 et: diff --git a/exiftool.patch b/exiftool.patch new file mode 100644 index 000000000000..24ac55ec1cdf --- /dev/null +++ b/exiftool.patch @@ -0,0 +1,61 @@ +--- kunst/kunst 2021-01-28 15:37:59.000000000 +0100 ++++ kunst/kunst 2021-01-28 15:34:56.908337399 +0100 +@@ -8,7 +8,7 @@ + + + VERSION=1.3.2 +-COVER=/tmp/kunst.jpg ++COVER=/tmp/kunst.png + MUSIC_DIR=~/Music/ + SIZE=250x250 + POSITION="+0+0" +@@ -138,7 +138,7 @@ + + # 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 ++ ffmpeg -i "$MUSIC_DIR/$(mpc current -f %file%)" "$COVER" -y &> /dev/null + + # Get the status of the previous command + STATUS=$? +@@ -148,7 +148,7 @@ + [ ! "$SILENT" ] && echo "kunst: extracted album art" + ARTLESS=false + else +- DIR="$MUSIC_DIR$(dirname "$(mpc current -f %file%)")" ++ DIR="$MUSIC_DIR/$(dirname "$(mpc current -f %file%)")" + [ ! "$SILENT" ] && echo "kunst: inspecting $DIR" + + # Check if there is an album cover/art in the folder. +@@ -164,8 +164,19 @@ + fi + + if [ "$STATUS" -ne 0 ];then +- [ ! "$SILENT" ] && echo "error: file does not have an album art" +- get_cover_online ++ if [ "$(command -v exiftool)" ]; 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" ++ else ++ [ ! "$SILENT" ] && echo "error: file does not have an album art" ++ get_cover_online ++ fi + fi + } + +@@ -211,9 +222,6 @@ + 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 |