2017-05-11 Fred Gleason <fredg@paravelsystems.com>

* Added a workaround for icedax(1)'s idiotic user prompt in
	'lib/rdcddblookup.cpp' to prevent freezes when attempting to read
	CD-TEXT.
This commit is contained in:
Fred Gleason 2017-05-11 08:17:04 -04:00
parent 9a6d82c7aa
commit 655d4c37a3
2 changed files with 34 additions and 5 deletions

View File

@ -15767,3 +15767,7 @@
last modified datestamp. last modified datestamp.
2017-05-10 Fred Gleason <fredg@paravelsystems.com> 2017-05-10 Fred Gleason <fredg@paravelsystems.com>
* Incremented the package version to 2.15.3int05. * Incremented the package version to 2.15.3int05.
2017-05-11 Fred Gleason <fredg@paravelsystems.com>
* Added a workaround for icedax(1)'s idiotic user prompt in
'lib/rdcddblookup.cpp' to prevent freezes when attempting to read
CD-TEXT.

View File

@ -24,6 +24,7 @@
#include <qtimer.h> #include <qtimer.h>
#include <qregexp.h> #include <qregexp.h>
#include <qdatetime.h> #include <qdatetime.h>
#include <qprocess.h>
#include <rdcddblookup.h> #include <rdcddblookup.h>
#include <rdprofile.h> #include <rdprofile.h>
@ -320,7 +321,6 @@ int RDCddbLookup::GetIndex(QString *tag)
bool RDCddbLookup::ReadCdText(const QString &cdda_dir,const QString &cdda_dev) bool RDCddbLookup::ReadCdText(const QString &cdda_dir,const QString &cdda_dev)
{ {
int err=0;
RDProfile *title_profile=new RDProfile(); RDProfile *title_profile=new RDProfile();
bool ret=false; bool ret=false;
QString str; QString str;
@ -329,12 +329,37 @@ bool RDCddbLookup::ReadCdText(const QString &cdda_dir,const QString &cdda_dev)
// //
// Write the Track Title Data to a Temp File // Write the Track Title Data to a Temp File
// //
cmd=QString().sprintf("CURDIR=`pwd`;cd %s;cdda2wav -D %s --info-only -v titles 2> /dev/null;cd $CURDIR", QByteArray output;
(const char *)cdda_dir, QProcess *proc=new QProcess(this);
(const char *)cdda_dev); proc->addArgument("cdda2wav");
if((err=system(cmd))!=0) { proc->addArgument("-D");
proc->addArgument(cdda_dev);
proc->addArgument("--info-only");
proc->addArgument("-v");
proc->addArgument("titles");
proc->setWorkingDirectory(cdda_dir);
if(!proc->start()) {
delete proc;
return false; return false;
} }
while(proc->isRunning()) {
output=proc->readStderr();
if(output.size()>0) { // Work around icedax(1)'s idiotic user prompt
if(strncmp(output,"load cdrom please and press enter",33)==0) {
printf("icedax killed!\n");
proc->kill();
delete proc;
return false;
}
printf("icedax spinning...\n");
}
}
if((!proc->normalExit())||(proc->exitStatus()!=0)) {
delete proc;
return false;
}
delete proc;
printf("icedax success!\n");
// //
// Read the Track Title Data File // Read the Track Title Data File