Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #USAGE:
- #
- # basename $directory $install_dir
- #
- # where $directory is the directory full of mp3s to sort (does not recurse)
- # and basename is w/e the hell you named the file
- # and $install_dir is the directory you wanna put em in
- sortdir="$2"
- for M in $1/*.mp3
- do
- TITLE="`id3tool "$M" | grep '^Song Title:' | awk '{ for (i=3;i<=NF;i++) { printf $i; printf " " } }'`"
- ARTIST="`id3tool "$M" | grep '^Artist:' | awk '{ for (i=2;i<=NF;i++) { printf $i; printf " " } }'`"
- ALBUM="`id3tool "$M" | grep '^Album:' | awk '{ for (i=2;i<=NF;i++) { printf $i; printf " " } }'`"
- YEAR="`id3tool "$M" | grep '^Year:' | awk '{ for (i=2;i<=NF;i++) { printf $i; printf " " } }'`"
- TRACKNUM="`id3tool "$M" | grep '^Year:' | awk '{ print $2 }'`"
- if [ ! -d "$sortdir" ];then
- mkdir -p $sortdir/$ARTIST
- fi
- echo "Sorting $M to $sortdir/$ARTIST"
- install -D "$M" /music/"$ARTIST"/"$ARTIST-$TITLE".mp3
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement