Browse Source
2020-01-28 Fred Gleason <fredg@paravelsystems.com>
2020-01-28 Fred Gleason <fredg@paravelsystems.com>
* Added a 'libmusicbrainz5' dependency. * Added a 'libdiscid' dependency. * Added a 'readcd_test' test harness.pull/537/head
56 changed files with 340 additions and 168 deletions
-
1.gitignore
-
4ChangeLog
-
8INSTALL
-
5cae/Makefile.am
-
7configure.ac
-
14importers/Makefile.am
-
2lib/Makefile.am
-
4rdadmin/Makefile.am
-
4rdairplay/Makefile.am
-
6rdcartslots/Makefile.am
-
6rdcastmanager/Makefile.am
-
6rdcatch/Makefile.am
-
4rdcatchd/Makefile.am
-
6rdlibrary/Makefile.am
-
6rdlogedit/Makefile.am
-
6rdlogin/Makefile.am
-
6rdlogmanager/Makefile.am
-
6rdmonitor/Makefile.am
-
6rdpadd/Makefile.am
-
6rdpadengined/Makefile.am
-
6rdpanel/Makefile.am
-
6rdrepld/Makefile.am
-
6rdselect/Makefile.am
-
6rdservice/Makefile.am
-
6rdvairplayd/Makefile.am
-
5ripcd/Makefile.am
-
50tests/Makefile.am
-
113tests/readcd_test.cpp
-
35tests/readcd_test.h
-
6utils/rdalsaconfig/Makefile.am
-
6utils/rdcheckcuts/Makefile.am
-
6utils/rdcleandirs/Makefile.am
-
6utils/rdclilogedit/Makefile.am
-
6utils/rdcollect/Makefile.am
-
6utils/rdconvert/Makefile.am
-
6utils/rddbconfig/Makefile.am
-
6utils/rddbmgr/Makefile.am
-
6utils/rddelete/Makefile.am
-
6utils/rddgimport/Makefile.am
-
6utils/rddiscimport/Makefile.am
-
6utils/rdexport/Makefile.am
-
6utils/rdgpimon/Makefile.am
-
6utils/rdimport/Makefile.am
-
6utils/rdmaint/Makefile.am
-
6utils/rdmarkerset/Makefile.am
-
6utils/rdmetadata/Makefile.am
-
6utils/rdpopup/Makefile.am
-
6utils/rdpurgecasts/Makefile.am
-
6utils/rdrender/Makefile.am
-
6utils/rdselect_helper/Makefile.am
-
6utils/rdsoftkeys/Makefile.am
-
6utils/rmlsend/Makefile.am
-
6web/rdcastmanager/Makefile.am
-
6web/rdfeed/Makefile.am
-
6web/rdxport/Makefile.am
-
6web/webget/Makefile.am
@ -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(); |
|||
} |
@ -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 |