2 |
- |
1 |
TWO FORMS OF ACCESS TO THE FREEDB
|
|
|
2 |
---------------------------------
|
|
|
3 |
|
|
|
4 |
In the following document we will refer to CDDB instead of freedb, since
|
|
|
5 |
from a technical point of view, freedb is a CDDB-Server as it uses the
|
|
|
6 |
CDDB-protocol.
|
|
|
7 |
|
|
|
8 |
If you are interested in incorporating the use of freedb in your
|
|
|
9 |
software, there are two forms of access that you may consider.
|
|
|
10 |
|
|
|
11 |
1. <a href="#local">Local access</a>
|
|
|
12 |
|
|
|
13 |
In this mode your software simply attempts to open local files on
|
|
|
14 |
the computer to access the CDDB.
|
|
|
15 |
|
|
|
16 |
2. <a href="#remote">Remote access</a>
|
|
|
17 |
|
|
|
18 |
In this mode the software must connect to a freedb server on the
|
|
|
19 |
network to access the CDDB. There is a CDDB server protocol that
|
|
|
20 |
the software (also known as the "client") must use to converse with
|
|
|
21 |
the server.
|
|
|
22 |
|
|
|
23 |
You may choose to support either one, or both of these modes.
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
CDDB DISCID
|
|
|
27 |
-----------
|
|
|
28 |
|
|
|
29 |
Both forms of CDDB access requires that the software computes a "disc
|
|
|
30 |
ID" which is an identifier that is used to access the CDDB. The disc
|
|
|
31 |
ID is a 8-digit hexadecimal (base-16) number, computed using data from
|
|
|
32 |
a CD's Table-of-Contents (TOC) in MSF (Minute Second Frame) form. The
|
|
|
33 |
algorithm is listed below in the <a href="http://freedb.freedb.org/sections.php?op=viewarticle&artid=6">DISCID Howto</a>.
|
|
|
34 |
|
|
|
35 |
It is crucial that your software compute the disc ID correctly. If it
|
|
|
36 |
does not generate the disc ID, it will not be compatible with the
|
|
|
37 |
CDDB. Moreover, if your software submits CDDB entries with bad disc
|
|
|
38 |
IDs to the freedb archives, it could compromise the integrity of the
|
|
|
39 |
freedb.
|
|
|
40 |
|
|
|
41 |
If you have access to a UNIX platform that xmcd supports, we suggest
|
|
|
42 |
installing xmcd, and then test the disc ID code in your software by
|
|
|
43 |
comparing the disc ID generated by xmcd with that of your software,
|
|
|
44 |
for as large a number of CDs as possible.
|
|
|
45 |
|
|
|
46 |
|
|
|
47 |
<a name="local"></a>LOCAL CDDB ACCESS
|
|
|
48 |
-----------------
|
|
|
49 |
|
|
|
50 |
There are two forms of the CDDB archive available, the standard form
|
|
|
51 |
and the alternate form. Both forms are available for download from
|
|
|
52 |
various servers. You can always find an actual list of mirrors on the
|
|
|
53 |
freedb-homepage at <a href="http://freedb.freedb.org">http://freedb.freedb.org</a>.
|
|
|
54 |
The standard form of the CDDB archive is released to the public as
|
|
|
55 |
a UNIX tar(1)-format archive, compressed with gzip. The alternate
|
|
|
56 |
form archive is in the .zip format that is popular on the Windows
|
|
|
57 |
platform.
|
|
|
58 |
|
|
|
59 |
Standard Form:
|
|
|
60 |
--------------
|
|
|
61 |
|
|
|
62 |
Each CD entry is a separate file in the xmcd CDDB. These files are
|
|
|
63 |
organized in several directories, each directory is a category of
|
|
|
64 |
music. Currently the "official" categories are listed as follows:
|
|
|
65 |
|
|
|
66 |
blues
|
|
|
67 |
classical
|
|
|
68 |
country
|
|
|
69 |
data
|
|
|
70 |
folk
|
|
|
71 |
jazz
|
|
|
72 |
misc
|
|
|
73 |
newage
|
|
|
74 |
reggae
|
|
|
75 |
rock
|
|
|
76 |
soundtrack
|
|
|
77 |
|
|
|
78 |
The individual CDDB files have a file name that is the 8-digit disc
|
|
|
79 |
ID. For example, under the blues directory there may be the following
|
|
|
80 |
files:
|
|
|
81 |
|
|
|
82 |
0511c012
|
|
|
83 |
060e7314
|
|
|
84 |
0c01e902
|
|
|
85 |
0f0c3112
|
|
|
86 |
...
|
|
|
87 |
fa0f6f10
|
|
|
88 |
fb0f8814
|
|
|
89 |
fd0e6013
|
|
|
90 |
|
|
|
91 |
To access the CDDB entry associated with a CD, your software simply
|
|
|
92 |
opens the appropriate file and reads the information.
|
|
|
93 |
|
|
|
94 |
The content of each of these files is in a format described in the
|
|
|
95 |
<a href="http://freedb.freedb.org/software/old/DBFORMAT">database-format specification</a>.
|
|
|
96 |
|
|
|
97 |
Different pressings of a particular CD title may contain differences
|
|
|
98 |
in timings that can cause the computed disc ID to be different.
|
|
|
99 |
The CDDB allows this by having multiple file names be links to
|
|
|
100 |
the same file. The links are implemented as actual filesystem links
|
|
|
101 |
(see the ln(1) command) on UNIX systems. For example, the following
|
|
|
102 |
files in the rock directory are all links to the same file, and
|
|
|
103 |
refer to the CD "Pink Floyd / The Division Bell".:
|
|
|
104 |
|
|
|
105 |
850f740b
|
|
|
106 |
850f950b
|
|
|
107 |
850f970b
|
|
|
108 |
860f960b
|
|
|
109 |
890f970b
|
|
|
110 |
|
|
|
111 |
Xmcd and the CD database server use this form of the CDDB archive. The
|
|
|
112 |
benefit of the standard form of the CDDB archive is very fast access,
|
|
|
113 |
and ease of add/delete/edit operations on entries.
|
|
|
114 |
|
|
|
115 |
Alternate Form:
|
|
|
116 |
---------------
|
|
|
117 |
|
|
|
118 |
Due to limitations in the FAT file system used on Windows 9x and
|
|
|
119 |
Windows ME, it is unfeasible to use the standard format CDDB archive
|
|
|
120 |
due to the large number of files. This is because such a filesystem
|
|
|
121 |
operates on fixed-size clusters and even a small file (and most CDDB
|
|
|
122 |
files are 1KB or less) would consume the space of a full cluster
|
|
|
123 |
(Depending upon disk size, a cluster can range from 4KB to 32KB in
|
|
|
124 |
size). Thus, a tremendous amount of disk space would be wasted on
|
|
|
125 |
these systems if the CDDB archive is used in its standard form.
|
|
|
126 |
|
|
|
127 |
An alternate form of the CDDB archives was created for use by software
|
|
|
128 |
that must operate on a system with the FAT limitations.
|
|
|
129 |
|
|
|
130 |
The alterate form still use the separate category directories as the
|
|
|
131 |
standard form, but concatenates many files into a smaller number of
|
|
|
132 |
files under each category. The first two digits of the CDDB file names
|
|
|
133 |
is used as a key for concatenation, each file is allowed to grow to
|
|
|
134 |
approximately 64KB in size before a new file is started. The file name
|
|
|
135 |
indicates what range of the digits are included in that file. For
|
|
|
136 |
example, under the blues category we may have the following files:
|
|
|
137 |
|
|
|
138 |
01to36
|
|
|
139 |
37to55
|
|
|
140 |
56to71
|
|
|
141 |
...
|
|
|
142 |
b2tod7
|
|
|
143 |
d8toff
|
|
|
144 |
|
|
|
145 |
The 01to36 file contains all CDDB entries with disc ID 01xxxxxx,
|
|
|
146 |
02xxxxxx, 03xxxxxx and so on, up to 36xxxxxx.
|
|
|
147 |
|
|
|
148 |
Each entry in the concatenated file begins with the keyword
|
|
|
149 |
|
|
|
150 |
#FILENAME=xxxxxxxx
|
|
|
151 |
|
|
|
152 |
where discid is the 8-digit hexadecimal disc ID of that entry. Your
|
|
|
153 |
software must search through the appropriate file to locate the desired
|
|
|
154 |
entry. The CDDB entry is in the format described in Appendix B below.
|
|
|
155 |
|
|
|
156 |
The alternate form avoids the problem of inefficient disk space
|
|
|
157 |
utilization on FAT-based filesystems, but is slower to access than the
|
|
|
158 |
standard form, and it is much more cumbersome to perform add/delete/edit
|
|
|
159 |
operations on a CDDB entry.
|
|
|
160 |
|
|
|
161 |
|
|
|
162 |
<a name="remote"></a>REMOTE CDDB ACCESS
|
|
|
163 |
------------------
|
|
|
164 |
|
|
|
165 |
Your software must be able to communicate with a remote CD server
|
|
|
166 |
system via TCP/IP or HTTP.
|
|
|
167 |
There are a number of public freedb servers operating
|
|
|
168 |
on the Internet. The <a href="http://freedb.freedb.org/sections.php?op=viewarticle&artid=9">current list of public servers</a> is listed on the
|
|
|
169 |
freedb web page at:
|
|
|
170 |
|
|
|
171 |
http://freedb.freedb.org.
|
|
|
172 |
|
|
|
173 |
It may also be obtained programmatically via the CDDB protocol "sites"
|
|
|
174 |
command.
|
|
|
175 |
|
|
|
176 |
TCP/IP access:
|
|
|
177 |
|
|
|
178 |
All current freedb servers answer at TCP port 888. There may be future
|
|
|
179 |
sites that deviate from this convention, however.
|
|
|
180 |
|
|
|
181 |
HTTP access:
|
|
|
182 |
|
|
|
183 |
The freedb-servers can be accessed via the cddb.cgi. This is resides at the
|
|
|
184 |
following path: /~cddb/cddb.cgi
|
|
|
185 |
Thus, the URL for accessing the server at freedb.freedb.org is:
|
|
|
186 |
http://freedb.freedb.org/~cddb/cddb.cgi
|
|
|
187 |
|
|
|
188 |
You should make the freedb server host (or hosts) and port numbers
|
|
|
189 |
user-configurable in your software. Do not hard-wire the list of
|
|
|
190 |
CD database servers into your code. The list of active servers changes
|
|
|
191 |
over time.
|
|
|
192 |
|
|
|
193 |
The CDDB server protocol is described in the <a href="http://freedb.freedb.org/sections.php?op=viewarticle&artid=28">CDDB-protocol documentation</a>.
|
|
|
194 |
|
|
|
195 |
The CDDB entry returned from the server via a "cddb read" command is in
|
|
|
196 |
the format described <a href="http://freedb.freedb.org/software/old/DBFORMAT">database-format specification</a>.
|
|
|
197 |
|
|
|
198 |
You may experiment with the freedb server by connecting to port 888 of
|
|
|
199 |
the server host via the "telnet" program, and then typing the cddb
|
|
|
200 |
protocol commands by hand. For example:
|
|
|
201 |
|
|
|
202 |
telnet freedb.freedb.org 888
|
|
|
203 |
|
|
|
204 |
connects you to the freedb server at freedb.freedb.org.
|
|
|
205 |
|
|
|
206 |
Some additional notes for accessing freedb over the Internet:
|
|
|
207 |
|
|
|
208 |
Your application should always specify the highest documented protocol
|
|
|
209 |
level. The highest level currently supported is "3". Lower protocol
|
|
|
210 |
levels will work, but are only provided for compatibility with older
|
|
|
211 |
CDDB applications. If you do not use the highest available protocol
|
|
|
212 |
level, certain important features will not be available to your
|
|
|
213 |
application.
|
|
|
214 |
|
|
|
215 |
Make sure to use the proper arguments with the "hello" command. The user
|
|
|
216 |
and hostname arguments should be that of the user's email address, not
|
|
|
217 |
some fixed hard-coded value. The application name and version should be
|
|
|
218 |
that of your application, not that of another existing application.
|
|
|
219 |
|
|
|
220 |
We consider the use of the "cddb query" command mandatory for all CDDB
|
|
|
221 |
clients. It is not valid to issue a "cddb read" command without issuing
|
|
|
222 |
a prior "cddb query" and receiving a good response, as it may yield incorrect
|
|
|
223 |
results. In addition, it is clients should support close matches
|
|
|
224 |
(aka "fuzzy" matches, or response code 211).
|
|
|
225 |
|
|
|
226 |
The proper way to handle multiple fuzzy matches is to present the
|
|
|
227 |
entire list of matches to the user and to let the user choose between them.
|
|
|
228 |
Matches are listed in the order of best fit for the user's disc, so they
|
|
|
229 |
should be presented to the user in the order they are listed by the server.
|
|
|
230 |
|
|
|
231 |
The suggested algorithm for obtaining the list of server sites is
|
|
|
232 |
as follows. The application should offer to get the list from
|
|
|
233 |
freedb.freedb.org with the "sites" command the first time the user runs
|
|
|
234 |
the program. Additionally the application should provide the user with
|
|
|
235 |
some method of downloading the list on-demand.
|
|
|
236 |
|
|
|
237 |
We do strongly suggest that you provide your users with the capability of
|
|
|
238 |
choosing freedb server sites as described above. However, for some
|
|
|
239 |
applications this may not be feasible. If you do not wish to offer this
|
|
|
240 |
functionality, you may safely hard-code "freedb.freedb.org" in your
|
|
|
241 |
application as the sole freedb site to access. This will deprive your users
|
|
|
242 |
of the option to choose a site near their locale for optimal response, but
|
|
|
243 |
that is your choice.
|