From owner-freebsd-questions@FreeBSD.ORG Wed Oct 26 09:10:56 2005 Return-Path: X-Original-To: questions@freebsd.org Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3C15716A41F for ; Wed, 26 Oct 2005 09:10:56 +0000 (GMT) (envelope-from fteg@london.com) Received: from webmail-outgoing.us4.outblaze.com (webmail-outgoing.us4.outblaze.com [205.158.62.67]) by mx1.FreeBSD.org (Postfix) with ESMTP id 257D843D4C for ; Wed, 26 Oct 2005 09:10:55 +0000 (GMT) (envelope-from fteg@london.com) Received: from unknown (unknown [192.168.9.180]) by webmail-outgoing.us4.outblaze.com (Postfix) with QMQP id B471018002AC for ; Wed, 26 Oct 2005 09:10:53 +0000 (GMT) X-OB-Received: from unknown (205.158.62.49) by wfilter.us4.outblaze.com; 26 Oct 2005 09:10:53 -0000 Received: by ws1-1.us4.outblaze.com (Postfix, from userid 1001) id 8E30C83C03; Wed, 26 Oct 2005 09:10:53 +0000 (GMT) Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 From: "Fafa Hafiz Krantz" To: questions@freebsd.org Date: Wed, 26 Oct 2005 04:10:53 -0500 Received: from [213.187.181.70] by ws1-1.us4.outblaze.com with http for fteg@london.com; Wed, 26 Oct 2005 04:10:53 -0500 X-Originating-Ip: 213.187.181.70 X-Originating-Server: ws1-1.us4.outblaze.com Message-Id: <20051026091053.8E30C83C03@ws1-1.us4.outblaze.com> Cc: Subject: Maintaining my music collection (off topic) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Oct 2005 09:10:56 -0000 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/