Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Oct 2005 04:10:53 -0500
From:      "Fafa Hafiz Krantz" <fteg@london.com>
To:        questions@freebsd.org
Subject:   Maintaining my music collection (off topic)
Message-ID:  <20051026091053.8E30C83C03@ws1-1.us4.outblaze.com>

next in thread | raw e-mail | index | archive | help

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-200=
1-back.jpg
|    |     |     +-----00-fat_jon_as_maurice_galactica-humanoid_erotica-200=
1-cd.jpg
|    |     |     +-----00-fat_jon_as_maurice_galactica-humanoid_erotica-200=
1-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 extensi=
on)
5) Do an ls *.mp3 and output it to the same file name as the other two file=
s (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=3D1 || do=3D0
	else do=3D1
	fi

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

	cfv=3D$( ls *.cfv )
	if [[ -n $cfv ]] ; then
		echo SFV already exists.
	else
		Data=3D$( awk '! /^:/' $cfv ) && echo "$Data" >$cfv || echo Comment remov=
al 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


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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051026091053.8E30C83C03>