2020-01-28 Fred Gleason <fredg@paravelsystems.com>

* Added a 'libmusicbrainz5' dependency.
	* Added a 'libdiscid' dependency.
	* Added a 'readcd_test' test harness.
This commit is contained in:
Fred Gleason
2020-01-28 17:26:09 -05:00
parent 35fdeeef2d
commit f036872fd6
56 changed files with 340 additions and 168 deletions

View File

@@ -1,6 +1,6 @@
## Makefile.am
##
## (C) Copyright 2002-2006,2018 Fred Gleason <fredg@paravelsystems.com>
## (C) Copyright 2002-2020 Fred Gleason <fredg@paravelsystems.com>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License version 2 as
@@ -18,7 +18,7 @@
##
## Use automake to process this into a Makefile.in
AM_CPPFLAGS = -Wall -I$(top_srcdir)/lib @QT4_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support
AM_CPPFLAGS = -Wall -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support
LIBS = -L$(top_srcdir)/lib
MOC = @QT_MOC@
@@ -40,6 +40,7 @@ noinst_PROGRAMS = audio_convert_test\
mcast_recv_test\
notification_test\
rdxml_parse_test\
readcd_test\
reserve_carts_test\
stringcode_test\
test_hash\
@@ -49,71 +50,74 @@ noinst_PROGRAMS = audio_convert_test\
wav_chunk_test
dist_audio_convert_test_SOURCES = audio_convert_test.cpp audio_convert_test.h
audio_convert_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
audio_convert_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
dist_audio_export_test_SOURCES = audio_export_test.cpp audio_export_test.h
audio_export_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
audio_export_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
dist_audio_import_test_SOURCES = audio_import_test.cpp audio_import_test.h
audio_import_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
audio_import_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
dist_audio_metadata_test_SOURCES = audio_metadata_test.cpp audio_metadata_test.h
audio_metadata_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
audio_metadata_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
dist_audio_peaks_test_SOURCES = audio_peaks_test.cpp audio_peaks_test.h
audio_peaks_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
audio_peaks_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
dist_datedecode_test_SOURCES = datedecode_test.cpp datedecode_test.h
datedecode_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
datedecode_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
dist_dateparse_test_SOURCES = dateparse_test.cpp dateparse_test.h
dateparse_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
dateparse_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
dist_db_charset_test_SOURCES = db_charset_test.cpp db_charset_test.h
db_charset_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
db_charset_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
dist_download_test_SOURCES = download_test.cpp download_test.h
download_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
download_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
dist_getpids_test_SOURCES = getpids_test.cpp getpids_test.h
getpids_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
getpids_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
dist_log_unlink_test_SOURCES = log_unlink_test.cpp log_unlink_test.h
nodist_log_unlink_test_SOURCES = moc_log_unlink_test.cpp
log_unlink_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
log_unlink_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
dist_mcast_recv_test_SOURCES = mcast_recv_test.cpp mcast_recv_test.h
nodist_mcast_recv_test_SOURCES = moc_mcast_recv_test.cpp
mcast_recv_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
mcast_recv_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
dist_notification_test_SOURCES = notification_test.cpp notification_test.h
nodist_notification_test_SOURCES = moc_notification_test.cpp
notification_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
notification_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
dist_rdxml_parse_test_SOURCES = rdxml_parse_test.cpp rdxml_parse_test.h
rdxml_parse_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
rdxml_parse_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
dist_readcd_test_SOURCES = readcd_test.cpp readcd_test.h
readcd_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
dist_reserve_carts_test_SOURCES = reserve_carts_test.cpp reserve_carts_test.h
reserve_carts_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
reserve_carts_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
dist_stringcode_test_SOURCES = stringcode_test.cpp stringcode_test.h
stringcode_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
stringcode_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
dist_test_hash_SOURCES = test_hash.cpp test_hash.h
test_hash_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
test_hash_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
dist_test_pam_SOURCES = test_pam.cpp test_pam.h
test_pam_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
test_pam_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
dist_timer_test_SOURCES = timer_test.cpp timer_test.h
nodist_timer_test_SOURCES = moc_timer_test.cpp
timer_test_LDADD = @QT4_LIBS@ -lQt3Support
timer_test_LDADD = @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
dist_upload_test_SOURCES = upload_test.cpp upload_test.h
upload_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
upload_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
dist_wav_chunk_test_SOURCES = wav_chunk_test.cpp wav_chunk_test.h
wav_chunk_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
wav_chunk_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
EXTRA_DIST = rivendell_standard.txt\
visualtraffic.txt

113
tests/readcd_test.cpp Normal file
View File

@@ -0,0 +1,113 @@
// readcd_test.cpp
//
// Test the Rivendell CD reader routines
//
// (C) Copyright 2013-2020 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <stdlib.h>
#include <stdio.h>
#include <qapplication.h>
#include <discid/discid.h>
#include <rdcmd_switch.h>
#include "readcd_test.h"
MainObject::MainObject(QObject *parent)
:QObject(parent)
{
QString device="";
bool extended=false;
//
// Read Command Options
//
RDCmdSwitch *cmd=
new RDCmdSwitch(qApp->argc(),qApp->argv(),"readcd_test",
READCD_TEST_USAGE);
for(unsigned i=0;i<cmd->keys();i++) {
if(cmd->key(i)=="--device") {
device=cmd->value(i);
cmd->setProcessed(i,true);
}
if(cmd->key(i)=="--extended") {
extended=true;
cmd->setProcessed(i,true);
}
if(!cmd->processed(i)) {
fprintf(stderr,"readcd_test: unknown option \"%s\"\n",
(const char *)cmd->key(i));
exit(1);
}
}
if(device.isEmpty()) {
fprintf(stderr,"readcd_test: you must specify a CD device\n");
exit(1);
}
//
// Read the disc
//
DiscId *disc=discid_new();
if(extended) {
if(discid_read(disc,device.toUtf8())==0) {
fprintf(stderr,"readcd_test: discid error [%s]\n",
discid_get_error_msg(disc));
exit(1);
}
}
else {
if(discid_read_sparse(disc,device.toUtf8(),0)==0) {
fprintf(stderr,"readcd_test: discid error [%s]\n",
discid_get_error_msg(disc));
exit(1);
}
}
//
// Print Results
//
printf(" FreeDB DiscID: %s\n",discid_get_freedb_id(disc));
printf(" MusicBrainz DiscID: %s\n",discid_get_id(disc));
printf("MusicBrainz Submission URL: %s\n",discid_get_submission_url(disc));
printf("Media Catalog Number (MCN): %s\n",discid_get_mcn(disc));
if(extended) {
int first=discid_get_first_track_num(disc);
int last=discid_get_last_track_num(disc);
for(int i=first;i<=last;i++) {
printf(" Track %02d ISRC: %s\n",i,
discid_get_track_isrc(disc,i));
}
}
//
// Cleanup
//
discid_free(disc);
exit(0);
}
int main(int argc,char *argv[])
{
QApplication a(argc,argv,false);
new MainObject();
return a.exec();
}

35
tests/readcd_test.h Normal file
View File

@@ -0,0 +1,35 @@
// readcd_test.h
//
// Test the Rivendell CD reader routines
//
// (C) Copyright 2013-2020 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#ifndef READCD_TEST_H
#define READCD_TEST_H
#include <qobject.h>
#define READCD_TEST_USAGE "[options]\n\nTest the Rivendell CD reading routines\n\nOptions are:\n--device\n CD reader device\n\n--extended\n Attempt to read extended per-track data\n\n"
class MainObject : public QObject
{
public:
MainObject(QObject *parent=0);
};
#endif // READCD_TEST_H