GithubHelp home page GithubHelp logo

taem / cd-discid Goto Github PK

View Code? Open in Web Editor NEW
19.0 19.0 4.0 60 KB

cd-discid is a backend utility to get CDDB discid information from a CD-ROM disc

Home Page: http://linukz.org/cd-discid.shtml

License: GNU General Public License v2.0

C 83.50% Makefile 5.63% Groff 10.88%

cd-discid's People

Contributors

dunn avatar scop avatar taem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cd-discid's Issues

IRIX support

The patch below adds support for IRIX to cd-discid:

diff -ur ./cd-discid.c ../../cd-discid-1.4//cd-discid.c
--- ./cd-discid.c   Tue May 14 11:02:00 CEST 2013
+++ ../../cd-discid-1.4//cd-discid.c    Sun May 22 18:39:33 CEST 2016
@@ -95,6 +95,19 @@
 #define cdte_track_address      trackStartAddress
 #define DEVICE_NAME             "/dev/disk1"

+#elif defined(__sgi)
+#include <dmedia/cdaudio.h>
+#define CD_FRAMES               75               /* per second */
+#define CD_MSF_OFFSET           150              /* MSF offset of first frame */
+#define cdrom_tochdr            CDSTATUS
+#define cdth_trk0               first
+#define cdth_trk1               last
+#define close                   CDclose
+struct cdrom_tocentry 
+{
+        int cdte_track_address      ;
+};
+#define DEVICE_NAME             "/dev/scsi/sc0d4l0"
 #else
 #error "Your OS isn't supported yet."
 #endif  /* os selection */
@@ -127,13 +140,20 @@
 int main(int argc, char *argv[])
 {
    int len;
-   int drive, i, totaltime;
+   int i, totaltime;
    long int cksum = 0;
    int musicbrainz = 0;
    unsigned char first = 1, last = 1;
    char *devicename = DEVICE_NAME;
-   struct cdrom_tochdr hdr;
    struct cdrom_tocentry *TocEntry;
+#ifndef __sgi
+   int drive;
+   struct cdrom_tochdr hdr;
+#else
+   CDPLAYER *drive;
+   CDTRACKINFO info;
+   cdrom_tochdr hdr;
+#endif
    char *command = argv[0];

 #if defined(__OpenBSD__) || defined(__NetBSD__)
@@ -162,8 +182,13 @@
        exit(EXIT_FAILURE);
    }

+#if defined(__sgi)
+   drive = CDopen(devicename, "r");
+   if (drive == 0) {
+#else
    drive = open(devicename, O_RDONLY | O_NONBLOCK);
    if (drive < 0) {
+#endif
        fprintf(stderr, "%s: %s: ", command, devicename);
        perror("open");
        exit(EXIT_FAILURE);
@@ -179,6 +204,11 @@
        perror("DKIOCCDREADDISCINFO");
        exit(EXIT_FAILURE);
    }
+#elif defined(__sgi)
+   if (0 == CDgetstatus(drive, &hdr)) {
+       perror("CDROMREADTOCHDR");
+       exit(EXIT_FAILURE);
+   }
 #else
    if (ioctl(drive, CDROMREADTOCHDR, &hdr) < 0) {
        fprintf(stderr, "%s: %s: ", command, devicename);
@@ -238,6 +268,14 @@
     */
    TocEntry[last].cdte_track_address = TocEntry[last - 1].trackSize +
        TocEntry[last - 1].trackStartAddress;
+#elif defined(__sgi)
+   for (i = 0; i < last; i++) {
+       if (0 == CDgettrackinfo(drive, i + 1, &info)) {
+           fprintf(stderr, "CDgettrackinfo failed on track %i: %s\n", i + 1, devicename);
+       }
+       TocEntry[i].cdte_track_address = info.start_min*60*CD_FRAMES  + info.start_sec*CD_FRAMES + info.start_frame;
+   }
+   TocEntry[last].cdte_track_address = TocEntry[last - 1].cdte_track_address + info.total_min*60*CD_FRAMES + info.total_sec*CD_FRAMES + info.total_frame;
 #else   /* FreeBSD, Linux, Solaris */
    for (i = 0; i < last; i++) {
        /* tracks start with 1, but I must start with 0 on OpenBSD */

Producing bad TOCs?

Trying to use it together with cddb_query (from libcddb) gives an error:

freso@kotake> cd-discid --version
cd-discid 1.4.
freso@kotake> cd-discid
60100919 25 150 13455 23860 35583 43712 52994 66828 77283 86154 105083 120642 130551 143796 158474 170604 182849 198225 210288 221351 231534 242998 261047 27
3360 284556 295670 4107
freso@kotake> cddb_query calc $(cd-discid)

error: track count is 25, but 26 frame offset(s) specified

--musicbrainz option which outputs a TOC

I.e. I get this correct FreeDB-ID:
38098c05

If I do: cd-discid --musicbrainz /dev/sr1 , I get:
5 183 51735 90810 126230 165433 183465

This TOC couldn't be found here, if you give in (FreeDB-ID:) 38098c05 (you will find 6 CDs)
https://musicbrainz.org/search

My own code in a windows program finds it normally at FreeDB this way (and via Telnet):
cddb query 38098c05 5 183 51735 90810 126230 165433 2445

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.