Script to lock the state of my MP3 files

Kristian Vaaf vaaf at broadpark.no
Fri Jan 13 13:30:16 PST 2006


Hello!

I use this script to generate simple verification files (SFV) and MP3 playlist files (M3U)
based on the info file (NFO) that I create for every album that I digitalize.

If this is an album:

./dj_antoine-arabian_adventure-sessp010-vinyl-2005:
00-dj_antoine-arabian_adventure-sessp010-vinyl-2005.nfo
00-dj_antoine-arabian_adventure-sessp010-vinyl-2005-cover.jpg
a1-dj_antoine-arabian_adventure_2-original_mix.mp3
b1-dj_antoine-arabian_adventure_2-chriss_ortega_and_thomas_gold_vocal_mix.mp3
b2-dj_antoine-arabian_adventure_2-chriss_ortega_and_thomas_gold_dub_mix.mp3

Then the script makes it into:

./dj_antoine-arabian_adventure-sessp010-vinyl-2005:
00-dj_antoine-arabian_adventure-sessp010-vinyl-2005.m3u
00-dj_antoine-arabian_adventure-sessp010-vinyl-2005.nfo
00-dj_antoine-arabian_adventure-sessp010-vinyl-2005.sfv
00-dj_antoine-arabian_adventure-sessp010-vinyl-2005-cover.jpg
a1-dj_antoine-arabian_adventure_2-original_mix.mp3
b1-dj_antoine-arabian_adventure_2-chriss_ortega_and_thomas_gold_vocal_mix.mp3
b2-dj_antoine-arabian_adventure_2-chriss_ortega_and_thomas_gold_dub_mix.mp3

My script is made for regular sh though.
If it were to be bashed -- how would it look like?

#!/bin/sh
#
#   Generate SFV and M3U files for MP3 albums.
#   $URBAN: mp3_archive.sh,v 1.0 2005/10/24 15:09:05 vaaf Exp $
#

for file in `find $(pwd) -name \*.nfo`; do

	directory="`dirname ${file}`"
	prefix="`basename ${file} | sed 's/.nfo//g'`"
	current="`basename ${directory}`"

	sfv="${directory}/${prefix}.sfv"
	m3u="${directory}/${prefix}.m3u"

		cd ${directory}

		rm -f *.sfv; rm -f *.m3u
		touch ${sfv}; cfv -Cq *.mp3
		cat ${current}.sfv | awk '! /^;/' > ${sfv}
		rm -f ${current}.sfv

		for mp3 in *.mp3; do echo "${mp3}" >> ${m3u}; done

	echo "$current: Done"

done

Thanks guys,
Kristian




More information about the freebsd-questions mailing list