access 9.6 KB

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