aboutsummaryrefslogtreecommitdiffstats
path: root/apply_album_art.sh
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2026-04-25 20:12:45 -0700
committerPinapelz <yukais@pinapelz.com>2026-04-25 20:12:45 -0700
commit5a38f9d8fd9253e6f7a1e2ba51cf8d124eee052e (patch)
tree5b110ba02d056809fb166401c12c76e460a8f20e /apply_album_art.sh
parent7ca095889d0753cca52bbc169f811dd153850960 (diff)
tag image with correct mimetype
Diffstat (limited to 'apply_album_art.sh')
-rwxr-xr-xapply_album_art.sh19
1 files changed, 14 insertions, 5 deletions
diff --git a/apply_album_art.sh b/apply_album_art.sh
index eb13ce6..8ee6d51 100755
--- a/apply_album_art.sh
+++ b/apply_album_art.sh
@@ -21,17 +21,26 @@ find "$input_dir" -type d | while read -r dir; do
[[ -z "$image" ]] && continue
echo "Processing folder: $dir"
echo "Using image: $image"
- temp_cover="$(mktemp --suffix=.jpg)"
+
+ ext_lower="${image##*.}"
+ ext_lower="${ext_lower,,}"
+ if [[ "$ext_lower" == "png" ]]; then
+ mimetype="image/png"
+ suffix=".png"
+ else
+ mimetype="image/jpeg"
+ suffix=".jpg"
+ fi
+
+ temp_cover="$(mktemp --suffix=${suffix})"
ffmpeg -y -i "$image" \
-vf "scale=500:500:force_original_aspect_ratio=decrease,pad=500:500:(ow-iw)/2:(oh-ih)/2" \
"$temp_cover" >/dev/null 2>&1
find "$dir" -maxdepth 1 -type f -iname "*.flac" | while read -r flac; do
echo "Tagging: $flac"
- metaflac \
- --remove-tag=METADATA_BLOCK_PICTURE \
- --import-picture-from="$temp_cover" \
- "$flac"
+ metaflac --remove --block-type=PICTURE "$flac"
+ metaflac --import-picture-from="3|${mimetype}|||$temp_cover" "$flac"
done
rm -f "$temp_cover"
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage