Maintaining my music collection (off topic)

Fafa Hafiz Krantz fteg at london.com
Wed Oct 26 02:10:56 PDT 2005


Hello!

I have a rather large collection of CDs and vinyls which I have
digitized for preservation. For instance:

+----/usr/home/mp3
|    +-----instrumentals/
|    |     +-----fat_jon_as_maurice_galactica-humanoid_erotica-cd-2001/
|    |     |     +-----00-fat_jon_as_maurice_galactica-humanoid_erotica-2001-back.jpg
|    |     |     +-----00-fat_jon_as_maurice_galactica-humanoid_erotica-2001-cd.jpg
|    |     |     +-----00-fat_jon_as_maurice_galactica-humanoid_erotica-2001-front.jpg
|    |     |     +-----00-fat_jon_as_maurice_galactica-humanoid_erotica-cd-2001.nfo
|    |     |     +-----01-at_the_bar.mp3
|    |     |     +-----02-14_years-nbd.mp3
|    |     |     +-----03-triple_gold_daytons.mp3
|    |     |     +-----04-no.mp3
|    |     |     +-----05-tell_me.mp3
|    |     |     +-----06-the_queen_and_i.mp3
|    |     |     +-----07-backseat_anonymous-.mp3
|    |     |     +-----08-change_your_mind.mp3
|    |     |     +-----09-exact_space.mp3
|    |     |     +-----10-i_dee.mp3
|    |     |     +-----11-rain_dance_remix_instrumental.mp3
|    |     |     +-----12-pretty_pussy_kitty_kat_ft_five_deez.mp3
|    |     |     +-----13-unnamed_track.mp3

Inside mp3/ there are a lot of subfolders and subsubfolders
containing my albums. My problem is that they all lack a Simple File
Verification file as well as a M3U playlist. Generating those
manually for each album is way too much.

I was wondering if anybody could assist me in building this script
to perform these tasks:

1) Go to all directories containing an .nfo file
2) Generate an .sfv file based on the .mp3 files in each directory
3) Remove .sfv comments created by the cfv tool
4) Give the .sfv file the same name as the as the .nfo file (except extension)
5) Do an ls *.mp3 and output it to the same file name as the other two files (except extension)

So far a friend of mine has helped me make this:

fix() {
	find ${1+:"$@"} -name '*.nfo' | while read file ; do
 	cd ${file%/*}

	if [[ $(ls *.sfv) ]]; then
		(( recreate )) && do=1 || do=0
	else do=1
	fi

	(( do )) && cfv -C *.mp3 || { echo SFV creation failed. ; return 1 ; } ; ... filename code .. ;

	cfv=$( ls *.cfv )
	if [[ -n $cfv ]] ; then
		echo SFV already exists.
	else
		Data=$( awk '! /^:/' $cfv ) && echo "$Data" >$cfv || echo Comment removal failed.
	fi
}

But it doesn't really work.

# sh fix.sh
  fix.sh: 9: Syntax error: "do" unexpected (expecting ")")

Maybe it also can be simplified?
I don't know much coding, but to me it looks kind of messy.

Well, that's it.
Thank you so much all!

--
Fafa Hafiz Krantz
  Research Designer @ http://www.bleed.com


-- 
___________________________________________________
Play 100s of games for FREE! http://games.mail.com/



More information about the freebsd-questions mailing list