mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-18 08:31:16 +02:00
2016-05-25 Fred Gleason <fredg@paravelsystems.com>
Added a '--continue-after-error' parameter to rdexport(1). Added a '--allow-clobber' parameter to rdexport(1).
This commit is contained in:
@@ -42,6 +42,8 @@ MainObject::MainObject(QObject *parent)
|
||||
{
|
||||
export_metadata_pattern="%n_%j";
|
||||
export_escape_string="_";
|
||||
export_continue_after_error=false;
|
||||
export_allow_clobber=false;
|
||||
|
||||
//
|
||||
// Read Command Options
|
||||
@@ -53,6 +55,10 @@ MainObject::MainObject(QObject *parent)
|
||||
exit(256);
|
||||
}
|
||||
for(int i=0;i<(int)cmd->keys()-1;i++) {
|
||||
if(cmd->key(i)=="--allow-clobber") {
|
||||
export_allow_clobber=true;
|
||||
cmd->setProcessed(i,true);
|
||||
}
|
||||
if(cmd->key(i)=="--carts") {
|
||||
bool ok=false;
|
||||
bool valid=false;
|
||||
@@ -74,6 +80,10 @@ MainObject::MainObject(QObject *parent)
|
||||
}
|
||||
cmd->setProcessed(i,true);
|
||||
}
|
||||
if(cmd->key(i)=="--continue-after-error") {
|
||||
export_continue_after_error=true;
|
||||
cmd->setProcessed(i,true);
|
||||
}
|
||||
if(cmd->key(i)=="--escape-string") {
|
||||
if(cmd->value(i)!=SanitizePath(cmd->value(i))) {
|
||||
fprintf(stderr,"rdxport: illegal character(s) in escape string\n");
|
||||
@@ -265,7 +275,12 @@ void MainObject::ExportCut(RDCart *cart,RDCut *cut)
|
||||
RDAudioInfo::ErrorOk) {
|
||||
fprintf(stderr,"rdexport: error getting cut info [%s]\n",
|
||||
(const char *)RDAudioInfo::errorText(info_err));
|
||||
exit(256);
|
||||
if(export_continue_after_error) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
exit(256);
|
||||
}
|
||||
}
|
||||
RDSettings settings;
|
||||
switch(info->format()) {
|
||||
@@ -283,7 +298,12 @@ void MainObject::ExportCut(RDCart *cart,RDCut *cut)
|
||||
|
||||
default:
|
||||
fprintf(stderr,"rdexport: unsupported source audio format\n");
|
||||
exit(256);
|
||||
if(export_continue_after_error) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
exit(256);
|
||||
}
|
||||
}
|
||||
settings.setChannels(info->channels());
|
||||
settings.setSampleRate(info->sampleRate());
|
||||
@@ -303,7 +323,9 @@ void MainObject::ExportCut(RDCart *cart,RDCut *cut)
|
||||
&conv_err))!=RDAudioExport::ErrorOk) {
|
||||
fprintf(stderr,"rdexport: exporter error [%s]\n",
|
||||
(const char *)RDAudioExport::errorText(export_err,conv_err));
|
||||
exit(256);
|
||||
if(!export_continue_after_error) {
|
||||
exit(256);
|
||||
}
|
||||
}
|
||||
|
||||
delete conv;
|
||||
@@ -336,9 +358,11 @@ QString MainObject::ResolveOutputName(RDCart *cart,RDCut *cut,
|
||||
name.replace("%y",QString().sprintf("%d",cart->year()));
|
||||
|
||||
QString ret=SanitizePath(name);
|
||||
int count=1;
|
||||
while(QFile::exists(export_output_to+"/"+ret+"."+exten)) {
|
||||
ret=name+QString().sprintf("[%d]",count++);
|
||||
if(!export_allow_clobber) {
|
||||
int count=1;
|
||||
while(QFile::exists(export_output_to+"/"+ret+"."+exten)) {
|
||||
ret=name+QString().sprintf("[%d]",count++);
|
||||
}
|
||||
}
|
||||
|
||||
return export_output_to+"/"+ret+"."+exten;
|
||||
|
Reference in New Issue
Block a user