Skip to content

Instantly share code, notes, and snippets.

@flavio
Created April 23, 2012 09:45
Show Gist options
  • Save flavio/2469919 to your computer and use it in GitHub Desktop.
Save flavio/2469919 to your computer and use it in GitHub Desktop.
id3 multiple edit
#!/bin/bash
counter=0
if [ -n "$1" ]; then
if [[ $1 = "help" ]]; then
echo syntax: id3medit artist album year\(*\) genre\(*\)
echo *=optional
exit 0
else
artist=$1
fi
else
echo syntax: id3medit artist album year\(*\) genre\(*\)
echo *=optional
exit 0
fi
if [ -n "$2" ]; then
album=$2
fi
if [ -n "$3" ]; then
year=$3
else
year=0000
fi
if [ -n "$4" ]; then
genre=$4
else
genre=255
fi
for file in *.{[Mm][Pp]3,[Oo][Gg][Gg]}
#for file in *.[Mm][Pp]3
do
echo \-\-\> Processing file: $file
id3v2 -D "$file" #we delete old tags
temp=`echo ${file#**-}`
#temp=`echo ${temp:2}`
title=`echo ${temp%.*3}`
id3v2 -t "$title" -T $counter -a "$artist" -A "$album" -y $year -g $genre "$file"
let 'counter +=1'
done
let 'counter -=1'
echo Work done!
echo Converted $counter files,
echo "See you... ;-D"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment