From b900166ae7bb0f503bce482b81e47b254f4bee96 Mon Sep 17 00:00:00 2001 From: diegantobass Date: Tue, 24 Jun 2025 09:11:11 +0200 Subject: [PATCH] unraid ready version --- bandcamp_format_utility.sh | 43 +++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/bandcamp_format_utility.sh b/bandcamp_format_utility.sh index 6a4dd44..c39b341 100755 --- a/bandcamp_format_utility.sh +++ b/bandcamp_format_utility.sh @@ -1,13 +1,17 @@ -#!/usr/bin/bash +#!/bin/bash -# This script helped me download back my own albums from deab.bandcamp.com from my unraid server +# 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 # 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 -for d in /mnt/user/downloads/youtube-dl/audio/*/; +for d in "/mnt/user/downloads/youtube-dl/audio/*/"; do echo "Processing " "$d" + echo "..." + + files="$d*.mp3" + for f in $files; do # collects metadata from json file @@ -19,25 +23,26 @@ for d in /mnt/user/downloads/youtube-dl/audio/*/; year=$(jq ".release_year" "${f%.*}.info.json" | tr -d '"'); cover="${f%.*}.jpg"; - echo "$track" "$artist" - # updates the ID3 tags on the mp3 file - # eyeD3 --title "$track" \ - # --track "$track_number" \ - # --track-total "$n_entries" \ - # --artist "$artist" \ - # --album "$album" \ - # --release-year "$year" \ - # --add-image "$cover":FRONT_COVER: \ - # "$f"; + eyeD3 --title "$track" \ + --track "$track_number" \ + --track-total "$n_entries" \ + --artist "$artist" \ + --album "$album" \ + --release-year "$year" \ + --add-image "$cover":FRONT_COVER: \ + "$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"); - mkdir -p "$artist"; - mkdir -p "$artist/$album"; - # mv "$f" "$artist/$album/$new_name"; - echo "$new_name" + mkdir -p "/mnt/user/music/nettoyage/youtubedl/$artist"; + mkdir -p "/mnt/user/music/nettoyage/youtubedl/$artist/$album"; + mv "$f" "/mnt/user/music/nettoyage/youtubedl/$artist/$album/$new_name"; done + # removes the original folder - # rm -R "$d" + rm -R "$d" + + echo "Done with" "$d" + echo "---" done