Compare commits

..

3 commits

Author SHA1 Message Date
diegantobass
b900166ae7 unraid ready version 2025-06-24 09:11:11 +02:00
diegantobass
5dc924f6b3 adapts to the unraid env 2025-06-24 09:07:06 +02:00
diegantobass
86ecc7278d remove mentions of printf -v in comments 2025-06-24 08:53:13 +02:00

View file

@ -1,15 +1,18 @@
#!/usr/bin/bash #!/bin/bash
# This script helped me download back my own albums from deab.bandcamp.com # This script helps me download back my own albums from deab.bandcamp.com from my unraid server
# #
# It takes the first positional argument : a folder with youtube-dl downloaded audio-only tracks from bandcamp with their associated pictures and json metadata # It takes the first positional argument : a folder with youtube-dl downloaded audio-only tracks from bandcamp with their associated pictures and json metadata
# And it parses the json to extract track name and number, album name, cover and number of tracks, and uses eyeD3 to updates the ID3 tags, rename and move the files # And it parses the json to extract track name and number, album name, cover and number of tracks, and uses eyeD3 to updates the ID3 tags, rename and move the files
#
# WATCHOUT for bash version because the -v (to variable) option in printf is a newish thing at the time of writing...
files="$1*.mp3" for d in "/mnt/user/downloads/youtube-dl/audio/*/";
do
echo "Processing " "$d"
echo "..."
for f in $files; files="$d*.mp3"
for f in $files;
do do
# collects metadata from json file # collects metadata from json file
track=$(jq ".track" "${f%.*}.info.json" | tr -d '"'); track=$(jq ".track" "${f%.*}.info.json" | tr -d '"');
@ -28,14 +31,18 @@ for f in $files;
--album "$album" \ --album "$album" \
--release-year "$year" \ --release-year "$year" \
--add-image "$cover":FRONT_COVER: \ --add-image "$cover":FRONT_COVER: \
"$f" "$f";
# moves the files to a correct name into an artist/album/ folder # moves the files into an path/to/music/folder/artist/album/
new_name=$(printf '%02d - %s.mp3' "$track_number" "$track") new_name=$(printf '%02d - %s.mp3' "$track_number" "$track");
mkdir -p "$artist" mkdir -p "/mnt/user/music/nettoyage/youtubedl/$artist";
mkdir -p "$artist/$album" mkdir -p "/mnt/user/music/nettoyage/youtubedl/$artist/$album";
mv "$f" "$artist/$album/$new_name" mv "$f" "/mnt/user/music/nettoyage/youtubedl/$artist/$album/$new_name";
done done
# removes the original folder asking confirmation # removes the original folder
rm -R "$1" rm -R "$d"
echo "Done with" "$d"
echo "---"
done