From owner-freebsd-questions@FreeBSD.ORG Fri Jan 13 21:30:16 2006 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 8C22A16A41F for ; Fri, 13 Jan 2006 21:30:16 +0000 (GMT) (envelope-from vaaf@broadpark.no) Received: from osl1smout1.broadpark.no (osl1smout1.broadpark.no [80.202.4.58]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2373643D46 for ; Fri, 13 Jan 2006 21:30:16 +0000 (GMT) (envelope-from vaaf@broadpark.no) Received: from broadpark.no ([217.13.4.96]) by osl1smout1.broadpark.no (Sun Java System Messaging Server 6.1 HotFix 0.05 (built Oct 21 2004)) with ESMTP id <0IT1002T2VYCDT70@osl1smout1.broadpark.no> for questions@freebsd.org; Fri, 13 Jan 2006 22:35:00 +0100 (CET) Received: from [80.202.4.61] (Forwarded-For: [213.187.181.70]) by bgo1mstore1.broadpark.no (mshttpd); Fri, 13 Jan 2006 22:30:03 +0100 Date: Fri, 13 Jan 2006 22:30:03 +0100 From: Kristian Vaaf To: questions@freebsd.org Message-id: <66915a1d4f35.43c829eb@broadpark.no> MIME-version: 1.0 X-Mailer: Sun Java(tm) System Messenger Express 6.1 HotFix 0.05 (built Oct 21 2004) Content-type: text/plain; charset=us-ascii Content-language: en Content-transfer-encoding: 7BIT Content-disposition: inline X-Accept-Language: en Priority: normal Cc: Subject: Script to lock the state of my MP3 files 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: Fri, 13 Jan 2006 21:30:16 -0000 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