# HG changeset patch # User Calin Crisan ccrisan@gmail.com # Date 1194045836 -7200 # Node ID 04421592e6a31fd8f764cf24fb7c9986f1af23fa # Parent cf20f1bd2f1e97b9bbabd05d71aac5e41b76b1a3 Fixed an unexpected cddb error messaje when no cddb info is available diff -r cf20f1bd2f1e -r 04421592e6a3 src/cdaudio-ng/cdaudio-ng.c --- a/src/cdaudio-ng/cdaudio-ng.c Thu Nov 01 21:20:20 2007 +0100 +++ b/src/cdaudio-ng/cdaudio-ng.c Sat Nov 03 01:23:56 2007 +0200 @@ -17,7 +17,6 @@ */ /* TODO (added by ccr) - * - DAE seems to be always used, does analog mode work at all? * - maybe make CDDB lib optional? * - use_cddb/use_cdtext don't seem to be checked in all necessary places. why? */ @@ -405,20 +404,28 @@ pcddb_disc = NULL; } else { - CDDEBUG("discid = %X, category = \"%s\"\n", cddb_disc_get_discid(pcddb_disc), cddb_disc_get_category_str(pcddb_disc)); - - cddb_read(pcddb_conn, pcddb_disc); - if (cddb_errno(pcddb_conn) != CDDB_ERR_OK) { - fprintf(stderr, "cdaudio-ng: failed to read the cddb info: %s\n", cddb_error_str(cddb_errno(pcddb_conn))); + if (!strcmp(cddb_disc_get_category_str(pcddb_disc), "invalid")) { + CDDEBUG("no cddb info available for this disc\n"); + cddb_disc_destroy(pcddb_disc); pcddb_disc = NULL; } else { - CDDEBUG("we have got the cddb info\n"); - cdaudio_set_strinfo(&trackinfo[0], - cddb_disc_get_artist(pcddb_disc), - cddb_disc_get_title(pcddb_disc), - cddb_disc_get_genre(pcddb_disc)); + CDDEBUG("discid = %X, category = \"%s\"\n", cddb_disc_get_discid(pcddb_disc), cddb_disc_get_category_str(pcddb_disc)); + + cddb_read(pcddb_conn, pcddb_disc); + if (cddb_errno(pcddb_conn) != CDDB_ERR_OK) { + cdaudio_error("failed to read the cddb info: %s\n", cddb_error_str(cddb_errno(pcddb_conn))); + cddb_disc_destroy(pcddb_disc); + pcddb_disc = NULL; + } + else { + CDDEBUG("we have got the cddb info\n"); + cdaudio_set_strinfo(&trackinfo[0], + cddb_disc_get_artist(pcddb_disc), + cddb_disc_get_title(pcddb_disc), + cddb_disc_get_genre(pcddb_disc)); + } } } } @@ -725,7 +732,7 @@ else { cdio_audio_volume_t volume = {{l, r, 0, 0}}; if (cdio_audio_set_volume(pcdio, &volume) != DRIVER_OP_SUCCESS) { - fprintf(stderr, "cdaudio-ng: failed to set analog cd volume\n"); + cdaudio_error("cdaudio-ng: failed to set analog cd volume\n"); cleanup_on_error(); return FALSE; }