Compare commits

..

No commits in common. "e91462b3d9c8e63673aaba85b050512fc047d484" and "c44911e6a4566b33c2a9d666273418d4d42e2e44" have entirely different histories.

View file

@ -1,8 +1,7 @@
#!/usr/bin/bash #!/usr/bin/bash
# This script helped me download back my own albums from deab.bandcamp.com # This script helped me download back my own albums from deab.bandcamp.com
# # 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... # WATCHOUT for bash version because the -v (to variable) option in printf is a newish thing at the time of writing...
@ -11,27 +10,15 @@ files="$1*.mp3"
for f in $files; for f in $files;
do do
# collects metadata from json file
track=$(jq ".track" "${f%.*}.info.json" | tr -d '"'); track=$(jq ".track" "${f%.*}.info.json" | tr -d '"');
track_number=$(jq ".track_number" "${f%.*}.info.json" | tr -d '"'); track_number=$(jq ".track_number" "${f%.*}.info.json" | tr -d '"');
n_entries=$(jq ".n_entries" "${f%.*}.info.json" | tr -d '"'); n_entries=$(jq ".n_entries" "${f%.*}.info.json" | tr -d '"');
artist=$(jq ".artist" "${f%.*}.info.json" | tr -d '"'); artist=$(jq ".artist" "${f%.*}.info.json" | tr -d '"');
album=$(jq ".album" "${f%.*}.info.json" | tr -d '"'); album=$(jq ".album" "${f%.*}.info.json" | tr -d '"');
year=$(jq ".release_year" "${f%.*}.info.json" | tr -d '"');
cover="${f%.*}.jpg"; cover="${f%.*}.jpg";
# updates the ID3 tags on the mp3 file eyeD3 -N "$n_entries" -n "$track_number" --title "$track" --album "$album" --artist "$artist" --add-image "$cover":FRONT_COVER: "$f"
eyeD3 --title "$track" \ printf -v file_name '%02d - %s.mp3' "$track_number" "$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
new_name=$(printf '%02d - %s.mp3' "$track_number" "$track")
mkdir -p "$artist" mkdir -p "$artist"
mkdir -p "$artist/$album" mkdir -p "$artist/$album"
mv "$f" "$artist/$album/$file_name" mv "$f" "$artist/$album/$file_name"