mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-07-13 15:17:44 +02:00
2018-01-03 Fred Gleason <fredg@paravelsystems.com>
* Fixed races in creation of new carts.
This commit is contained in:
parent
d60b138629
commit
c63ae45991
@ -16555,3 +16555,5 @@
|
||||
2017-12-27 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Fixed a bug that broke generation of the 'RULES' table when creating
|
||||
a new clock in rdlogmanager(1).
|
||||
2018-01-03 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Fixed races in creation of new carts.
|
||||
|
@ -531,6 +531,14 @@
|
||||
<source>No such service!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</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>
|
||||
<name>RDAddCart</name>
|
||||
@ -902,7 +910,7 @@ ze &souboru</translation>
|
||||
</message>
|
||||
<message>
|
||||
<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>
|
||||
<source>Import Error</source>
|
||||
|
@ -527,6 +527,14 @@
|
||||
<source>No such service!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</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>
|
||||
<name>RDAddCart</name>
|
||||
@ -895,10 +903,6 @@ senden</translation>
|
||||
<source>Unable to create temporary cart for import!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to get temporary cart number for import!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Import Error</source>
|
||||
<translation type="unfinished">Importfehler</translation>
|
||||
|
@ -527,6 +527,14 @@
|
||||
<source>No such service!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</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>
|
||||
<name>RDAddCart</name>
|
||||
@ -895,10 +903,6 @@ Color</translation>
|
||||
<source>Unable to create temporary cart for import!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to get temporary cart number for import!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Import Error</source>
|
||||
<translation type="unfinished">Error importando</translation>
|
||||
|
@ -505,6 +505,14 @@
|
||||
<source>No such service!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</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>
|
||||
<name>RDAddCart</name>
|
||||
@ -833,10 +841,6 @@ La Couleur</translation>
|
||||
<source>Cart Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to get temporary cart number for import!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to create temporary cart for import!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -527,6 +527,14 @@
|
||||
<source>No such service!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</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>
|
||||
<name>RDAddCart</name>
|
||||
@ -894,10 +902,6 @@ farge</translation>
|
||||
<source>Unable to create temporary cart for import!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to get temporary cart number for import!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Import Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -527,6 +527,14 @@
|
||||
<source>No such service!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</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>
|
||||
<name>RDAddCart</name>
|
||||
@ -894,10 +902,6 @@ farge</translation>
|
||||
<source>Unable to create temporary cart for import!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to get temporary cart number for import!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Import Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -527,6 +527,14 @@
|
||||
<source>No such service!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</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>
|
||||
<name>RDAddCart</name>
|
||||
@ -895,10 +903,6 @@ Cor</translation>
|
||||
<source>Unable to create temporary cart for import!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to get temporary cart number for import!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Import Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -35,13 +35,14 @@
|
||||
#include <rdconfig.h>
|
||||
#include <rdcart.h>
|
||||
#include <rdcut.h>
|
||||
#include <rdtextvalidator.h>
|
||||
#include <rdescape_string.h>
|
||||
#include <rdsystem.h>
|
||||
#include <rdxport_interface.h>
|
||||
#include <rdformpost.h>
|
||||
#include <rdweb.h>
|
||||
#include <rdgroup.h>
|
||||
#include <rdstation.h>
|
||||
#include <rdsystem.h>
|
||||
#include <rdtextvalidator.h>
|
||||
#include <rdxport_interface.h>
|
||||
#include <rdweb.h>
|
||||
|
||||
//
|
||||
// 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
|
||||
{
|
||||
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 sql=QString("select ")+
|
||||
|
@ -149,8 +149,9 @@ class RDCart
|
||||
RDConfig *config);
|
||||
bool removeCutAudio(RDStation *station,RDUser *user,
|
||||
const QString &cutname,RDConfig *config);
|
||||
bool create(const QString &groupname,RDCart::Type type);
|
||||
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 xml(RDSqlQuery *q,bool include_cuts,bool absolute,
|
||||
RDSettings *settings=NULL,int cutnum=-1);
|
||||
|
@ -541,7 +541,6 @@ void RDCartDialog::loadFileData()
|
||||
{
|
||||
#ifndef WIN32
|
||||
QString filename;
|
||||
RDGroup *group=NULL;
|
||||
RDCart *cart=NULL;
|
||||
RDCut *cut=NULL;
|
||||
RDAudioImport *conv;
|
||||
@ -552,34 +551,25 @@ void RDCartDialog::loadFileData()
|
||||
QString file_title="";
|
||||
RDWaveFile *wavefile=NULL;
|
||||
RDWaveData wavedata;
|
||||
QString err_msg;
|
||||
|
||||
filename=QFileDialog::getOpenFileName(cart_import_path,
|
||||
cart_import_file_filter,this);
|
||||
if(!filename.isEmpty()) {
|
||||
|
||||
//
|
||||
// Get Cart Number
|
||||
//
|
||||
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
|
||||
//
|
||||
cart=new RDCart(cartnum);
|
||||
if(!cart->create(cart_system->tempCartGroup(),RDCart::Audio)) {
|
||||
if((cartnum=RDCart::create(cart_system->tempCartGroup(),RDCart::Audio,
|
||||
&err_msg))==0) {
|
||||
delete cart;
|
||||
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;
|
||||
}
|
||||
cart=new RDCart(cartnum);
|
||||
cart->setOwner(cart_station->name());
|
||||
cut=new RDCut(cartnum,1,true);
|
||||
|
||||
|
@ -3933,6 +3933,7 @@ void VoiceTracker::LogLine(const QString &line)
|
||||
bool VoiceTracker::InitTrack()
|
||||
{
|
||||
int cutnum;
|
||||
QString err_msg;
|
||||
|
||||
track_recording=false;
|
||||
track_record_ran=false;
|
||||
@ -3945,14 +3946,11 @@ bool VoiceTracker::InitTrack()
|
||||
bool ok=false;
|
||||
unsigned next_cart=0;
|
||||
RDCart *cart=NULL;
|
||||
while(!ok) {
|
||||
if((next_cart=track_group->nextFreeCart())==0) {
|
||||
return false;
|
||||
}
|
||||
cart=new RDCart(next_cart);
|
||||
ok=cart->create(track_group->name(),RDCart::Audio);
|
||||
delete cart;
|
||||
|
||||
if((next_cart=RDCart::create(track_group->name(),RDCart::Audio,&err_msg))==0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
edit_track_cart=new RDCart(next_cart);
|
||||
edit_track_cart->setOwner(track_log->name());
|
||||
edit_track_cart->setTitle(edit_logline[1]->markerComment().stripWhiteSpace());
|
||||
|
@ -366,16 +366,16 @@ bool MainWidget::LoadEvents()
|
||||
|
||||
bool MainWidget::ImportAudio()
|
||||
{
|
||||
if(dg_group->freeCartQuantity()<(int)dg_carts.size()) {
|
||||
QMessageBox::warning(this,tr("RDDgImport"),
|
||||
tr("Insufficient free carts in target group!"));
|
||||
return false;
|
||||
}
|
||||
QString err_msg;
|
||||
|
||||
for(std::map<QString,unsigned>::const_iterator it=dg_carts.begin();
|
||||
it!=dg_carts.end();it++) {
|
||||
Event *evt=GetEvent(it->first);
|
||||
if(!CheckSpot(evt->isci())) {
|
||||
ImportSpot(evt);
|
||||
if(!ImportSpot(evt,&err_msg)) {
|
||||
QMessageBox::warning(this,"RDgImport - "+tr("Error"),err_msg);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
RDCut *cut;
|
||||
unsigned cartnum;
|
||||
int cutnum;
|
||||
RDAudioImport *conv;
|
||||
RDAudioImport::ErrorCode conv_err;
|
||||
@ -507,8 +508,12 @@ bool MainWidget::ImportSpot(Event *evt)
|
||||
evt->isci()+"\".");
|
||||
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->create(dg_group->name(),RDCart::Audio);
|
||||
|
||||
if((cutnum=cart->addCut(dg_library_conf->defaultLayer(),
|
||||
dg_library_conf->defaultBitrate(),
|
||||
dg_library_conf->defaultChannels(),
|
||||
|
@ -76,7 +76,7 @@ class MainWidget : public QWidget
|
||||
bool ImportAudio();
|
||||
bool WriteTrafficFile();
|
||||
bool CheckSpot(const QString &isci);
|
||||
bool ImportSpot(Event *evt);
|
||||
bool ImportSpot(Event *evt,QString *err_msg);
|
||||
void ActivateBar(bool state);
|
||||
Event *GetEvent(const QString &isci);
|
||||
QTime GetTime(const QString &str) const;
|
||||
|
@ -58,10 +58,6 @@
|
||||
<source>User</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Insufficient free carts in target group!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Service:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -110,5 +106,9 @@
|
||||
<source>All Files</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -58,10 +58,6 @@
|
||||
<source>User</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Insufficient free carts in target group!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Service:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -110,5 +106,9 @@
|
||||
<source>All Files</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -58,10 +58,6 @@
|
||||
<source>User</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Insufficient free carts in target group!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Service:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -110,5 +106,9 @@
|
||||
<source>All Files</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -58,10 +58,6 @@
|
||||
<source>User</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Insufficient free carts in target group!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Service:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -110,5 +106,9 @@
|
||||
<source>All Files</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -58,10 +58,6 @@
|
||||
<source>User</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Insufficient free carts in target group!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Service:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -110,5 +106,9 @@
|
||||
<source>All Files</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -58,10 +58,6 @@
|
||||
<source>User</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Insufficient free carts in target group!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Service:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -110,5 +106,9 @@
|
||||
<source>All Files</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -447,6 +447,7 @@ void MainWidget::ripData()
|
||||
unsigned cartnum;
|
||||
RDAudioImport::ErrorCode import_err;
|
||||
RDAudioConvert::ErrorCode conv_err;
|
||||
QString err_msg;
|
||||
|
||||
//
|
||||
// Sanity Checks
|
||||
@ -496,42 +497,44 @@ void MainWidget::ripData()
|
||||
dg_track_label->setText(QString().sprintf("Track %d: ",i+1)+
|
||||
r->title()+" - "+r->artist());
|
||||
dg_ripper->rip(i);
|
||||
if((cartnum=dg_group->nextFreeCart())>0) {
|
||||
cart=new RDCart(cartnum);
|
||||
cart->create(dg_group->name(),RDCart::Audio);
|
||||
cart->addCut(dg_library_conf->defaultFormat(),
|
||||
dg_library_conf->defaultBitrate(),
|
||||
dg_channels_box->currentItem()+1,"",r->discId());
|
||||
cut=new RDCut(cartnum,1);
|
||||
dg_importer->setCartNumber(cartnum);
|
||||
dg_importer->setCutNumber(1);
|
||||
if((import_err=dg_importer->
|
||||
runImport(dg_user->name(),dg_user->password(),&conv_err))==
|
||||
RDAudioImport::ErrorOk) {
|
||||
data=new RDWaveData();
|
||||
r->getMetadata(data,dg_player->trackLength(i+1));
|
||||
if(!dg_autotrim_box->isChecked()) {
|
||||
data->setStartPos(0);
|
||||
data->setEndPos(dg_player->trackLength(i+1));
|
||||
}
|
||||
data->setUserDefined(dg_userdef_edit->text().
|
||||
replace("%d",dg_discid_edit->text()).
|
||||
replace("%t",QString().sprintf("%d",i+1)));
|
||||
cart->setMetadata(data);
|
||||
cut->setMetadata(data);
|
||||
delete data;
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(this,"RDDiscImport - "+tr("Import Error"),
|
||||
tr("Unable to import track audio!")+"\n"+
|
||||
"["+
|
||||
RDAudioImport::errorText(import_err,conv_err)+
|
||||
"].");
|
||||
return;
|
||||
}
|
||||
delete cut;
|
||||
delete cart;
|
||||
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->addCut(dg_library_conf->defaultFormat(),
|
||||
dg_library_conf->defaultBitrate(),
|
||||
dg_channels_box->currentItem()+1,"",r->discId());
|
||||
cut=new RDCut(cartnum,1);
|
||||
dg_importer->setCartNumber(cartnum);
|
||||
dg_importer->setCutNumber(1);
|
||||
if((import_err=dg_importer->
|
||||
runImport(dg_user->name(),dg_user->password(),&conv_err))==
|
||||
RDAudioImport::ErrorOk) {
|
||||
data=new RDWaveData();
|
||||
r->getMetadata(data,dg_player->trackLength(i+1));
|
||||
if(!dg_autotrim_box->isChecked()) {
|
||||
data->setStartPos(0);
|
||||
data->setEndPos(dg_player->trackLength(i+1));
|
||||
}
|
||||
data->setUserDefined(dg_userdef_edit->text().
|
||||
replace("%d",dg_discid_edit->text()).
|
||||
replace("%t",QString().sprintf("%d",i+1)));
|
||||
cart->setMetadata(data);
|
||||
cut->setMetadata(data);
|
||||
delete data;
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(this,"RDDiscImport - "+tr("Import Error"),
|
||||
tr("Unable to import track audio!")+"\n"+
|
||||
"["+
|
||||
RDAudioImport::errorText(import_err,conv_err)+
|
||||
"].");
|
||||
return;
|
||||
}
|
||||
delete cut;
|
||||
delete cart;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -162,5 +162,9 @@
|
||||
<source>Unable to open CD-ROM device at</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -162,5 +162,9 @@
|
||||
<source>Unable to open CD-ROM device at</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -162,5 +162,9 @@
|
||||
<source>Unable to open CD-ROM device at</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -162,5 +162,9 @@
|
||||
<source>Unable to open CD-ROM device at</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -162,5 +162,9 @@
|
||||
<source>Unable to open CD-ROM device at</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -162,5 +162,9 @@
|
||||
<source>Unable to open CD-ROM device at</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -977,6 +977,8 @@ MainObject::Result MainObject::ImportFile(const QString &filename,
|
||||
RDGroup *effective_group=new RDGroup(import_group->name());
|
||||
RDWaveData *wavedata=new RDWaveData();
|
||||
RDWaveFile *wavefile=new RDWaveFile(filename);
|
||||
QString err_msg;
|
||||
|
||||
if(wavefile->openWave(wavedata)) {
|
||||
effective_filename=filename;
|
||||
}
|
||||
@ -1112,11 +1114,9 @@ MainObject::Result MainObject::ImportFile(const QString &filename,
|
||||
if(import_delete_cuts) {
|
||||
DeleteCuts(import_cart_number);
|
||||
}
|
||||
cart_created=
|
||||
RDCart::create(effective_group->name(),RDCart::Audio,&err_msg,*cartnum)!=0;
|
||||
RDCart *cart=new RDCart(*cartnum);
|
||||
if(!cart->exists()) {
|
||||
cart->create(effective_group->name(),RDCart::Audio);
|
||||
cart_created=true;
|
||||
}
|
||||
int cutnum=
|
||||
cart->addCut(import_format,import_bitrate,import_channels);
|
||||
if(cutnum<0) {
|
||||
|
@ -43,6 +43,7 @@ void Xport::AddCart()
|
||||
QString type;
|
||||
RDCart::Type cart_type=RDCart::All;
|
||||
int cart_number=0;
|
||||
QString err_msg;
|
||||
|
||||
//
|
||||
// Verify Post
|
||||
@ -96,9 +97,9 @@ void Xport::AddCart()
|
||||
delete cart;
|
||||
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;
|
||||
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("Status: 200\n\n");
|
||||
|
@ -41,6 +41,7 @@ void Xport::Import()
|
||||
unsigned msecs=0;
|
||||
int resp_code=0;
|
||||
QString remote_host;
|
||||
QString err_msg;
|
||||
|
||||
if(getenv("REMOTE_HOST")==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);
|
||||
}
|
||||
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;
|
||||
cut=new RDCut(cartnum,cutnum,true);
|
||||
delete group;
|
||||
|
Loading…
x
Reference in New Issue
Block a user