[x]

deviantART

 
About Me Member Deviously Deviant zen4glennMale/United States Recent Activity Deviant for 5 Years
Needs Premium Membership
Statistics 128 Deviations
1,272 Comments
4,057 Pageviews

MP3 Name conversion

Sat Nov 19, 2005, 11:21 AM
I was bored so I decided to write a script to modify my mp3 folder and file names. Anyone who has multiple albums converted to mp3 knows what a pain in the arse it can be to modify a single file at a time. If you are a Microsoft Windows user...sorry kiddies...this will take a bit of modification for it to work for you. But, it works very nicely on a *nix platform. Don't forget to chmod +x

*********************************************************************************************


#!/bin/bash
#---------------------------------------------------------------------------
# Title: mp3con
# POC: Glenn Harrison
# Date Created: 11/18/2005
# Purpose: MP3 Folder and File name cleansing
# Called By: $USER
# Dependencies: awk, sed
#---------------------------------------------------------------------------
mp3()
{
echo Removing non-compliant files.
rm *.db
rm *.m3u #This line can be removed. I don't use the m3u file.
rm *.jpg
for song in *
do
{
#
# Convert song from <Band> - <Track Num.> - <Song>
# To <Compliant Track Num.> - <Song>
#
newSong=`ls "$song"|awk -F '-' '{print $2"-"$3}'|sed 's/ //'`
mod_song=0$newSong
echo Renaming "$song" to "$mod_song"
cp "$song" "$PWD"/"$mod_song"
{
if [ -e "$mod_song"]
then
{
if [ "$song" != "$mod_song" ]
then rm "$song"
else echo FILE NAME CONVERSION FAILED!!!
fi
}
else echo FILE NAME CONVERSION FAILED!!!
fi
}
}
done
cd ..
}

directory()
{
for folder in *
do
{
#
# Convert folder from <Band> - <Year> - <Album>
# To <Band> - <Album>
#
newDir=`echo "$folder"|awk -F '-' '{print $1"-"$3}'`
echo $newDir
cp -R "$folder" "$PWD"/"$newDir"
{
if [ -d "$newDir" ]
then
{
if [ "$folder" != "$newDir" ]
then rm -R "$folder"
else echo FOLDER NAME CONVERSION FAILED!!!
fi
}
else echo FOLDER NAME CONVERSION FAILED!!!
fi
}
cd "$newDir"
mp3
}
done
}

pathDirectory()
{
tempDir=$PWD
cd "$mp3Path"
directory
cd "$tempDir"
}

location()
{
echo "Select from the following options:"
echo "1. Modify MP3 file(s) in currrent directory."
echo "2. Modify Folder(s) and its contents in current directory."
echo "3. Specify path to MP3 directory and modify its contents."

read selection

if [ "$selection" = 1 ]
then mp3
elif [ "$selection" = 2 ]
then directory
elif [ "$selection" = 3 ]
then echo "Specify full path to MP3 folder."
read mp3Path
pathDirectory
else echo "Invalid selection. Try again."; location
fi
}

location

*********************************************************************************************

deviantID

Devious Info

  • Current Residence: E-City NC
  • Interests: Photography, Playing Music and Smiling at dogs
  • Favourite band or musician: Clutch, Phish, Bob Marley
  • Favourite game: The life I live
  • Favourite gaming platform: See above
  • Personal Quote: Three out of four people make up 75 percent of the population.
  • Tools of the Trade: Nikon FE, Nikon FM10, Nikon D70, slew of lenses and Minolta S414.

deviantART Notice

[x]

Comments


thank u for the favourote buddy..

it is really appreciating...!!

take care
Hey there :wave:

How are you? :)


--
:heart:
:shakefist: You're account is almost exactly ONE DAY older than mine!

--
[link]
thanks a lot for +fav, glen :)

--
[link]
YOU HAVE BEEN HUGGED/GLOMPED! :hug: :glomp:

1- You can hug the person who hugged you!
2- You can't hug the person more than 2 times
3- You -MUST- hug at least 6 other people
4- You should hug them in public! Paste it on their user page! c'mon... don't be scared of public displays of affection
5- Random hugs are perfectly okay! (and sweet)
6- You should most definitely get started hugging right away!

--
:camera: I Love Photography!
tks for the :+fav:

--
N3bulA = Alien
Why dont you put any pics from the NorVa up here? You should.

--
:camera: I Love Photography!
random hello to my fellow watcher... ;)

--
Fazer Fotografia é Escrever Poesia com a Luz .. ou de ver gajas nuas..

Making Photography is Writing Poetry with Light.. and seeing naked chicks..

Marco Matos

Site Map