[gen_cover] Rewrote for use by cmd_import_tracks

[gen_small_cover] Added to take care of thumbnail version of cover
This commit is contained in:
ayakael 2018-05-18 19:32:33 -07:00
parent ade92f7db1
commit 202300b9fa
No known key found for this signature in database
GPG key ID: 575626A4AE5F4026
2 changed files with 22 additions and 1 deletions

View file

@ -12,7 +12,7 @@
gen_cover() {
local FOLDER="${1}"
[[ -f "${FOLDER}/folder.jpg" ]] && convert "${FOLDER}/folder.jpg" "${FOLDER}/folder.png" || { convert -size 480x480 xc:white "${FOLDER}/folder.png"; local ERROR=1; }
[[ -f "${FOLDER}/folder.png" ]] || { convert -size 480x480 xc:white "${FOLDER}/folder.png"; local ERROR=1; }
cat "${FOLDER}/folder.png"
[[ ${ERROR} -eq 1 ]] && return 1
local IMG_SIZE="$(identify -format "%wx%h" "${FOLDER}/folder.jpg")"

21
src/gen_small_cover Normal file
View file

@ -0,0 +1,21 @@
#!/bin/bash
# doc gen_cover {
#
# DESCRIPTION
# gen_small_cover - Generate small version of cover image
#
# USAGE
# gen_small_cover </path/to/image>
#
# }
gen_cover() {
local FOLDER"${1}"
convert ${FOLDER}/folder.png -resize 480x480^ -gravity center ${FOLDER}/folder.jpg
local EXIT=$?
cat "${FOLDER}/folder.jpg"
[[ ${EXIT} -ne 0 ]] && return 1
return 0
}