add cover extractor script for gonic
This commit is contained in:
parent
5121984965
commit
8485ae9a21
1 changed files with 21 additions and 0 deletions
21
extract_cover.sh
Executable file
21
extract_cover.sh
Executable file
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Durchlaufe alle Verzeichnisse
|
||||||
|
for dir in */; do
|
||||||
|
# Gehe ins Verzeichnis
|
||||||
|
cd "$dir" || continue
|
||||||
|
|
||||||
|
# Finde die erste Musikdatei (sortiert nach Name)
|
||||||
|
first_music_file=$(find . -maxdepth 1 -type f \( -name "*.mp3" -o -name "*.flac" -o -name "*.m4a" -o -name "*.opus" \) | sort | head -n 1)
|
||||||
|
|
||||||
|
# Wenn eine Musikdatei gefunden wurde
|
||||||
|
if [[ -n "$first_music_file" ]]; then
|
||||||
|
# Extrahiere das Coverbild
|
||||||
|
ffmpeg -i "$first_music_file" -an -vcodec copy folder.jpg
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Gehe zurück ins Ausgangsverzeichnis
|
||||||
|
cd ..
|
||||||
|
done
|
Loading…
Reference in a new issue