Cerca nel blog

lunedì 16 aprile 2012

Inserire tag negli mp3

Ecco qui' uno script che inserisce i tag negli mp3 secondo il sistema cartella autore cartella album,
basta inserirlo nella cartella principale dove sono contenute le directory degli albun e lanciarlo

NB script linux bash  necessita del pacchetto id3v2

 #! /bin/bash
#echo "scriptino lanciare con ./  v1.0"
# necessita del pacchetto id3v2
IFS=""
find | while read e
do

if echo "$e" | grep  ".mp3"
then

export lu=$(echo ${#e})

let lu2=$lu

while echo ${e:$lu2:1} | grep -v "/"
do
let lu2=$lu2-1
done


export nome=$(echo ${e:($lu2+1):($lu-$lu2-5)})
echo "nome       $nome"

if [ $lu2 -eq 1 ]
then

album="vari"
artista="musica"

id3v2 -as $e
id3v2 -a $artista -A $album -t $nome $e



else

let lu3=$lu2
while echo ${e:($lu3-1):1} | grep -v "/"
do
let lu3=$lu3-1
done


export album=$(echo ${e:($lu3):($lu2-$lu3)})
echo "$e"
echo "album   $album"

echo "slu3   $lu3"
if [ $lu3 -eq 2 ]
then

#album="vari"
artista="musica"
echo "artista   $artista"

id3v2 -as $e
id3v2 -a $artista -A $album -t $nome $e

else
echo "eseguo qui"

let lu4=$lu3
while echo ${e:($lu4-2):1} | grep -v "/"
do
let lu4=$lu4-1
done

export artista=$(echo ${e:($lu4-1):($lu3-$lu4)})


echo "scrivo qui"

id3v2 -as $e
id3v2 -a $artista -A $album -t $nome $e


fi
fi
fi
done

Nessun commento:

Posta un commento