From owner-freebsd-questions@FreeBSD.ORG Mon Oct 31 13:02:36 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 2855316A420 for ; Mon, 31 Oct 2005 13:02:36 +0000 (GMT) (envelope-from fteg@london.com) Received: from webmail-outgoing.us4.outblaze.com (webmail-outgoing2.us4.outblaze.com [205.158.62.67]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9519B43D46 for ; Mon, 31 Oct 2005 13:02:35 +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 6A89618001C4 for ; Mon, 31 Oct 2005 13:02:35 +0000 (GMT) X-OB-Received: from unknown (205.158.62.49) by wfilter.us4.outblaze.com; 31 Oct 2005 13:02:35 -0000 Received: by ws1-1.us4.outblaze.com (Postfix, from userid 1001) id 5D5EA83C0D; Mon, 31 Oct 2005 13:02:35 +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: Mon, 31 Oct 2005 08:02:34 -0500 Received: from [213.187.181.70] by ws1-1.us4.outblaze.com with http for fteg@london.com; Mon, 31 Oct 2005 08:02:34 -0500 X-Originating-Ip: 213.187.181.70 X-Originating-Server: ws1-1.us4.outblaze.com Message-Id: <20051031130235.5D5EA83C0D@ws1-1.us4.outblaze.com> Cc: keramidas@freebsd.org Subject: mp3.sh: Asking for advice 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: Mon, 31 Oct 2005 13:02:36 -0000 Hello! I got this script here: #!/bin/sh # # Generate SFV and M3U for MP3 releases. # $URBAN: mp3.sh,v 1.0 2005/10/24 15:05:09 fafa Exp $ # for file in `find . -name \*.nfo | sed 's,^\./,,'`; do directory=3D"`dirname ${file}`" prefix=3D"`basename ${file} | sed 's/.nfo//g'`" current=3D"`basename ${directory}`" sfv=3D"${directory}/${prefix}.sfv" m3u=3D"${directory}/${prefix}.m3u" cd ${directory} =09=09 rm -f *.sfv rm -f *.m3u =09=09 touch ${sfv} if [ test `cfv -C *.mp3 > &>/dev/null` -nq 0 ] echo "CFV returned non-zero result." break fi =09=09 cat ${current}.sfv | awk '! /^;/' > ${sfv} rm -f ${current}.sfv =09=09 for mp3 in *.mp3; do echo "${mp3}" >> ${m3u}; done echo "$directory: Done" done In some cases though, an album contains two or more CDs -- making the files= start with 3 digits, and not 2 like normal -- such as cd/track: 101, 102 etc. for= CD1 and 201, 202 etc. for CD2. If this is the case, then one .m3u (playlist) should= be generated for each CD, like ${prefix}-cd1.m3u, ${prefix}-cd2.m3u etc. Now, I'm a super newbie when it comes to scripting. I have no idea what to = do. I've been told I can use sed, or maybe echo $filename | egrep '^[[:digit:]]{2}[^= [:digit:]]' but I am clueless as to how I could make that all work with my script. If anybody has a clue, please do share it :) Thanks you all ... -- Fafa Hafiz Krantz Research Designer @ http://www.bleed.com --=20 ___________________________________________________ Play 100s of games for FREE! http://games.mail.com/