commit 3e95c8b2181b0bf535e92628af0d2bc696c00470 parent bb08ca39094b263793453512f692fbf9ee3910ca Author: Alex Balgavy <alex@balgavy.eu> Date: Wed, 22 Dec 2021 00:04:16 +0100 mp3-tags-to-folders: functionality now in mlm Diffstat:
D | scripts/mp3-tags-to-folders | | | 20 | -------------------- |
1 file changed, 0 insertions(+), 20 deletions(-)
diff --git a/scripts/mp3-tags-to-folders b/scripts/mp3-tags-to-folders @@ -1,20 +0,0 @@ -#!/bin/sh -# Places all MP3 files in a directory into folders based on the artist and album. -# If you want to make changes in the current dir, run `mp3-tags-to-folders . .` -die() { printf "%s\n" "$1" >&2; exit 1; } -command -v ffprobe 1>/dev/null 2>&1 || die "ffprobe not installed." -[ $# -eq 2 ] || die "Arguments required: path to music directory, path to destination" -[ -d "$1" ] || die "Path $1 is not a directory." -set -x -cd "$2" || die "Could not cd to $1" -mkdir -p _failed || die "Directory ./_failed already exists" -find "$1" -name "*.mp3" 2>/dev/null | \ - while read -r i; do - artist="$(ffprobe -loglevel error -show_entries format_tags=album_artist -of default=noprint_wrappers=1:nokey=1 "$i" | tr -d ':' | tr '!@#$%^&*:?"\\>' '_' | sed 's/\.\.*$//')" - [ -n "$artist" ] || { mv "$i" _failed/ && continue; } - album="$(ffprobe -loglevel error -show_entries format_tags=album -of default=noprint_wrappers=1:nokey=1 "$i" | tr -d ':' | tr '!@#$%^&*:?>\\"' '_' | sed 's/\.\.*$//')" - [ -n "$album" ] || { mv "$i" _failed/ && continue; } - mkdir -p "$artist/$album" - mv "$i" "$artist/$album" - done -rmdir _failed 1>/dev/null 2>&1 || printf "Some tracks were not organised automatically, they are in ./_failed/"