#! /usr/bin/env zsh # $Id$ # Copyright (c) 1998-2001 Robert Woodcock # Copyright (c) 2003-2004 Jesus Climent # Copyright (c) 2004 Eric Gillespie # This code is hereby licensed for public consumption under either the # GNU GPL v2 or greater, or Larry Wall's Artistic license - your choice. set -e if [[ -z ${CDDBURL} ]]; then CDDBURL="http://freedb.freedb.org/~cddb/cddb.cgi" fi get_cddb_protocol () { for CDDBPROTO in 5 4 3; do if [[ \ $(cddb-tool stat $CDDBURL $USER $HOST $CDDBPROTO \ | sed 's/^\([0-9][0-9]*\).*/\1/;q') = '210' ]]; then return 0 fi done echo "${CDDBURL} does not work" exit 2 } handle_read=$(< candidate-tags-$i # XXX The awk script has at least one problem; since we can't split to # exactly two components, we break on track names with equal signs. # Use Perl instead: # cddb-tool read $CDDBURL $CDDBPROTO $USER $HOST $F[1] $F[2] \ # | perl -lne $handle_read > candidate-tags-$i i=$(( $i + 1 )) done } get_cddb_protocol (cddb-tool query $CDDBURL $CDDBPROTO $USER $HOST "$@" | handle_queries) & cat > candidate-tags-0 <