aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xapply_album_art.sh19
-rw-r--r--main.py2
2 files changed, 15 insertions, 6 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"
diff --git a/main.py b/main.py
index cb3eaae..714f61b 100644
--- a/main.py
+++ b/main.py
@@ -10,7 +10,7 @@ import syncedlyrics
from mutagen.flac import FLAC
import ffmpeg
-_lyrics_semaphore = threading.Semaphore(1)
+_lyrics_semaphore = threading.Semaphore(3)
def iter_files(base: Path) -> Iterator[Path]:
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage