]>
diplodocus.org Git - flac-archive/blob - fa-tags
5 # Copyright (c) 1998-2001 Robert Woodcock <rcw@debian.org>
6 # Copyright (c) 2003-2004 Jesus Climent <jesus.climent@hispalinux.es>
7 # Copyright (c) 2004 Eric Gillespie <epg@pretzelnet.org>
8 # This code is hereby licensed for public consumption under either the
9 # GNU GPL v2 or greater, or Larry Wall's Artistic license - your choice.
13 if [[ -z ${CDDBURL} ]]; then
14 CDDBURL
="http://freedb.freedb.org/~cddb/cddb.cgi"
17 get_cddb_protocol
() {
18 for CDDBPROTO
in 5 4 3; do
20 $
(cddb
-tool stat
$CDDBURL $USER $HOST $CDDBPROTO \
21 | sed 's/^\([0-9][0-9]*\).*/\1/;q') = '210' ]]; then
26 echo "${CDDBURL} does not work"
31 function rstrip_print(_s) {
32 sub(/[[:space:]]*\$/, "", _s)
41 split(\$2, a, /[[:blank:]]*\/[[:blank:]]*/)
42 rstrip_print("ARTIST=" a[1])
43 rstrip_print("ALBUM=" a[2])
47 rstrip_print("DATE=" \$2)
50 /^TTITLE[[:digit:]]+/ {
51 rstrip_print("TITLE=" \$2)
56 perl_handle_read
=$
(<<EOF
57 (\$tag, \$value) = split(/=/, \$_, 2);
60 (\$artist, \$album) = split(/\\s*\\/\\s*/, \$value);
61 print("ARTIST=\$artist\\n");
62 print("ALBUM=\$album\\n");
65 print("DATE=\$value\\n");
67 } elsif (/^TTITLE\\d+/) {
68 print("TITLE=\$value\\n");
77 # First eat the status line.
81 [[ $F = '.' ]] && break
82 cddb
-tool read $CDDBURL $CDDBPROTO $USER $HOST $F[1] $F[2] \
83 | nawk
$handle_read > candidate
-tags-$i
84 # XXX The awk script has at least one problem; since we can't split to
85 # exactly two components, we break on track names with equal signs.
87 # cddb-tool read $CDDBURL $CDDBPROTO $USER $HOST $F[1] $F[2] \
88 # | perl -lne $handle_read > candidate-tags-$i
94 (cddb
-tool query
$CDDBURL $CDDBPROTO $USER $HOST "$@" | handle_queries
) &
96 cat > candidate
-tags-0 <<EOF
101 for i
in $(jot $2 1); do
102 echo 'TITLE=' >> candidate
-tags-0