{"id":16670770,"url":"https://github.com/freso/cddb-py","last_synced_at":"2025-05-13T14:31:40.832Z","repository":{"id":139972481,"uuid":"81657659","full_name":"Freso/cddb-py","owner":"Freso","description":"Python 3 port of CDDB.py (http://cddb-py.sourceforge.net/)","archived":false,"fork":false,"pushed_at":"2019-08-31T20:32:17.000Z","size":80,"stargazers_count":3,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T03:34:55.764Z","etag":null,"topics":["cddb","freedb","python","python-3"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Freso.png","metadata":{"files":{"readme":"README","changelog":"CHANGES","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-11T14:21:10.000Z","updated_at":"2023-01-02T04:08:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"e06a5de3-ea62-4c77-b1d7-cf9334aebeab","html_url":"https://github.com/Freso/cddb-py","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freso%2Fcddb-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freso%2Fcddb-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freso%2Fcddb-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freso%2Fcddb-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Freso","download_url":"https://codeload.github.com/Freso/cddb-py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253960348,"owners_count":21990848,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cddb","freedb","python","python-3"],"created_at":"2024-10-12T11:39:39.695Z","updated_at":"2025-05-13T14:31:40.572Z","avatar_url":"https://github.com/Freso.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"README for CDDB.py and DiscID.py, version 1.4\n\nCopyright (C) 1999-2003 Ben Gertzfield \u003cche@debian.org\u003e\n-------------------------------------------------------\n\nThe dynamic duo of CDDB.py and DiscID.py, along with their side-kick C\nmodule cdrommodule.so, provide an easy way for Python programs to\nfetch information on audio CDs from CDDB (http://www.cddb.com/) -- a\nvery large online database of track listings and other information on\naudio CDs.  UNIX platforms and Windows are both supported.\n\nThis work is released under the GNU GPL; see the file COPYING for more\ninformation.\n\nNote that for CDDB.py version 1.3 and later, the default CDDB servers\nhave changed to FreeDB, as GraceNote, the owners of the\npreviously-free CDDB archives, have become unreasonably restrictive\nwith access to their database.  See http://www.freedb.org/ for more\ninformation on FreeDB.\n\nThe old CDDB servers are still usable, but GraceNote has banned all\n\"non-registered\" programs -- including CDDB.py -- from accessing their\ndatabases.  I'm not particularly interested in bending over backwards\nfor them, but CDDB.query() can still access any CDDB host you specify,\nand from version 1.3 on, also allows you to 'fake' the identification\nstring to anything you wish for accessing their servers.\n\n-----\n\nIf you are using Python 1.6 or 2.0 or later on Linux, FreeBSD,\nOpenBSD, Mac OS X, or Solaris, installing is simple.  As root, run:\n\n# python3 setup.py install\n\n(This also works if you have installed Distutils on an older\nPython. See http://www.python.org/sigs/distutils-sig/download.html for\nmore information.)\n\n-----\n\nIf you have an older version of Python installed on Linux, FreeBSD,\nOpenBSD, Mac OS X, or Solaris:\n\n% make -f Makefile.pre.in boot\n% make\n\nThen copy CDDB.py, DiscID,py, and cdrommodule.so to your local\nPython packages directory (usually /usr/lib/python1.5/site-packages).\n\n-----\n\nIf you are using Python 2.0 on Windows, you can simply extract the\nfollowing files to your C:\\Python20\\Lib\\ directory:\n\nCDDB.py DiscID.py win32\\cdrom.py win32\\mci.dll\n\nOlder revisions of Python will require a by-hand recompile of\nwin32\\mci.c; win32\\mci.dsp has been provided for Visual C++ users.\n\nI do not have access to a Windows compiler, so I cannot support the\nmodule very well.  However, I have tested that it works on Windows\n2000 with Python 2.0.  Thanks to Mike Roberts \u003czoarre@yahoo.com\u003e for\nrecompiling the mci.dll library for Python 2.0!\n\nThere is an experimental setup-win32.py Distutils, which (in theory)\nworks the same as the *nix method (python setup-win32.py install) on\nWindows.  Completely untested.\n\n-----\n\nThe distribution is split up into three parts:\n\n* CDDB.py, for querying the online CDDB servers.\n* cdrommodule.so, a C extension module, for actually querying the\n  CD-ROM drive for the track start times and other data.\n* DiscID.py, a wrapper around cdrommodule.so, which formats the\n  track data the way the CDDB protocol requires it.\n\nAlso included is cddb-info.py, a quick example of how to use CDDB.py\nand DiscID.py together to fetch the track info of an audio CD.  Feel\nfree to use this to understand how to make your own Python CDDB\napplications!\n\nFor another example as to how CDDB.py works, see Russ Nelson's\nMP3 renamer program: http://russnelson.com/rename-tracks\n\nDiscID.py\n---------\n\nThe DiscID.py module is a platform-independant wrapper around the\ncdrommodule.so C extension, and is used to get the track information\nof an audio CD into the format the CDDB protocol requires.\n\nThere are two methods of the DiscID module that are of interest:\n\ndevice = DiscID.open()\n\n  This is the default, cross-platform way to open the audio\n  CD-ROM device.  The device defaults to /dev/cdrom on Linux and BSD,\n  /dev/disk1 on Mac OS X, /dev/vol/aliases/cdrom0 on Solaris, and\n  cdaudio under Windows.  You do not have to use this function to open\n  the audio CD-ROM device, but it's a sane default.\n\n  If you want to specify a different device name or flags for opening,\n  use the following:\n\ndevice = DiscID.open(devicename, flags)\n\n  The optional flags parameter should be an int under *nix, and a\n  string under Windows.  Flags come from the fcntl module under *nix.\n\ndisc_id = DiscID.disc_id(device)\n\n  Given an opened file object corresponding to a CD-ROM device (either\n  opened by hand, or returned from DiscID.open above), return an array\n  of the format:\n\n  [cddb_checksum, num_tracks, num_frames 1, ... num_frames n, num_seconds]\n\n  cddb_checksum is the 128-bit checksum of the track information,\n  as specified by CDDB\n\n  num_tracks is the number of tracks on the disc\n\n  num_frames x is the offset of the start of track x, in terms of\n  frames. A frame is simply 1/75th of a second.  x ranges from\n  1 to num_tracks.\n\n  num_seconds is the total number of seconds on the disc, as measured\n  by the start of the special 'lead-out' track.\n\nThe disc_id returned from DiscID.disc_id may look complex, but it's\nexactly in the format CDDB wants, and is the format needed for\nCDDB.query(disc_id), as described below.\n\nCDDB.py\n-------\n\nThe CDDB.py module is platform-independant; its job is to query\nthe online CDDB servers via HTTP and retrieve track listings and\nany other data relevant to the specified audio CD.\n\nThere are two methods of the CDDB module that are of interest:\n\n(status, info) = CDDB.query(disc_id, [server_url], [user], [host],\n                            [client_name], [client_version])\n\n  Given a disc_id, as returned from DiscID.disc_id() above,\n  return a tuple of two items. The first item returned is an integer\n  indicating the status returned from the server; it will be one of\n  the following:\n\n  * 200: Success\n  * 211: Multiple inexact matches were found\n  * 210: Multiple exact matches were found\n  * 202: No match found\n  * 403: Error; database entry is corrupt\n  * 409: Error; no handshake. (client-side error?)\n\n  Any other return code is failure due to a server or client error.\n\n  The actual contents of the second item returned depend on the\n  status returned by the server. On 200, a dictionary containing\n  three items is returned:\n\n  info['category']: The category the audio CD belongs in\n  info['disc_id']:  The CDDB checksum disc ID of the given disc\n  info['title']:    The title of the audio CD\n\n  On 211 or 210, a list will be returned as the second item.  Each\n  element of the list will be a dictionary containing three items,\n  exactly the same as a single 200 success return.\n\n  On any other status, None will be returned as the second item.\n\n  By default, the server http://freedb.freedb.org/~cddb/cddb.cgi will\n  be used. You can specify a different server URL as the second\n  argument to CDDB.query().\n\n  The identification string used to tell the CDDB servers what\n  program is accessing them defaults to CDDB.py, but you can\n  change that by specifying different client_name and\n  client_version arguments to CDDB.query().\n\n  The optional user and host arguments are sent in the 'hello'\n  portion of the CDDB query. They should correspond to the\n  user's email address (if you believe in the CDDB docs, that\n  is -- it may not be nice to send the user's email address\n  without asking them!)\n\n  By default, if the EMAIL environment variable is set, user\n  and host will be set by parsing $EMAIL into user@host.\n\n  Otherwise, user will default to os.geteuid(), falling back\n  to os.environ['USER'], then just plain 'user', and host\n  will default to socket.gethostname() or just plain 'host' if\n  that fails.\n\n(status, info) = CDDB.read(category, disc_id, [server_url], [user], [host],\n                           [client_name], [client_version])\n\n  Given a category and a disc ID checksum as returned from\n  CDDB.query(), return a tuple of two items. The first item returned\n  is an integer indicating the status, as above. It will be one of\n  the following:\n\n  * 210: Success\n  * 401: Specified entry not found\n  * 402: Server error\n  * 403: Database entry is corrupt\n  * 409: No handshake\n  * 417: Access limit exceeded\n\n  Any other return value is a server or client error.\n\n  The second value returned from CDDB.read() depends on the status\n  returned by the server. On 210, a dictionary will be returned,\n  the keys of which follow the keywords returned by the CDDB read\n  command.\n\n  Dictionary entries that will be of interest (note: not all of\n  these keys will always be available for all discs):\n\n  info['TTITLE#'] (where # ranges from 1 to the last track on the disc):\n    The title of track number #. Note that this is not padded on the\n    left with zeroes.\n\n  info['DTITLE']\n    The title of the disc.\n\n  info['EXTD']\n    Extended data on the CD. (credits, etc.)\n\n  info['EXTT#']\n    Extended data on track number #.\n\n  info['submitted_via']\n    Optional; name of the client that submitted the data for this disc\n\n  info['revision']\n    Optional; revision of this CDDB entry\n\n  info['DYEAR']\n    Optional; year this disc was released\n\n  info['DGENRE']\n    Optional; Genre string describing this disc\n\n  Note that aside from TTITLE#, most of these fields will be empty\n  strings for most discs. Also, submitted_via and revision are\n  technically in the comments returned from the server, so may or\n  may not even be there. Test first!\n\n  As with CDDB.query(), server_url, user, host, client_name, and\n  client_version are all optional. See above for the defaults.\n\ncdrommodule.so\n--------------\n\n  This is the platform-specific part of the trio. I have included\n  unix/cdrommodule.c, which implements the necessary functions under\n  Linux, FreeBSD, OpenBSD, Mac OS X, and Solaris, but the interface is\n  intended to be easy enough to implement on any platform.\n\n  If you want to write your own cdrommodule.so for your platform,\n  here are the functions you'll need to export:\n\n  device = cdrom.open([device], [flags])\n    If given no arguments, perform the proper platform-specific\n    steps to open the default CDROM audio device and return an opened\n    Python file object corresponding to it.\n\n    If called with one argument, override the default CDROM audio\n    device with this argument.  If called with two arguments, open\n    the device with the specified flags (integer on *nix, string on\n    Windows.)\n\n    On Windows, which does not use an opened file object to represent\n    the CDROM audio device, returning a string describing the device\n    is acceptable, as the other functions will just use that instead\n    of the opened file.\n\n  (first, last) = cdrom.toc_header(file)\n    Given an open file object corresponding to a CD-ROM device,\n    return a tuple of two integer values, (first, last). These are the\n    track numbers of the first and last tracks, respectively.\n\n  (min, sec, frame) = cdrom.toc_entry(file, track)\n    Given an open file object and a track number, return a tuple\n    of three integer values, (minute, second, frame). These correspond\n    to the start time of the track, as given in MSF form. Note that\n    a frame is simply 1/75th of a second.\n\n  (min, sec, frame) = cdrom.leadout(file)\n    Given an open file object, return a tuple of three integer values,\n    (minute, second, frame). These correspond to the start time of\n    the special 'leadout' track, generally track 0xAA, as given in\n    MSF form.\n\n    If your platform (i.e. Windows) cannot return this leadout\n    track's time directly, you'll need to calculate it by taking the\n    starting position of the last track and adding the length of the\n    last track onto that. Watch out, because Windows' awful interface\n    returns the length of the last track as one frame short of the\n    real value!\n\n  Note that I throw the exception 'cdrom.error' upon an error;\n  you should stick to throwing that if your ioctls (or whatever\n  your platform uses) fail, so we can stay consistant.\n\n  It's relatively easy to write your own cdrommodule.so for whatever\n  platform you're on. Look at unix/cdrommodule.c for hints. If you\n  end up doing it and you'd like to have your module included in\n  the source distribution, just contact me at the email address\n  above.\n\n  Thanks to Viktor Fougstedt \u003cviktor@dtek.chalmers.se\u003e for the porting\n  information for Solaris, and Michael Yoon \u003cmichael@yoon.org\u003e for the\n  FreeBSD port!\n\n  Also, thanks to Frank David \u003cF.David@digitecgmbh.de\u003e for the win32\n  port.  Note that this email address seems to be gone; I have no more\n  contact with Frank.  Mike Roberts \u003czoarre@yahoo.com\u003e has been extremely\n  helpful in providing an updated mci.dll for Python 2.0; thank you,\n  Mike!\n\n  And thanks to Alexander S . Guy \u003ca7r@andern.org\u003e for the OpenBSD\n  patch.\n\n  Finally, thanks to Andre Beckedorf and Jeffrey C. Jacobs for the\n  Mac OS X cdrommodule.c port.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreso%2Fcddb-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreso%2Fcddb-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreso%2Fcddb-py/lists"}