2018-01-03 Fred Gleason <fredg@paravelsystems.com>

* Fixed races in creation of new carts.
This commit is contained in:
Fred Gleason 2018-01-03 15:36:45 -05:00
parent d60b138629
commit c63ae45991
30 changed files with 238 additions and 145 deletions

View File

@ -16555,3 +16555,5 @@
2017-12-27 Fred Gleason <fredg@paravelsystems.com> 2017-12-27 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug that broke generation of the 'RULES' table when creating * Fixed a bug that broke generation of the 'RULES' table when creating
a new clock in rdlogmanager(1). a new clock in rdlogmanager(1).
2018-01-03 Fred Gleason <fredg@paravelsystems.com>
* Fixed races in creation of new carts.

View File

@ -531,6 +531,14 @@
<source>No such service!</source> <source>No such service!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>No such group</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No free cart available in group</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RDAddCart</name> <name>RDAddCart</name>
@ -902,7 +910,7 @@ ze &amp;souboru</translation>
</message> </message>
<message> <message>
<source>Unable to get temporary cart number for import!</source> <source>Unable to get temporary cart number for import!</source>
<translation>Nelze získat číslo dočasného vozík pro zavedení!</translation> <translation type="obsolete">Nelze získat číslo dočasného vozík pro zavedení!</translation>
</message> </message>
<message> <message>
<source>Import Error</source> <source>Import Error</source>

View File

@ -527,6 +527,14 @@
<source>No such service!</source> <source>No such service!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>No such group</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No free cart available in group</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RDAddCart</name> <name>RDAddCart</name>
@ -895,10 +903,6 @@ senden</translation>
<source>Unable to create temporary cart for import!</source> <source>Unable to create temporary cart for import!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Unable to get temporary cart number for import!</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Import Error</source> <source>Import Error</source>
<translation type="unfinished">Importfehler</translation> <translation type="unfinished">Importfehler</translation>

View File

@ -527,6 +527,14 @@
<source>No such service!</source> <source>No such service!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>No such group</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No free cart available in group</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RDAddCart</name> <name>RDAddCart</name>
@ -895,10 +903,6 @@ Color</translation>
<source>Unable to create temporary cart for import!</source> <source>Unable to create temporary cart for import!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Unable to get temporary cart number for import!</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Import Error</source> <source>Import Error</source>
<translation type="unfinished">Error importando</translation> <translation type="unfinished">Error importando</translation>

View File

@ -505,6 +505,14 @@
<source>No such service!</source> <source>No such service!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>No such group</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No free cart available in group</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RDAddCart</name> <name>RDAddCart</name>
@ -833,10 +841,6 @@ La Couleur</translation>
<source>Cart Error</source> <source>Cart Error</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Unable to get temporary cart number for import!</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Unable to create temporary cart for import!</source> <source>Unable to create temporary cart for import!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>

View File

@ -527,6 +527,14 @@
<source>No such service!</source> <source>No such service!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>No such group</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No free cart available in group</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RDAddCart</name> <name>RDAddCart</name>
@ -894,10 +902,6 @@ farge</translation>
<source>Unable to create temporary cart for import!</source> <source>Unable to create temporary cart for import!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Unable to get temporary cart number for import!</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Import Error</source> <source>Import Error</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>

View File

@ -527,6 +527,14 @@
<source>No such service!</source> <source>No such service!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>No such group</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No free cart available in group</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RDAddCart</name> <name>RDAddCart</name>
@ -894,10 +902,6 @@ farge</translation>
<source>Unable to create temporary cart for import!</source> <source>Unable to create temporary cart for import!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Unable to get temporary cart number for import!</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Import Error</source> <source>Import Error</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>

View File

@ -527,6 +527,14 @@
<source>No such service!</source> <source>No such service!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>No such group</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No free cart available in group</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RDAddCart</name> <name>RDAddCart</name>
@ -895,10 +903,6 @@ Cor</translation>
<source>Unable to create temporary cart for import!</source> <source>Unable to create temporary cart for import!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Unable to get temporary cart number for import!</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Import Error</source> <source>Import Error</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>

View File

@ -35,13 +35,14 @@
#include <rdconfig.h> #include <rdconfig.h>
#include <rdcart.h> #include <rdcart.h>
#include <rdcut.h> #include <rdcut.h>
#include <rdtextvalidator.h>
#include <rdescape_string.h> #include <rdescape_string.h>
#include <rdsystem.h>
#include <rdxport_interface.h>
#include <rdformpost.h> #include <rdformpost.h>
#include <rdweb.h> #include <rdgroup.h>
#include <rdstation.h> #include <rdstation.h>
#include <rdsystem.h>
#include <rdtextvalidator.h>
#include <rdxport_interface.h>
#include <rdweb.h>
// //
// CURL Callbacks // CURL Callbacks
@ -1271,29 +1272,60 @@ bool RDCart::removeCutAudio(RDStation *station,RDUser *user,
} }
bool RDCart::create(const QString &groupname,RDCart::Type type)
{
QString sql=QString().sprintf("insert into CART set NUMBER=%d,TYPE=%d,\
GROUP_NAME=\"%s\",TITLE=\"%s\"",
cart_number,type,
(const char *)RDEscapeString(groupname),
(const char *)
RDEscapeString(RDCart::uniqueCartTitle(cart_number)));
RDSqlQuery *q=new RDSqlQuery(sql);
bool ret=q->isActive();
delete q;
metadata_changed=true;
return ret;
}
bool RDCart::remove(RDStation *station,RDUser *user,RDConfig *config) const bool RDCart::remove(RDStation *station,RDUser *user,RDConfig *config) const
{ {
return RDCart::removeCart(cart_number,station,user,config); return RDCart::removeCart(cart_number,station,user,config);
} }
unsigned RDCart::create(const QString &groupname,RDCart::Type type,
QString *err_msg,unsigned cartnum)
{
bool ok=false;
RDGroup *group=new RDGroup(groupname);
if(!group->exists()) {
*err_msg=QObject::tr("No such group");
delete group;
return 0;
}
if(cartnum==0) {
while(!ok) {
if((cartnum=group->nextFreeCart())==0) {
*err_msg=QObject::tr("No free cart available in group");
delete group;
return 0;
}
QString sql=QString("insert into CART set ")+
QString().sprintf("NUMBER=%d,",cartnum)+
QString().sprintf("TYPE=%d,",type)+
"GROUP_NAME=\""+RDEscapeString(groupname)+"\","+
"TITLE=\""+RDEscapeString(RDCart::uniqueCartTitle(cartnum))+"\"";
RDSqlQuery *q=new RDSqlQuery(sql);
ok=q->isActive();
delete q;
}
return cartnum;
}
else {
QString sql=QString("insert into CART set ")+
QString().sprintf("NUMBER=%d,",cartnum)+
QString().sprintf("TYPE=%d,",type)+
"GROUP_NAME=\""+RDEscapeString(groupname)+"\","+
"TITLE=\""+RDEscapeString(RDCart::uniqueCartTitle(cartnum))+"\"";
RDSqlQuery *q=new RDSqlQuery(sql);
ok=q->isActive();
delete q;
}
delete group;
if(!ok) {
return 0;
}
return cartnum;
}
QString RDCart::xmlSql(bool include_cuts) QString RDCart::xmlSql(bool include_cuts)
{ {
QString sql=QString("select ")+ QString sql=QString("select ")+

View File

@ -149,8 +149,9 @@ class RDCart
RDConfig *config); RDConfig *config);
bool removeCutAudio(RDStation *station,RDUser *user, bool removeCutAudio(RDStation *station,RDUser *user,
const QString &cutname,RDConfig *config); const QString &cutname,RDConfig *config);
bool create(const QString &groupname,RDCart::Type type);
bool remove(RDStation *station,RDUser *user,RDConfig *config) const; bool remove(RDStation *station,RDUser *user,RDConfig *config) const;
static unsigned create(const QString &groupname,RDCart::Type type,
QString *err_msg,unsigned cartnum=0);
static QString xmlSql(bool include_cuts); static QString xmlSql(bool include_cuts);
static QString xml(RDSqlQuery *q,bool include_cuts,bool absolute, static QString xml(RDSqlQuery *q,bool include_cuts,bool absolute,
RDSettings *settings=NULL,int cutnum=-1); RDSettings *settings=NULL,int cutnum=-1);

View File

@ -541,7 +541,6 @@ void RDCartDialog::loadFileData()
{ {
#ifndef WIN32 #ifndef WIN32
QString filename; QString filename;
RDGroup *group=NULL;
RDCart *cart=NULL; RDCart *cart=NULL;
RDCut *cut=NULL; RDCut *cut=NULL;
RDAudioImport *conv; RDAudioImport *conv;
@ -552,34 +551,25 @@ void RDCartDialog::loadFileData()
QString file_title=""; QString file_title="";
RDWaveFile *wavefile=NULL; RDWaveFile *wavefile=NULL;
RDWaveData wavedata; RDWaveData wavedata;
QString err_msg;
filename=QFileDialog::getOpenFileName(cart_import_path, filename=QFileDialog::getOpenFileName(cart_import_path,
cart_import_file_filter,this); cart_import_file_filter,this);
if(!filename.isEmpty()) { if(!filename.isEmpty()) {
//
// Get Cart Number
//
cart_import_path=RDGetPathPart(filename); cart_import_path=RDGetPathPart(filename);
group=new RDGroup(cart_system->tempCartGroup());
if((!group->exists())||((cartnum=group->nextFreeCart())==0)) {
delete group;
QMessageBox::warning(this,tr("Cart Error"),
tr("Unable to get temporary cart number for import!"));
return;
}
delete group;
// //
// Create Cart // Create Cart
// //
cart=new RDCart(cartnum); if((cartnum=RDCart::create(cart_system->tempCartGroup(),RDCart::Audio,
if(!cart->create(cart_system->tempCartGroup(),RDCart::Audio)) { &err_msg))==0) {
delete cart; delete cart;
QMessageBox::warning(this,tr("Cart Error"), QMessageBox::warning(this,tr("Cart Error"),
tr("Unable to create temporary cart for import!")); tr("Unable to create temporary cart for import!")+
"["+err_msg+"]");
return; return;
} }
cart=new RDCart(cartnum);
cart->setOwner(cart_station->name()); cart->setOwner(cart_station->name());
cut=new RDCut(cartnum,1,true); cut=new RDCut(cartnum,1,true);

View File

@ -3933,6 +3933,7 @@ void VoiceTracker::LogLine(const QString &line)
bool VoiceTracker::InitTrack() bool VoiceTracker::InitTrack()
{ {
int cutnum; int cutnum;
QString err_msg;
track_recording=false; track_recording=false;
track_record_ran=false; track_record_ran=false;
@ -3945,14 +3946,11 @@ bool VoiceTracker::InitTrack()
bool ok=false; bool ok=false;
unsigned next_cart=0; unsigned next_cart=0;
RDCart *cart=NULL; RDCart *cart=NULL;
while(!ok) {
if((next_cart=track_group->nextFreeCart())==0) { if((next_cart=RDCart::create(track_group->name(),RDCart::Audio,&err_msg))==0) {
return false; return false;
} }
cart=new RDCart(next_cart);
ok=cart->create(track_group->name(),RDCart::Audio);
delete cart;
}
edit_track_cart=new RDCart(next_cart); edit_track_cart=new RDCart(next_cart);
edit_track_cart->setOwner(track_log->name()); edit_track_cart->setOwner(track_log->name());
edit_track_cart->setTitle(edit_logline[1]->markerComment().stripWhiteSpace()); edit_track_cart->setTitle(edit_logline[1]->markerComment().stripWhiteSpace());

View File

@ -366,16 +366,16 @@ bool MainWidget::LoadEvents()
bool MainWidget::ImportAudio() bool MainWidget::ImportAudio()
{ {
if(dg_group->freeCartQuantity()<(int)dg_carts.size()) { QString err_msg;
QMessageBox::warning(this,tr("RDDgImport"),
tr("Insufficient free carts in target group!"));
return false;
}
for(std::map<QString,unsigned>::const_iterator it=dg_carts.begin(); for(std::map<QString,unsigned>::const_iterator it=dg_carts.begin();
it!=dg_carts.end();it++) { it!=dg_carts.end();it++) {
Event *evt=GetEvent(it->first); Event *evt=GetEvent(it->first);
if(!CheckSpot(evt->isci())) { if(!CheckSpot(evt->isci())) {
ImportSpot(evt); if(!ImportSpot(evt,&err_msg)) {
QMessageBox::warning(this,"RDgImport - "+tr("Error"),err_msg);
return false;
}
} }
} }
return true; return true;
@ -464,10 +464,11 @@ bool MainWidget::CheckSpot(const QString &isci)
} }
bool MainWidget::ImportSpot(Event *evt) bool MainWidget::ImportSpot(Event *evt,QString *err_msg)
{ {
RDCart *cart; RDCart *cart;
RDCut *cut; RDCut *cut;
unsigned cartnum;
int cutnum; int cutnum;
RDAudioImport *conv; RDAudioImport *conv;
RDAudioImport::ErrorCode conv_err; RDAudioImport::ErrorCode conv_err;
@ -507,8 +508,12 @@ bool MainWidget::ImportSpot(Event *evt)
evt->isci()+"\"."); evt->isci()+"\".");
return false; return false;
} }
if((cartnum=RDCart::create(dg_group->name(),RDCart::Audio,err_msg,
dg_carts[evt->isci()]))==0) {
return false;
}
cart=new RDCart(dg_carts[evt->isci()]); cart=new RDCart(dg_carts[evt->isci()]);
cart->create(dg_group->name(),RDCart::Audio);
if((cutnum=cart->addCut(dg_library_conf->defaultLayer(), if((cutnum=cart->addCut(dg_library_conf->defaultLayer(),
dg_library_conf->defaultBitrate(), dg_library_conf->defaultBitrate(),
dg_library_conf->defaultChannels(), dg_library_conf->defaultChannels(),

View File

@ -76,7 +76,7 @@ class MainWidget : public QWidget
bool ImportAudio(); bool ImportAudio();
bool WriteTrafficFile(); bool WriteTrafficFile();
bool CheckSpot(const QString &isci); bool CheckSpot(const QString &isci);
bool ImportSpot(Event *evt); bool ImportSpot(Event *evt,QString *err_msg);
void ActivateBar(bool state); void ActivateBar(bool state);
Event *GetEvent(const QString &isci); Event *GetEvent(const QString &isci);
QTime GetTime(const QString &str) const; QTime GetTime(const QString &str) const;

View File

@ -58,10 +58,6 @@
<source>User</source> <source>User</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Insufficient free carts in target group!</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Service:</source> <source>Service:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -110,5 +106,9 @@
<source>All Files</source> <source>All Files</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>

View File

@ -58,10 +58,6 @@
<source>User</source> <source>User</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Insufficient free carts in target group!</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Service:</source> <source>Service:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -110,5 +106,9 @@
<source>All Files</source> <source>All Files</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>

View File

@ -58,10 +58,6 @@
<source>User</source> <source>User</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Insufficient free carts in target group!</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Service:</source> <source>Service:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -110,5 +106,9 @@
<source>All Files</source> <source>All Files</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>

View File

@ -58,10 +58,6 @@
<source>User</source> <source>User</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Insufficient free carts in target group!</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Service:</source> <source>Service:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -110,5 +106,9 @@
<source>All Files</source> <source>All Files</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>

View File

@ -58,10 +58,6 @@
<source>User</source> <source>User</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Insufficient free carts in target group!</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Service:</source> <source>Service:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -110,5 +106,9 @@
<source>All Files</source> <source>All Files</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>

View File

@ -58,10 +58,6 @@
<source>User</source> <source>User</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Insufficient free carts in target group!</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Service:</source> <source>Service:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -110,5 +106,9 @@
<source>All Files</source> <source>All Files</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>

View File

@ -447,6 +447,7 @@ void MainWidget::ripData()
unsigned cartnum; unsigned cartnum;
RDAudioImport::ErrorCode import_err; RDAudioImport::ErrorCode import_err;
RDAudioConvert::ErrorCode conv_err; RDAudioConvert::ErrorCode conv_err;
QString err_msg;
// //
// Sanity Checks // Sanity Checks
@ -496,9 +497,12 @@ void MainWidget::ripData()
dg_track_label->setText(QString().sprintf("Track %d: ",i+1)+ dg_track_label->setText(QString().sprintf("Track %d: ",i+1)+
r->title()+" - "+r->artist()); r->title()+" - "+r->artist());
dg_ripper->rip(i); dg_ripper->rip(i);
if((cartnum=dg_group->nextFreeCart())>0) { if((cartnum=RDCart::create(dg_group->name(),RDCart::Audio,
&err_msg))==0) {
QMessageBox::warning(this,"RDDiscImport - "+tr("Error"),err_msg);
return;
}
cart=new RDCart(cartnum); cart=new RDCart(cartnum);
cart->create(dg_group->name(),RDCart::Audio);
cart->addCut(dg_library_conf->defaultFormat(), cart->addCut(dg_library_conf->defaultFormat(),
dg_library_conf->defaultBitrate(), dg_library_conf->defaultBitrate(),
dg_channels_box->currentItem()+1,"",r->discId()); dg_channels_box->currentItem()+1,"",r->discId());
@ -534,7 +538,6 @@ void MainWidget::ripData()
} }
} }
} }
}
delete s; delete s;
// //

View File

@ -162,5 +162,9 @@
<source>Unable to open CD-ROM device at</source> <source>Unable to open CD-ROM device at</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>

View File

@ -162,5 +162,9 @@
<source>Unable to open CD-ROM device at</source> <source>Unable to open CD-ROM device at</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>

View File

@ -162,5 +162,9 @@
<source>Unable to open CD-ROM device at</source> <source>Unable to open CD-ROM device at</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>

View File

@ -162,5 +162,9 @@
<source>Unable to open CD-ROM device at</source> <source>Unable to open CD-ROM device at</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>

View File

@ -162,5 +162,9 @@
<source>Unable to open CD-ROM device at</source> <source>Unable to open CD-ROM device at</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>

View File

@ -162,5 +162,9 @@
<source>Unable to open CD-ROM device at</source> <source>Unable to open CD-ROM device at</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>

View File

@ -977,6 +977,8 @@ MainObject::Result MainObject::ImportFile(const QString &filename,
RDGroup *effective_group=new RDGroup(import_group->name()); RDGroup *effective_group=new RDGroup(import_group->name());
RDWaveData *wavedata=new RDWaveData(); RDWaveData *wavedata=new RDWaveData();
RDWaveFile *wavefile=new RDWaveFile(filename); RDWaveFile *wavefile=new RDWaveFile(filename);
QString err_msg;
if(wavefile->openWave(wavedata)) { if(wavefile->openWave(wavedata)) {
effective_filename=filename; effective_filename=filename;
} }
@ -1112,11 +1114,9 @@ MainObject::Result MainObject::ImportFile(const QString &filename,
if(import_delete_cuts) { if(import_delete_cuts) {
DeleteCuts(import_cart_number); DeleteCuts(import_cart_number);
} }
cart_created=
RDCart::create(effective_group->name(),RDCart::Audio,&err_msg,*cartnum)!=0;
RDCart *cart=new RDCart(*cartnum); RDCart *cart=new RDCart(*cartnum);
if(!cart->exists()) {
cart->create(effective_group->name(),RDCart::Audio);
cart_created=true;
}
int cutnum= int cutnum=
cart->addCut(import_format,import_bitrate,import_channels); cart->addCut(import_format,import_bitrate,import_channels);
if(cutnum<0) { if(cutnum<0) {

View File

@ -43,6 +43,7 @@ void Xport::AddCart()
QString type; QString type;
RDCart::Type cart_type=RDCart::All; RDCart::Type cart_type=RDCart::All;
int cart_number=0; int cart_number=0;
QString err_msg;
// //
// Verify Post // Verify Post
@ -96,9 +97,9 @@ void Xport::AddCart()
delete cart; delete cart;
XmlExit("Cart already exists",400,"carts.cpp",LINE_NUMBER); XmlExit("Cart already exists",400,"carts.cpp",LINE_NUMBER);
} }
if(!cart->create(group_name,cart_type)) { if(RDCart::create(group_name,cart_type,&err_msg,cart_number)==0) {
delete cart; delete cart;
XmlExit("Unable to create cart",500,"carts.cpp",LINE_NUMBER); XmlExit("Unable to create cart ["+err_msg+"]",500,"carts.cpp",LINE_NUMBER);
} }
printf("Content-type: application/xml\n"); printf("Content-type: application/xml\n");
printf("Status: 200\n\n"); printf("Status: 200\n\n");

View File

@ -41,6 +41,7 @@ void Xport::Import()
unsigned msecs=0; unsigned msecs=0;
int resp_code=0; int resp_code=0;
QString remote_host; QString remote_host;
QString err_msg;
if(getenv("REMOTE_HOST")==NULL) { if(getenv("REMOTE_HOST")==NULL) {
if(getenv("REMOTE_ADDR")==NULL) { if(getenv("REMOTE_ADDR")==NULL) {
@ -147,7 +148,11 @@ void Xport::Import()
XmlExit("No available carts for specified group",404,"import.cpp",LINE_NUMBER); XmlExit("No available carts for specified group",404,"import.cpp",LINE_NUMBER);
} }
cart=new RDCart(cartnum); cart=new RDCart(cartnum);
cart->create(group_name,RDCart::Audio); if(RDCart::create(group_name,RDCart::Audio,&err_msg,cartnum)==0) {
delete cart;
XmlExit("Unable to create cart ["+err_msg+"]",500,"import.cpp",
LINE_NUMBER);
}
cutnum=1; cutnum=1;
cut=new RDCut(cartnum,cutnum,true); cut=new RDCut(cartnum,cutnum,true);
delete group; delete group;