From 92fe141508a960baf38aae2e3d51d991d11f5983 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Thu, 13 Mar 2025 05:38:45 -0700 Subject: [PATCH] Began working on a more full version which will handle the complete process of organizing new music into a library. --- refactor_music_library.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 refactor_music_library.sh diff --git a/refactor_music_library.sh b/refactor_music_library.sh new file mode 100644 index 0000000..21dc045 --- /dev/null +++ b/refactor_music_library.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# 2025 Hyperling +# Clean up a music library. + +# Steps: +# 0) Ensure an OLD folder exists, it is what will be refactored. +# 1) Convert all non-mp3 files to mp3 and put them in an INTERIM folder. +# 2) Loop over all OLD and INTERIM's mp3 files and move them to NEW based on data. +# - Name the file as "${ZERO_LED_TRACK_NUMBER}. ${SONG_TITLE} +# - Name parent folder as "${YEAR} - ${ALBUM}" if both exist, otherwise just one or the other "${YEAR}${ALBUM}". +# - Name grandparent folder as "${ARTIST} - ${GENRE}" if both exist, otherwise "${ARTIST}${GENRE}". + +# TODO List +# - Organize tracks by Artist + Album folders. +# - Name parent folder as "$YEAR - $ALBUM" if both exist, otherwise just one or the other. +# - Name grandparent folder as ARTIST if it exists, otherwise GENRE. + +# If we are in OLD, go up one level. +if [[ "`pwd`"== */OLD ]]; then + cd .. +fi + +if [[ ! -d OLD ]]; then + echo "ERROR: Could not find a folder named 'OLD', please create it and add your library there." +fi + + +echo "Convert m4a's to mp3's." +ls *.m4a | while read m4a; do ffmpeg -nostdin -hide_banner -loglevel quiet -i "$m4a" "$m4a".mp3; done