1*aac16800Sagc#! /bin/sh 2*aac16800Sagc 3*aac16800Sagc# $NetBSD: id3db.sh,v 1.1 2007/04/15 15:22:44 agc Exp $ 4*aac16800Sagc# 5*aac16800Sagc# Copyright � 2007 Alistair Crooks. All rights reserved. 6*aac16800Sagc# 7*aac16800Sagc# Redistribution and use in source and binary forms, with or without 8*aac16800Sagc# modification, are permitted provided that the following conditions 9*aac16800Sagc# are met: 10*aac16800Sagc# 1. Redistributions of source code must retain the above copyright 11*aac16800Sagc# notice, this list of conditions and the following disclaimer. 12*aac16800Sagc# 2. Redistributions in binary form must reproduce the above copyright 13*aac16800Sagc# notice, this list of conditions and the following disclaimer in the 14*aac16800Sagc# documentation and/or other materials provided with the distribution. 15*aac16800Sagc# 3. The name of the author may not be used to endorse or promote 16*aac16800Sagc# products derived from this software without specific prior written 17*aac16800Sagc# permission. 18*aac16800Sagc# 19*aac16800Sagc# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 20*aac16800Sagc# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21*aac16800Sagc# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22*aac16800Sagc# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 23*aac16800Sagc# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24*aac16800Sagc# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 25*aac16800Sagc# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26*aac16800Sagc# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 27*aac16800Sagc# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28*aac16800Sagc# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29*aac16800Sagc# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30*aac16800Sagc# 31*aac16800Sagc 32*aac16800Sagcid3info=/usr/music/.id3info 33*aac16800Sagcid3db=/usr/music/.id3.db 34*aac16800Sagc 35*aac16800Sagcdb -w -C -E B btree $id3db 36*aac16800Sagc 37*aac16800Sagcawk -v database=$id3db ' 38*aac16800Sagc/^Filename:/ { filename = $2 } 39*aac16800Sagc/^Title:/ { title = $2 } 40*aac16800Sagc/^Artist:/ { artist = $2 } 41*aac16800Sagc/^Album:/ { album = $2 } 42*aac16800Sagc/^Year:/ { year = $2 } 43*aac16800Sagc/^Genre:/ { genre = $2 " " $3 } 44*aac16800Sagc/^Track:/ { track = $2 } 45*aac16800Sagc/^Comment:/ { comment = $0 } 46*aac16800Sagc/^Directory/ { directory = $2 } 47*aac16800Sagc/^$/ { 48*aac16800Sagc if (artist == "") 49*aac16800Sagc artist = "Unknown" 50*aac16800Sagc if (year == "") 51*aac16800Sagc year = "Unknown" 52*aac16800Sagc if (genre == "") 53*aac16800Sagc genre = "Unknown" 54*aac16800Sagc s = sprintf("db -w -E B btree %s %ca%s/%s%c %c%s%c %cy%s/%s%c %c%s%c %cg%s/%s%c %c%s%c", 55*aac16800Sagc database, 56*aac16800Sagc 39, directory, filename, 39, 39, artist, 39, 57*aac16800Sagc 39, directory, filename, 39, 39, year, 39, 58*aac16800Sagc 39, directory, filename, 39, 39, genre, 39); 59*aac16800Sagc system(s); 60*aac16800Sagc} 61*aac16800Sagc' $id3info 62*aac16800Sagc 63*aac16800Sagcexit 0 64