mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-22 07:39:35 +02:00
2020-01-29 Fred Gleason <fredg@paravelsystems.com>
* Refactored the 'RDCddbLookup' class into 'RDCddbLookup' and 'RDDiscLookup'.
This commit is contained in:
parent
73c588369c
commit
729fef66bc
@ -19440,3 +19440,6 @@
|
||||
* Added a 'readcd_test' test harness.
|
||||
2020-01-29 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Moved MCN to extended attributes in the 'readcd_test' harness.
|
||||
2020-01-29 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Refactored the 'RDCddbLookup' class into 'RDCddbLookup' and
|
||||
'RDDiscLookup'.
|
||||
|
@ -111,6 +111,7 @@ dist_librd_la_SOURCES = dbversion.h\
|
||||
rddeck.cpp rddeck.h\
|
||||
rddelete.cpp rddelete.h\
|
||||
rddialog.cpp rddialog.h\
|
||||
rddisclookup.cpp rddisclookup.h\
|
||||
rddownload.cpp rddownload.h\
|
||||
rddropbox.cpp rddropbox.h\
|
||||
rdedit_audio.cpp rdedit_audio.h\
|
||||
@ -272,6 +273,7 @@ nodist_librd_la_SOURCES = moc_rdadd_cart.cpp\
|
||||
moc_rddbheartbeat.cpp\
|
||||
moc_rddelete.cpp\
|
||||
moc_rddialog.cpp\
|
||||
moc_rddisclookup.cpp\
|
||||
moc_rddownload.cpp\
|
||||
moc_rdedit_audio.cpp\
|
||||
moc_rdedit_panel_name.cpp\
|
||||
|
@ -1232,17 +1232,13 @@ ze &souboru</translation>
|
||||
<source>CDDB Query</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Multiple Matches Found!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OK</source>
|
||||
<translation type="unfinished">OK</translation>
|
||||
<translation type="obsolete">OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">Zrušit</translation>
|
||||
<translation type="obsolete">Zrušit</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -1223,17 +1223,13 @@ senden</translation>
|
||||
<source>CDDB Query</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Multiple Matches Found!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OK</source>
|
||||
<translation type="unfinished">OK</translation>
|
||||
<translation type="obsolete">OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">Abbrechen</translation>
|
||||
<translation type="obsolete">Abbrechen</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -1223,17 +1223,9 @@ Color</translation>
|
||||
<source>CDDB Query</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Multiple Matches Found!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OK</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">Cancelar</translation>
|
||||
<translation type="obsolete">Cancelar</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -1073,18 +1073,6 @@ La Couleur</translation>
|
||||
<source>CDDB Query</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Multiple Matches Found!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OK</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDCueEdit</name>
|
||||
|
@ -1222,17 +1222,9 @@ farge</translation>
|
||||
<source>CDDB Query</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Multiple Matches Found!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OK</source>
|
||||
<translation type="unfinished">OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation type="obsolete">OK</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -1222,17 +1222,9 @@ farge</translation>
|
||||
<source>CDDB Query</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Multiple Matches Found!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OK</source>
|
||||
<translation type="unfinished">OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation type="obsolete">OK</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -1223,17 +1223,13 @@ Cor</translation>
|
||||
<source>CDDB Query</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Multiple Matches Found!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OK</source>
|
||||
<translation type="unfinished">OK</translation>
|
||||
<translation type="obsolete">OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">Cancelar</translation>
|
||||
<translation type="obsolete">Cancelar</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// A Qt class for accessing the FreeDB CD Database.
|
||||
//
|
||||
// (C) Copyright 2003-2019 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2003-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 Library General Public License
|
||||
@ -26,42 +26,18 @@
|
||||
#include <qdatetime.h>
|
||||
#include <q3process.h>
|
||||
|
||||
#include <rdcddblookup.h>
|
||||
#include <rdprofile.h>
|
||||
#include "rdapplication.h"
|
||||
#include "rdcddblookup.h"
|
||||
#include "rdprofile.h"
|
||||
|
||||
RDCddbLookup::RDCddbLookup(const QString &caption,FILE *profile_msgs,
|
||||
QWidget *parent)
|
||||
: RDDialog(parent)
|
||||
: RDDiscLookup(caption,profile_msgs,parent)
|
||||
{
|
||||
lookup_state=0;
|
||||
lookup_profile_msgs=profile_msgs;
|
||||
|
||||
//
|
||||
// Get the Hostname
|
||||
//
|
||||
if(getenv("HOSTNAME")==NULL) {
|
||||
lookup_hostname=RDCDDBLOOKUP_DEFAULT_HOSTNAME;
|
||||
}
|
||||
else {
|
||||
lookup_hostname=getenv("HOSTNAME");
|
||||
}
|
||||
|
||||
setWindowTitle(caption+" - "+tr("CDDB Query"));
|
||||
|
||||
lookup_titles_label=new QLabel(tr("Multiple Matches Found!"),this);
|
||||
lookup_titles_label->setAlignment(Qt::AlignCenter|Qt::AlignVCenter);
|
||||
lookup_titles_label->setFont(labelFont());
|
||||
|
||||
lookup_titles_box=new QComboBox(this);
|
||||
|
||||
lookup_ok_button=new QPushButton(tr("OK"),this);
|
||||
lookup_ok_button->setFont(buttonFont());
|
||||
connect(lookup_ok_button,SIGNAL(clicked()),this,SLOT(okData()));
|
||||
|
||||
lookup_cancel_button=new QPushButton(tr("Cancel"),this);
|
||||
lookup_cancel_button->setFont(buttonFont());
|
||||
connect(lookup_cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));
|
||||
|
||||
//
|
||||
// Socket
|
||||
//
|
||||
@ -78,72 +54,19 @@ RDCddbLookup::~RDCddbLookup()
|
||||
}
|
||||
|
||||
|
||||
QSize RDCddbLookup::sizeHint() const
|
||||
void RDCddbLookup::lookupRecord()
|
||||
{
|
||||
return QSize(400,120);
|
||||
}
|
||||
|
||||
|
||||
void RDCddbLookup::setCddbRecord(RDCddbRecord *rec)
|
||||
{
|
||||
lookup_record=rec;
|
||||
}
|
||||
|
||||
|
||||
void RDCddbLookup::lookupRecord(const QString &cdda_dir,const QString &cdda_dev,
|
||||
const QString &hostname,Q_UINT16 port,
|
||||
const QString &username,const QString &appname,
|
||||
const QString &appver)
|
||||
{
|
||||
if(lookup_record->tracks()==0) {
|
||||
if(cddbRecord()->tracks()==0) {
|
||||
return;
|
||||
}
|
||||
|
||||
lookup_username=username;
|
||||
lookup_appname=appname;
|
||||
lookup_appver=appver;
|
||||
lookup_username=rda->user()->name();
|
||||
lookup_hostname=rda->libraryConf()->cddbServer();
|
||||
lookup_appname="rivendell";
|
||||
lookup_appver=VERSION;
|
||||
|
||||
Profile("starting CD-TEXT lookup");
|
||||
if(!cdda_dir.isEmpty()) {
|
||||
if(ReadCdText(cdda_dir,cdda_dev)) {
|
||||
emit done(RDCddbLookup::ExactMatch);
|
||||
Profile("CD-TEXT lookup success");
|
||||
return;
|
||||
}
|
||||
}
|
||||
Profile("CD-TEXT lookup failure");
|
||||
|
||||
Profile("starting CDDB lookup");
|
||||
if(!hostname.isEmpty()) {
|
||||
//
|
||||
// Set Up Default User
|
||||
//
|
||||
if(lookup_username.isEmpty()) {
|
||||
if(getenv("USER")==NULL) {
|
||||
lookup_username=RDCDDBLOOKUP_DEFAULT_USER;
|
||||
}
|
||||
else {
|
||||
lookup_username=getenv("USER");
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Get the Hostname
|
||||
//
|
||||
if(getenv("HOSTNAME")==NULL) {
|
||||
lookup_hostname=RDCDDBLOOKUP_DEFAULT_HOSTNAME;
|
||||
}
|
||||
else {
|
||||
lookup_hostname=getenv("HOSTNAME");
|
||||
}
|
||||
lookup_socket->connectToHost(hostname,port);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool RDCddbLookup::readIsrc(const QString &cdda_dir,const QString &cdda_dev)
|
||||
{
|
||||
return ReadIsrcs(cdda_dir,cdda_dev);
|
||||
profile("starting CDDB lookup");
|
||||
lookup_socket->connectToHost(lookup_hostname,RDCDDBLOOKUP_DEFAULT_PORT);
|
||||
}
|
||||
|
||||
|
||||
@ -161,7 +84,7 @@ void RDCddbLookup::readyReadData()
|
||||
|
||||
while(lookup_socket->canReadLine()) {
|
||||
line=QString::fromUtf8(lookup_socket->readLine());
|
||||
Profile("recevied from server: \""+line+"\"");
|
||||
profile("recevied from server: \""+line+"\"");
|
||||
code=line.split(" ").at(0).toInt();
|
||||
switch(lookup_state) {
|
||||
case 0: // Login Banner
|
||||
@ -192,12 +115,12 @@ void RDCddbLookup::readyReadData()
|
||||
case 2: // Protocol Level Response
|
||||
if(code==201) {
|
||||
snprintf(buffer,2048,"cddb query %08x %d",
|
||||
lookup_record->discId(),lookup_record->tracks());
|
||||
for(int i=0;i<lookup_record->tracks();i++) {
|
||||
snprintf(offset,256," %d",lookup_record->trackOffset(i));
|
||||
cddbRecord()->discId(),cddbRecord()->tracks());
|
||||
for(int i=0;i<cddbRecord()->tracks();i++) {
|
||||
snprintf(offset,256," %d",cddbRecord()->trackOffset(i));
|
||||
strcat(buffer,offset);
|
||||
}
|
||||
snprintf(offset,256," %d",lookup_record->discLength()/75);
|
||||
snprintf(offset,256," %d",cddbRecord()->discLength()/75);
|
||||
strcat(buffer,offset);
|
||||
SendToServer(buffer);
|
||||
lookup_state=3;
|
||||
@ -212,18 +135,18 @@ void RDCddbLookup::readyReadData()
|
||||
case 200: // Exact Match
|
||||
f0=line.split(" ");
|
||||
if(f0.size()>=4) {
|
||||
lookup_record->setDiscId(f0[2].toUInt(&ok,16));
|
||||
cddbRecord()->setDiscId(f0[2].toUInt(&ok,16));
|
||||
if(!ok) {
|
||||
FinishCddbLookup(RDCddbLookup::ProtocolError);
|
||||
}
|
||||
lookup_record->setDiscGenre(f0[1]);
|
||||
cddbRecord()->setDiscGenre(f0[1]);
|
||||
f0.erase(f0.begin());
|
||||
f0.erase(f0.begin());
|
||||
f0.erase(f0.begin());
|
||||
lookup_record->setDiscTitle(f0.join(" "));
|
||||
cddbRecord()->setDiscTitle(f0.join(" "));
|
||||
snprintf(buffer,2048,"cddb read %s %08x\n",
|
||||
(const char *)lookup_record->discGenre().utf8(),
|
||||
lookup_record->discId());
|
||||
(const char *)cddbRecord()->discGenre().utf8(),
|
||||
cddbRecord()->discId());
|
||||
SendToServer(buffer);
|
||||
lookup_state=5;
|
||||
}
|
||||
@ -233,8 +156,8 @@ void RDCddbLookup::readyReadData()
|
||||
break;
|
||||
|
||||
case 210: // Multiple Exact Matches
|
||||
lookup_titles_box->clear();
|
||||
lookup_titles_key.clear();
|
||||
titlesBox()->clear();
|
||||
titlesKey()->clear();
|
||||
lookup_state=4;
|
||||
break;
|
||||
|
||||
@ -250,28 +173,28 @@ void RDCddbLookup::readyReadData()
|
||||
|
||||
case 4: // Process Multiple Matches
|
||||
if(line.trimmed()==".") {
|
||||
Profile("Match list complete, showing chooser dialog...");
|
||||
profile("Match list complete, showing chooser dialog...");
|
||||
if(exec()) {
|
||||
f0=lookup_titles_key.at(lookup_titles_box->currentItem()).
|
||||
f0=titlesKey()->at(titlesBox()->currentItem()).
|
||||
split(" ",QString::SkipEmptyParts);
|
||||
if(f0.size()!=2) {
|
||||
FinishCddbLookup(RDCddbLookup::ProtocolError);
|
||||
}
|
||||
lookup_record->setDiscId(f0.at(1).toUInt(&ok,16));
|
||||
cddbRecord()->setDiscId(f0.at(1).toUInt(&ok,16));
|
||||
if(!ok) {
|
||||
FinishCddbLookup(RDCddbLookup::ProtocolError);
|
||||
}
|
||||
lookup_record->setDiscGenre(f0.at(0));
|
||||
f0=lookup_titles_box->currentText().split("/");
|
||||
cddbRecord()->setDiscGenre(f0.at(0));
|
||||
f0=titlesBox()->currentText().split("/");
|
||||
if(f0.size()==2) {
|
||||
lookup_record->setDiscTitle(f0.at(1).trimmed());
|
||||
cddbRecord()->setDiscTitle(f0.at(1).trimmed());
|
||||
}
|
||||
else {
|
||||
lookup_record->setDiscTitle(lookup_titles_box->currentText().trimmed());
|
||||
cddbRecord()->setDiscTitle(titlesBox()->currentText().trimmed());
|
||||
}
|
||||
snprintf(buffer,2048,"cddb read %s %08x\n",
|
||||
(const char *)lookup_record->discGenre().utf8(),
|
||||
lookup_record->discId());
|
||||
(const char *)cddbRecord()->discGenre().utf8(),
|
||||
cddbRecord()->discId());
|
||||
SendToServer(buffer);
|
||||
lookup_state=5;
|
||||
}
|
||||
@ -282,11 +205,11 @@ void RDCddbLookup::readyReadData()
|
||||
else {
|
||||
f0.clear();
|
||||
f0=line.split(" ");
|
||||
lookup_titles_key.push_back(f0.at(0).trimmed()+" "+
|
||||
titlesKey()->push_back(f0.at(0).trimmed()+" "+
|
||||
f0.at(1).trimmed());
|
||||
f0.removeFirst();
|
||||
f0.removeFirst();
|
||||
lookup_titles_box->insertItem(lookup_titles_box->count(),f0.join(" ").trimmed());
|
||||
titlesBox()->insertItem(titlesBox()->count(),f0.join(" ").trimmed());
|
||||
}
|
||||
break;
|
||||
|
||||
@ -306,26 +229,26 @@ void RDCddbLookup::readyReadData()
|
||||
}
|
||||
ParsePair(&line,&tag,&value,&index);
|
||||
if(tag=="DTITLE") {
|
||||
lookup_record->setDiscTitle(value.left(value.length()-1));
|
||||
cddbRecord()->setDiscTitle(value.left(value.length()-1));
|
||||
}
|
||||
if(tag=="DYEAR") {
|
||||
lookup_record->setDiscYear(value.toUInt());
|
||||
cddbRecord()->setDiscYear(value.toUInt());
|
||||
}
|
||||
if(tag=="EXTD") {
|
||||
lookup_record->
|
||||
setDiscExtended(lookup_record->discExtended()+
|
||||
cddbRecord()->
|
||||
setDiscExtended(cddbRecord()->discExtended()+
|
||||
DecodeString(value));
|
||||
}
|
||||
if(tag=="PLAYORDER") {
|
||||
lookup_record->setDiscPlayOrder(value);
|
||||
cddbRecord()->setDiscPlayOrder(value);
|
||||
}
|
||||
if((tag=="TTITLE")&&(index!=-1)) {
|
||||
lookup_record->setTrackTitle(index,value.left(value.length()-1));
|
||||
cddbRecord()->setTrackTitle(index,value.left(value.length()-1));
|
||||
}
|
||||
if((tag=="EXTT")&&(index!=-1)) {
|
||||
lookup_record->
|
||||
cddbRecord()->
|
||||
setTrackExtended(index,
|
||||
lookup_record->trackExtended(index)+value);
|
||||
cddbRecord()->trackExtended(index)+value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -354,39 +277,13 @@ void RDCddbLookup::errorData(QAbstractSocket::SocketError err)
|
||||
}
|
||||
|
||||
|
||||
void RDCddbLookup::okData()
|
||||
{
|
||||
done(true);
|
||||
}
|
||||
|
||||
|
||||
void RDCddbLookup::cancelData()
|
||||
{
|
||||
done(false);
|
||||
}
|
||||
|
||||
|
||||
void RDCddbLookup::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
int w=size().width();
|
||||
int h=size().height();
|
||||
|
||||
lookup_titles_label->setGeometry(15,2,w-30,20);
|
||||
|
||||
lookup_titles_box->setGeometry(10,24,w-20,20);
|
||||
|
||||
lookup_ok_button->setGeometry(w-180,h-60,80,50);
|
||||
lookup_cancel_button->setGeometry(w-90,h-60,80,50);
|
||||
}
|
||||
|
||||
|
||||
void RDCddbLookup::FinishCddbLookup(RDCddbLookup::Result res)
|
||||
{
|
||||
SendToServer("quit");
|
||||
lookup_socket->close();
|
||||
lookup_state=0;
|
||||
emit lookupDone(res);
|
||||
Profile("CDDB lookup finished");
|
||||
profile("CDDB lookup finished");
|
||||
}
|
||||
|
||||
|
||||
@ -438,133 +335,8 @@ int RDCddbLookup::GetIndex(QString *tag)
|
||||
}
|
||||
|
||||
|
||||
bool RDCddbLookup::ReadCdText(const QString &cdda_dir,const QString &cdda_dev)
|
||||
{
|
||||
RDProfile *title_profile=new RDProfile();
|
||||
bool ret=false;
|
||||
QString str;
|
||||
QString cmd;
|
||||
|
||||
//
|
||||
// Write the Track Title Data to a Temp File
|
||||
//
|
||||
QByteArray output;
|
||||
Q3Process *proc=new Q3Process(this);
|
||||
proc->addArgument("cdda2wav");
|
||||
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;
|
||||
}
|
||||
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) {
|
||||
proc->kill();
|
||||
delete proc;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if((!proc->normalExit())||(proc->exitStatus()!=0)) {
|
||||
delete proc;
|
||||
return false;
|
||||
}
|
||||
delete proc;
|
||||
|
||||
//
|
||||
// Read the Track Title Data File
|
||||
//
|
||||
for(int i=0;i<lookup_record->tracks();i++) {
|
||||
title_profile->setSource(cdda_dir+QString().sprintf("/audio_%02d.inf",i+1));
|
||||
str=title_profile->stringValue("","Albumtitle","");
|
||||
str.remove("'");
|
||||
if((!str.isEmpty())&&(str!="''")) {
|
||||
lookup_record->setDiscTitle(str);
|
||||
ret=true;
|
||||
}
|
||||
|
||||
str=title_profile->stringValue("","Albumperformer","");
|
||||
str.remove("'");
|
||||
if((!str.isEmpty())&&(str!="''")) {
|
||||
lookup_record->setDiscArtist(str);
|
||||
ret=true;
|
||||
}
|
||||
|
||||
str=title_profile->stringValue("","Tracktitle","");
|
||||
str.remove("'");
|
||||
if((!str.isEmpty())&&(str!="''")) {
|
||||
lookup_record->setTrackTitle(i,str);
|
||||
ret=true;
|
||||
}
|
||||
|
||||
str=title_profile->stringValue("","Performer","");
|
||||
str.remove("'");
|
||||
if((!str.isEmpty())&&(str!="''")) {
|
||||
lookup_record->setTrackArtist(i,str);
|
||||
ret=true;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool RDCddbLookup::ReadIsrcs(const QString &cdda_dir,const QString &cdda_dev)
|
||||
{
|
||||
int err=0;
|
||||
RDProfile *title_profile=new RDProfile();
|
||||
RDProfile *isrc_profile=new RDProfile();
|
||||
bool ret=false;
|
||||
QString str;
|
||||
QString cmd;
|
||||
|
||||
//
|
||||
// Write the ISRC Data to a Temp File
|
||||
//
|
||||
cmd=QString("CURDIR=`pwd`;cd ")+
|
||||
cdda_dir+";cdda2wav -D "+cdda_dev+
|
||||
" --info-only -v trackid 2> /dev/null;cd $CURDIR";
|
||||
if((err=system(cmd))!=0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Read the ISRC Data File
|
||||
//
|
||||
for(int i=0;i<lookup_record->tracks();i++) {
|
||||
isrc_profile->setSource(cdda_dir+QString().sprintf("/audio_%02d.inf",i+1));
|
||||
str=isrc_profile->stringValue("","ISRC","");
|
||||
str.remove("'");
|
||||
str.remove("-");
|
||||
if((!str.isEmpty())&&(str!="''")) {
|
||||
lookup_record->setIsrc(i,str);
|
||||
ret=true;
|
||||
}
|
||||
}
|
||||
delete title_profile;
|
||||
delete isrc_profile;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void RDCddbLookup::SendToServer(const QString &msg)
|
||||
{
|
||||
lookup_socket->writeBlock(msg+"\n",msg.length()+1);
|
||||
Profile("sent to server: \""+msg+"\"");
|
||||
}
|
||||
|
||||
|
||||
void RDCddbLookup::Profile(const QString &msg)
|
||||
{
|
||||
if(lookup_profile_msgs!=NULL) {
|
||||
printf("%s | RDCddbLookup::%s\n",
|
||||
(const char *)QTime::currentTime().toString("hh:mm:ss.zzz"),
|
||||
(const char *)msg.toUtf8());
|
||||
}
|
||||
profile("sent to server: \""+msg+"\"");
|
||||
}
|
||||
|
@ -30,76 +30,39 @@
|
||||
#include <qstringlist.h>
|
||||
#include <qtcpsocket.h>
|
||||
|
||||
#include <rddisclookup.h>
|
||||
#include <rdcddbrecord.h>
|
||||
#include <rddialog.h>
|
||||
|
||||
//
|
||||
// Default Settings
|
||||
// FreeDB Service Settings
|
||||
//
|
||||
#define RDCDDBLOOKUP_DEFAULT_PORT 8880
|
||||
#define RDCDDBLOOKUP_DEFAULT_USER "libradio"
|
||||
#define RDCDDBLOOKUP_DEFAULT_HOSTNAME "linux"
|
||||
|
||||
/**
|
||||
* @short Lookup CD Data from the FreeDB CD Database
|
||||
* @author Fred Gleason <fredg@paravelsystems.com>
|
||||
*
|
||||
* This class implements an object for accessing a remote FreeDB CD
|
||||
* database server.
|
||||
**/
|
||||
|
||||
class RDCddbLookup : public RDDialog
|
||||
class RDCddbLookup : public RDDiscLookup
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Result {ExactMatch=0,PartialMatch=1,NoMatch=2,
|
||||
ProtocolError=3,NetworkError=4};
|
||||
RDCddbLookup(const QString &caption,FILE *profile_msgs,QWidget *parent=0);
|
||||
~RDCddbLookup();
|
||||
QSize sizeHint() const;
|
||||
void setCddbRecord(RDCddbRecord *);
|
||||
void lookupRecord(const QString &cdda_dir,const QString &cdda_dev,
|
||||
const QString &hostname,
|
||||
Q_UINT16 port=RDCDDBLOOKUP_DEFAULT_PORT,
|
||||
const QString &username="",
|
||||
const QString &appname=PACKAGE_NAME,
|
||||
const QString &ver=VERSION);
|
||||
bool readIsrc(const QString &cdda_dir,const QString &cdda_dev);
|
||||
void lookupRecord();
|
||||
|
||||
private slots:
|
||||
void readyReadData();
|
||||
void errorData(QAbstractSocket::SocketError);
|
||||
void okData();
|
||||
void cancelData();
|
||||
|
||||
signals:
|
||||
void lookupDone(RDCddbLookup::Result);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
|
||||
private:
|
||||
void FinishCddbLookup(RDCddbLookup::Result res);
|
||||
QString DecodeString(QString &str);
|
||||
void ParsePair(QString *line,QString *tag,QString *value,int *index);
|
||||
int GetIndex(QString *tag);
|
||||
bool ReadCdText(const QString &cdda_dir,const QString &cdda_dev);
|
||||
bool ReadIsrcs(const QString &cdda_dir,const QString &cdda_dev);
|
||||
void SendToServer(const QString &msg);
|
||||
void Profile(const QString &msg);
|
||||
QLabel *lookup_titles_label;
|
||||
QComboBox *lookup_titles_box;
|
||||
QStringList lookup_titles_key;
|
||||
QPushButton *lookup_ok_button;
|
||||
QPushButton *lookup_cancel_button;
|
||||
RDCddbRecord *lookup_record;
|
||||
QTcpSocket *lookup_socket;
|
||||
int lookup_state;
|
||||
QString lookup_username;
|
||||
QString lookup_appname;
|
||||
QString lookup_appver;
|
||||
QString lookup_hostname;
|
||||
FILE *lookup_profile_msgs;
|
||||
};
|
||||
|
||||
#endif // RDCDDBLOOKUP_H
|
||||
|
296
lib/rddisclookup.cpp
Normal file
296
lib/rddisclookup.cpp
Normal file
@ -0,0 +1,296 @@
|
||||
// rddisclookup.cpp
|
||||
//
|
||||
// Base class for CD metadata lookup methods
|
||||
//
|
||||
// (C) Copyright 2003-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 Library 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 <string.h>
|
||||
|
||||
#include <qmessagebox.h>
|
||||
#include <qtimer.h>
|
||||
#include <qregexp.h>
|
||||
#include <qdatetime.h>
|
||||
#include <q3process.h>
|
||||
|
||||
#include "rdtempdirectory.h"
|
||||
#include "rddisclookup.h"
|
||||
#include "rdprofile.h"
|
||||
|
||||
RDDiscLookup::RDDiscLookup(const QString &caption,FILE *profile_msgs,
|
||||
QWidget *parent)
|
||||
: RDDialog(parent)
|
||||
{
|
||||
lookup_profile_msgs=profile_msgs;
|
||||
|
||||
lookup_titles_label=new QLabel(tr("Multiple Matches Found!"),this);
|
||||
lookup_titles_label->setAlignment(Qt::AlignCenter|Qt::AlignVCenter);
|
||||
lookup_titles_label->setFont(labelFont());
|
||||
|
||||
lookup_titles_box=new QComboBox(this);
|
||||
|
||||
lookup_ok_button=new QPushButton(tr("OK"),this);
|
||||
lookup_ok_button->setFont(buttonFont());
|
||||
connect(lookup_ok_button,SIGNAL(clicked()),this,SLOT(okData()));
|
||||
|
||||
lookup_cancel_button=new QPushButton(tr("Cancel"),this);
|
||||
lookup_cancel_button->setFont(buttonFont());
|
||||
connect(lookup_cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));
|
||||
|
||||
//
|
||||
// Create Temporary Directory
|
||||
//
|
||||
char path[PATH_MAX];
|
||||
strncpy(path,RDTempDirectory::basePath(),PATH_MAX);
|
||||
strcat(path,"/XXXXXX");
|
||||
if(mkdtemp(path)==NULL) {
|
||||
QMessageBox::warning(this,caption+" - "+tr("Ripper Error"),
|
||||
tr("Unable to create temporary directory!"));
|
||||
}
|
||||
else {
|
||||
lookup_cdda_dir.setPath(path);
|
||||
}
|
||||
profile("created temp directory \""+lookup_cdda_dir.path()+"\"");
|
||||
}
|
||||
|
||||
|
||||
RDDiscLookup::~RDDiscLookup()
|
||||
{
|
||||
QStringList files=lookup_cdda_dir.entryList();
|
||||
for(int i=0;i<files.size();i++) {
|
||||
if((files[i]!=".")&&(files[i]!="..")) {
|
||||
lookup_cdda_dir.remove(files[i]);
|
||||
}
|
||||
}
|
||||
rmdir(lookup_cdda_dir.path());
|
||||
profile("deleted temp directory \""+lookup_cdda_dir.path()+"\"");
|
||||
}
|
||||
|
||||
|
||||
QSize RDDiscLookup::sizeHint() const
|
||||
{
|
||||
return QSize(400,120);
|
||||
}
|
||||
|
||||
|
||||
void RDDiscLookup::setCddbRecord(RDCddbRecord *rec)
|
||||
{
|
||||
lookup_record=rec;
|
||||
}
|
||||
|
||||
|
||||
void RDDiscLookup::lookup()
|
||||
{
|
||||
profile("starting CD-TEXT lookup");
|
||||
if(ReadCdText(lookup_cdda_dir.path(),rda->libraryConf()->ripperDevice())) {
|
||||
emit lookupDone(RDDiscLookup::ExactMatch);
|
||||
profile("CD-TEXT lookup success");
|
||||
return;
|
||||
}
|
||||
profile("CD-TEXT lookup failure");
|
||||
|
||||
lookupRecord();
|
||||
}
|
||||
|
||||
|
||||
bool RDDiscLookup::readIsrc()
|
||||
{
|
||||
return ReadIsrcs(lookup_cdda_dir.path(),rda->libraryConf()->ripperDevice());
|
||||
}
|
||||
|
||||
|
||||
void RDDiscLookup::okData()
|
||||
{
|
||||
done(true);
|
||||
}
|
||||
|
||||
|
||||
void RDDiscLookup::cancelData()
|
||||
{
|
||||
done(false);
|
||||
}
|
||||
|
||||
|
||||
void RDDiscLookup::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
int w=size().width();
|
||||
int h=size().height();
|
||||
|
||||
lookup_titles_label->setGeometry(15,2,w-30,20);
|
||||
|
||||
lookup_titles_box->setGeometry(10,24,w-20,20);
|
||||
|
||||
lookup_ok_button->setGeometry(w-180,h-60,80,50);
|
||||
lookup_cancel_button->setGeometry(w-90,h-60,80,50);
|
||||
}
|
||||
|
||||
|
||||
RDCddbRecord *RDDiscLookup::cddbRecord()
|
||||
{
|
||||
return lookup_record;
|
||||
}
|
||||
|
||||
|
||||
void RDDiscLookup::profile(const QString &msg)
|
||||
{
|
||||
if(lookup_profile_msgs!=NULL) {
|
||||
printf("%s | RDDiscLookup::%s\n",
|
||||
(const char *)QTime::currentTime().toString("hh:mm:ss.zzz"),
|
||||
(const char *)msg.toUtf8());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QComboBox *RDDiscLookup::titlesBox()
|
||||
{
|
||||
return lookup_titles_box;
|
||||
}
|
||||
|
||||
|
||||
QStringList *RDDiscLookup::titlesKey()
|
||||
{
|
||||
return &lookup_titles_key;
|
||||
}
|
||||
|
||||
|
||||
bool RDDiscLookup::ReadCdText(const QString &cdda_dir,const QString &cdda_dev)
|
||||
{
|
||||
RDProfile *title_profile=new RDProfile();
|
||||
bool ret=false;
|
||||
QString str;
|
||||
QString cmd;
|
||||
|
||||
//
|
||||
// Write the Track Title Data to a Temp File
|
||||
//
|
||||
QByteArray output;
|
||||
Q3Process *proc=new Q3Process(this);
|
||||
proc->addArgument("cdda2wav");
|
||||
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;
|
||||
profile("cdda2wav failed to start!");
|
||||
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) {
|
||||
proc->kill();
|
||||
delete proc;
|
||||
profile("cdda2wav returned \""+output+"\", killing it!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!proc->normalExit()) {
|
||||
profile("cdda2wav crashed!");
|
||||
delete proc;
|
||||
return false;
|
||||
}
|
||||
if(proc->exitStatus()!=0) {
|
||||
profile("cdda2wav return exit code "+
|
||||
QString().sprintf("%d",proc->exitStatus()));
|
||||
delete proc;
|
||||
return false;
|
||||
}
|
||||
delete proc;
|
||||
|
||||
//
|
||||
// Read the Track Title Data File
|
||||
//
|
||||
for(int i=0;i<lookup_record->tracks();i++) {
|
||||
title_profile->setSource(cdda_dir+QString().sprintf("/audio_%02d.inf",i+1));
|
||||
str=title_profile->stringValue("","Albumtitle","");
|
||||
str.remove("'");
|
||||
if((!str.isEmpty())&&(str!="''")) {
|
||||
lookup_record->setDiscTitle(str);
|
||||
profile("setting DiscTitle to \""+str+"\"");
|
||||
ret=true;
|
||||
}
|
||||
|
||||
str=title_profile->stringValue("","Albumperformer","");
|
||||
str.remove("'");
|
||||
if((!str.isEmpty())&&(str!="''")) {
|
||||
lookup_record->setDiscArtist(str);
|
||||
profile("setting DiscArtist to \""+str+"\"");
|
||||
ret=true;
|
||||
}
|
||||
|
||||
str=title_profile->stringValue("","Tracktitle","");
|
||||
str.remove("'");
|
||||
if((!str.isEmpty())&&(str!="''")) {
|
||||
lookup_record->setTrackTitle(i,str);
|
||||
profile("setting TrackTitle "+QString().sprintf("%d",i+1)+" to \""+str+"\"");
|
||||
ret=true;
|
||||
}
|
||||
|
||||
str=title_profile->stringValue("","Performer","");
|
||||
str.remove("'");
|
||||
if((!str.isEmpty())&&(str!="''")) {
|
||||
lookup_record->setTrackArtist(i,str);
|
||||
profile("setting TrackArtist "+QString().sprintf("%d",i+1)+" to \""+str+"\"");
|
||||
ret=true;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool RDDiscLookup::ReadIsrcs(const QString &cdda_dir,const QString &cdda_dev)
|
||||
{
|
||||
int err=0;
|
||||
RDProfile *title_profile=new RDProfile();
|
||||
RDProfile *isrc_profile=new RDProfile();
|
||||
bool ret=false;
|
||||
QString str;
|
||||
QString cmd;
|
||||
|
||||
//
|
||||
// Write the ISRC Data to a Temp File
|
||||
//
|
||||
cmd=QString("CURDIR=`pwd`;cd ")+
|
||||
cdda_dir+";cdda2wav -D "+cdda_dev+
|
||||
" --info-only -v trackid 2> /dev/null;cd $CURDIR";
|
||||
if((err=system(cmd))!=0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Read the ISRC Data File
|
||||
//
|
||||
for(int i=0;i<lookup_record->tracks();i++) {
|
||||
isrc_profile->setSource(cdda_dir+QString().sprintf("/audio_%02d.inf",i+1));
|
||||
str=isrc_profile->stringValue("","ISRC","");
|
||||
str.remove("'");
|
||||
str.remove("-");
|
||||
if((!str.isEmpty())&&(str!="''")) {
|
||||
lookup_record->setIsrc(i,str);
|
||||
ret=true;
|
||||
}
|
||||
}
|
||||
delete title_profile;
|
||||
delete isrc_profile;
|
||||
|
||||
return ret;
|
||||
}
|
84
lib/rddisclookup.h
Normal file
84
lib/rddisclookup.h
Normal file
@ -0,0 +1,84 @@
|
||||
// rddisclookup.h
|
||||
//
|
||||
// Base class for CD metadata lookup methods
|
||||
//
|
||||
// (C) Copyright 2003-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 Library 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 RDDISCLOOKUP_H
|
||||
#define RDDISCLOOKUP_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <qcombobox.h>
|
||||
#include <qdir.h>
|
||||
#include <qlabel.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qtcpsocket.h>
|
||||
|
||||
#include <rdcddbrecord.h>
|
||||
#include <rddialog.h>
|
||||
|
||||
class RDDiscLookup : public RDDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Result {ExactMatch=0,PartialMatch=1,NoMatch=2,
|
||||
ProtocolError=3,NetworkError=4};
|
||||
RDDiscLookup(const QString &caption,FILE *profile_msgs,QWidget *parent=0);
|
||||
~RDDiscLookup();
|
||||
QSize sizeHint() const;
|
||||
void setCddbRecord(RDCddbRecord *);
|
||||
void lookup();
|
||||
bool readIsrc();
|
||||
|
||||
signals:
|
||||
void lookupDone(RDDiscLookup::Result);
|
||||
|
||||
protected slots:
|
||||
virtual void lookupRecord()=0;
|
||||
void okData();
|
||||
void cancelData();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
RDCddbRecord *cddbRecord();
|
||||
void profile(const QString &msg);
|
||||
QComboBox *titlesBox();
|
||||
QStringList *titlesKey();
|
||||
|
||||
private:
|
||||
bool ReadCdText(const QString &cdda_dir,const QString &cdda_dev);
|
||||
bool ReadIsrcs(const QString &cdda_dir,const QString &cdda_dev);
|
||||
QLabel *lookup_titles_label;
|
||||
QComboBox *lookup_titles_box;
|
||||
QStringList lookup_titles_key;
|
||||
QPushButton *lookup_ok_button;
|
||||
QPushButton *lookup_cancel_button;
|
||||
RDCddbRecord *lookup_record;
|
||||
QTcpSocket *lookup_socket;
|
||||
int lookup_state;
|
||||
QString lookup_username;
|
||||
QString lookup_appname;
|
||||
QString lookup_appver;
|
||||
QString lookup_hostname;
|
||||
QDir lookup_cdda_dir;
|
||||
FILE *lookup_profile_msgs;
|
||||
};
|
||||
|
||||
#endif // RDDISCLOOKUP_H
|
@ -53,20 +53,6 @@ CdRipper::CdRipper(QString cutname,RDCddbRecord *rec,RDLibraryConf *conf,
|
||||
//
|
||||
setMinimumSize(sizeHint());
|
||||
|
||||
//
|
||||
// Create Temporary Directory
|
||||
//
|
||||
char path[PATH_MAX];
|
||||
strncpy(path,RDTempDirectory::basePath(),PATH_MAX);
|
||||
strcat(path,"/XXXXXX");
|
||||
if(mkdtemp(path)==NULL) {
|
||||
QMessageBox::warning(this,"RDLibrary - "+tr("Ripper Error"),
|
||||
tr("Unable to create temporary directory!"));
|
||||
}
|
||||
else {
|
||||
rip_cdda_dir.setPath(path);
|
||||
}
|
||||
|
||||
//
|
||||
// Target Cut
|
||||
//
|
||||
@ -97,8 +83,8 @@ CdRipper::CdRipper(QString cutname,RDCddbRecord *rec,RDLibraryConf *conf,
|
||||
else {
|
||||
rip_cddb_lookup=new RDCddbLookup("RDLibrary",NULL,this);
|
||||
}
|
||||
connect(rip_cddb_lookup,SIGNAL(lookupDone(RDCddbLookup::Result)),
|
||||
this,SLOT(cddbDoneData(RDCddbLookup::Result)));
|
||||
connect(rip_cddb_lookup,SIGNAL(lookupDone(RDDiscLookup::Result)),
|
||||
this,SLOT(cddbDoneData(RDDiscLookup::Result)));
|
||||
|
||||
//
|
||||
// Title Selector
|
||||
@ -278,14 +264,6 @@ CdRipper::CdRipper(QString cutname,RDCddbRecord *rec,RDLibraryConf *conf,
|
||||
|
||||
CdRipper::~CdRipper()
|
||||
{
|
||||
QStringList files=rip_cdda_dir.entryList();
|
||||
for(int i=0;i<files.size();i++) {
|
||||
if((files[i]!=".")&&(files[i]!="..")) {
|
||||
rip_cdda_dir.remove(files[i]);
|
||||
}
|
||||
}
|
||||
rmdir(rip_cdda_dir.path());
|
||||
|
||||
rip_cdrom->close();
|
||||
delete rip_cdrom;
|
||||
delete rip_track_list;
|
||||
@ -434,7 +412,7 @@ void CdRipper::ripTrackButtonData()
|
||||
//
|
||||
if(!rip_isrc_read) {
|
||||
if(rda->libraryConf()->readIsrc()) {
|
||||
rip_cddb_lookup->readIsrc(rip_cdda_dir.path(),rip_conf->ripperDevice());
|
||||
rip_cddb_lookup->readIsrc();
|
||||
}
|
||||
rip_isrc_read=true;
|
||||
}
|
||||
@ -575,9 +553,7 @@ void CdRipper::mediaChangedData()
|
||||
rip_cdrom->setCddbRecord(rip_cddb_record);
|
||||
rip_cddb_lookup->setCddbRecord(rip_cddb_record);
|
||||
Profile("starting metadata lookup");
|
||||
rip_cddb_lookup->lookupRecord(rip_cdda_dir.path(),rip_conf->ripperDevice(),
|
||||
rip_conf->cddbServer(),8880,
|
||||
RIPPER_CDDB_USER,PACKAGE_NAME,VERSION);
|
||||
rip_cddb_lookup->lookup();
|
||||
Profile("metadata lookup finished");
|
||||
}
|
||||
|
||||
@ -596,10 +572,10 @@ void CdRipper::stoppedData()
|
||||
}
|
||||
|
||||
|
||||
void CdRipper::cddbDoneData(RDCddbLookup::Result result)
|
||||
void CdRipper::cddbDoneData(RDDiscLookup::Result result)
|
||||
{
|
||||
switch(result) {
|
||||
case RDCddbLookup::ExactMatch:
|
||||
case RDDiscLookup::ExactMatch:
|
||||
if(rip_cdrom->status()!=RDCdPlayer::Ok) {
|
||||
return;
|
||||
}
|
||||
@ -618,7 +594,7 @@ void CdRipper::cddbDoneData(RDCddbLookup::Result result)
|
||||
trackSelectionChangedData();
|
||||
break;
|
||||
|
||||
case RDCddbLookup::PartialMatch:
|
||||
case RDDiscLookup::PartialMatch:
|
||||
rip_track[0]=-1;
|
||||
rip_track[1]=-1;
|
||||
printf("Partial Match!\n");
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// CD Ripper Dialog for Rivendell
|
||||
//
|
||||
// (C) Copyright 2002-2019 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
|
||||
@ -57,7 +57,7 @@ class CdRipper : public RDDialog
|
||||
void mediaChangedData();
|
||||
void playedData(int);
|
||||
void stoppedData();
|
||||
void cddbDoneData(RDCddbLookup::Result);
|
||||
void cddbDoneData(RDDiscLookup::Result);
|
||||
void normalizeCheckData(bool);
|
||||
void autotrimCheckData(bool);
|
||||
void closeData();
|
||||
@ -110,7 +110,6 @@ class CdRipper : public RDDialog
|
||||
QLabel *rip_autotrim_unit;
|
||||
bool rip_done;
|
||||
bool rip_profile_rip;
|
||||
QDir rip_cdda_dir;
|
||||
bool rip_isrc_read;
|
||||
};
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// CD Disk Ripper Dialog for Rivendell.
|
||||
//
|
||||
// (C) Copyright 2002-2019 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
|
||||
@ -55,20 +55,6 @@ DiskRipper::DiskRipper(QString *filter,QString *group,QString *schedcode,
|
||||
//
|
||||
rip_wavedata_dialog=new RDWaveDataDialog("RDLibrary",this);
|
||||
|
||||
//
|
||||
// Create Temporary Directory
|
||||
//
|
||||
char path[PATH_MAX];
|
||||
strncpy(path,RDTempDirectory::basePath(),PATH_MAX);
|
||||
strcat(path,"/XXXXXX");
|
||||
if(mkdtemp(path)==NULL) {
|
||||
QMessageBox::warning(this,"RDLibrary - "+tr("Ripper Error"),
|
||||
tr("Unable to create temporary directory!"));
|
||||
}
|
||||
else {
|
||||
rip_cdda_dir.setPath(path);
|
||||
}
|
||||
|
||||
//
|
||||
// The CDROM Drive
|
||||
//
|
||||
@ -94,8 +80,8 @@ DiskRipper::DiskRipper(QString *filter,QString *group,QString *schedcode,
|
||||
else {
|
||||
rip_cddb_lookup=new RDCddbLookup("RDLibrary",NULL,this);
|
||||
}
|
||||
connect(rip_cddb_lookup,SIGNAL(lookupDone(RDCddbLookup::Result)),
|
||||
this,SLOT(cddbDoneData(RDCddbLookup::Result)));
|
||||
connect(rip_cddb_lookup,SIGNAL(lookupDone(RDDiscLookup::Result)),
|
||||
this,SLOT(cddbDoneData(RDDiscLookup::Result)));
|
||||
|
||||
//
|
||||
// Artist Label
|
||||
@ -326,14 +312,6 @@ DiskRipper::DiskRipper(QString *filter,QString *group,QString *schedcode,
|
||||
|
||||
DiskRipper::~DiskRipper()
|
||||
{
|
||||
QStringList files=rip_cdda_dir.entryList();
|
||||
for(int i=0;i<files.size();i++) {
|
||||
if((files[i]!=".")&&(files[i]!="..")) {
|
||||
rip_cdda_dir.remove(files[i]);
|
||||
}
|
||||
}
|
||||
rmdir(rip_cdda_dir.path());
|
||||
|
||||
rip_cdrom->close();
|
||||
delete rip_cdrom;
|
||||
delete rip_track_list;
|
||||
@ -407,8 +385,7 @@ void DiskRipper::ripDiskButtonData()
|
||||
//
|
||||
if(!rip_isrc_read) {
|
||||
if(rda->libraryConf()->readIsrc()) {
|
||||
rip_cddb_lookup->
|
||||
readIsrc(rip_cdda_dir.path(),rda->libraryConf()->ripperDevice());
|
||||
rip_cddb_lookup->readIsrc();
|
||||
}
|
||||
rip_isrc_read=true;
|
||||
}
|
||||
@ -477,8 +454,6 @@ void DiskRipper::ripDiskButtonData()
|
||||
item=(RDListViewItem *)item->nextSibling();
|
||||
}
|
||||
|
||||
// rip_cdrom->eject();
|
||||
|
||||
if(rip_aborting) {
|
||||
QMessageBox::information(this,tr("Rip Complete"),tr("Rip aborted!"));
|
||||
}
|
||||
@ -789,10 +764,7 @@ void DiskRipper::mediaChangedData()
|
||||
rip_cddb_record.clear();
|
||||
rip_cdrom->setCddbRecord(&rip_cddb_record);
|
||||
rip_cddb_lookup->setCddbRecord(&rip_cddb_record);
|
||||
rip_cddb_lookup->
|
||||
lookupRecord(rip_cdda_dir.path(),rda->libraryConf()->ripperDevice(),
|
||||
rda->libraryConf()->cddbServer(),8880,
|
||||
RIPPER_CDDB_USER,PACKAGE_NAME,VERSION);
|
||||
rip_cddb_lookup->lookup();
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
@ -812,10 +784,10 @@ void DiskRipper::stoppedData()
|
||||
}
|
||||
|
||||
|
||||
void DiskRipper::cddbDoneData(RDCddbLookup::Result result)
|
||||
void DiskRipper::cddbDoneData(RDDiscLookup::Result result)
|
||||
{
|
||||
switch(result) {
|
||||
case RDCddbLookup::ExactMatch:
|
||||
case RDDiscLookup::ExactMatch:
|
||||
if(rip_cdrom->status()!=RDCdPlayer::Ok) {
|
||||
return;
|
||||
}
|
||||
@ -835,7 +807,7 @@ void DiskRipper::cddbDoneData(RDCddbLookup::Result result)
|
||||
rip_apply_box->setEnabled(true);
|
||||
rip_apply_label->setEnabled(true);
|
||||
break;
|
||||
case RDCddbLookup::PartialMatch:
|
||||
case RDDiscLookup::PartialMatch:
|
||||
rip_track=-1;
|
||||
printf("Partial Match!\n");
|
||||
break;
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// CD Disk Ripper Dialog for Rivendell
|
||||
//
|
||||
// (C) Copyright 2002-2019 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
|
||||
@ -57,7 +57,7 @@ class DiskRipper : public RDDialog
|
||||
void mediaChangedData();
|
||||
void playedData(int);
|
||||
void stoppedData();
|
||||
void cddbDoneData(RDCddbLookup::Result);
|
||||
void cddbDoneData(RDDiscLookup::Result);
|
||||
void normalizeCheckData(bool);
|
||||
void autotrimCheckData(bool);
|
||||
void selectionChangedData();
|
||||
@ -125,7 +125,6 @@ class DiskRipper : public RDDialog
|
||||
std::vector<RDWaveData *> rip_wave_datas;
|
||||
bool rip_aborting;
|
||||
bool rip_profile_rip;
|
||||
QDir rip_cdda_dir;
|
||||
bool rip_isrc_read;
|
||||
RDWaveDataDialog *rip_wavedata_dialog;
|
||||
};
|
||||
|
@ -451,14 +451,6 @@ vytahování</translation>
|
||||
<source>[none]</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ripper Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to create temporary directory!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Rip CD</source>
|
||||
<translation type="unfinished">Vytáhnout z CD</translation>
|
||||
@ -687,14 +679,6 @@ z CD</translation>
|
||||
<translation>Vytažení
|
||||
zrušeno!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ripper Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to create temporary directory!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Track</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -451,14 +451,6 @@ abbrechen</translation>
|
||||
<source>[none]</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ripper Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to create temporary directory!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Rip CD</source>
|
||||
<translation type="unfinished">CD rippen</translation>
|
||||
@ -686,14 +678,6 @@ Rippen</translation>
|
||||
<source>Rip aborted!</source>
|
||||
<translation>Rip abgebrochen!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ripper Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to create temporary directory!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Track</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -451,14 +451,6 @@ Lectura</translation>
|
||||
<source>[none]</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ripper Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to create temporary directory!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Rip CD</source>
|
||||
<translation type="unfinished">Leer CD</translation>
|
||||
@ -687,14 +679,6 @@ Disco</translation>
|
||||
<translation>¡Lectura
|
||||
Abortada!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ripper Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to create temporary directory!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Track</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -343,14 +343,6 @@ Rip</source>
|
||||
<source>[none]</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ripper Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to create temporary directory!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Rip CD</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -523,14 +515,6 @@ Disk</source>
|
||||
<source>Rip aborted!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ripper Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to create temporary directory!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Track</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -441,14 +441,6 @@ Rip</source>
|
||||
<source>[none]</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ripper Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to create temporary directory!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Rip CD</source>
|
||||
<translation type="unfinished">Ripp CD</translation>
|
||||
@ -679,14 +671,6 @@ Disk</source>
|
||||
<source>Rip aborted!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ripper Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to create temporary directory!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Track</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -441,14 +441,6 @@ Rip</source>
|
||||
<source>[none]</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ripper Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to create temporary directory!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Rip CD</source>
|
||||
<translation type="unfinished">Ripp CD</translation>
|
||||
@ -679,14 +671,6 @@ Disk</source>
|
||||
<source>Rip aborted!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ripper Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to create temporary directory!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Track</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -442,14 +442,6 @@ Rip</source>
|
||||
<source>[none]</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ripper Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to create temporary directory!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Rip CD</source>
|
||||
<translation type="unfinished">Extrair CD</translation>
|
||||
@ -680,14 +672,6 @@ Disk</source>
|
||||
<source>RDLibrary - Ripper Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ripper Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to create temporary directory!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Track</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
0
tests/mblookup_test.cpp
Normal file
0
tests/mblookup_test.cpp
Normal file
0
tests/mblookup_test.h
Normal file
0
tests/mblookup_test.h
Normal file
Loading…
x
Reference in New Issue
Block a user