mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-06-01 16:42:34 +02:00
2016-05-25 Fred Gleason <fredg@paravelsystems.com>
Added a '--escape-string=' parameters to rdexport(1).
This commit is contained in:
parent
c952aa57b5
commit
ef27640396
@ -15168,3 +15168,5 @@
|
|||||||
Ubuntu 16.04 [GitHub pull request #000130].
|
Ubuntu 16.04 [GitHub pull request #000130].
|
||||||
2016-05-25 Fred Gleason <fredg@paravelsystems.com>
|
2016-05-25 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Incremented the package version to 2.13.0int00.
|
* Incremented the package version to 2.13.0int00.
|
||||||
|
2016-05-25 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
Added a '--escape-string=' parameters to rdexport(1).
|
||||||
|
@ -41,6 +41,7 @@ MainObject::MainObject(QObject *parent)
|
|||||||
:QObject(parent)
|
:QObject(parent)
|
||||||
{
|
{
|
||||||
export_metadata_pattern="%n_%j";
|
export_metadata_pattern="%n_%j";
|
||||||
|
export_escape_string="_";
|
||||||
|
|
||||||
//
|
//
|
||||||
// Read Command Options
|
// Read Command Options
|
||||||
@ -73,6 +74,14 @@ MainObject::MainObject(QObject *parent)
|
|||||||
}
|
}
|
||||||
cmd->setProcessed(i,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");
|
||||||
|
exit(256);
|
||||||
|
}
|
||||||
|
export_escape_string=cmd->value(i);
|
||||||
|
cmd->setProcessed(i,true);
|
||||||
|
}
|
||||||
if(cmd->key(i)=="--group") {
|
if(cmd->key(i)=="--group") {
|
||||||
export_groups.push_back(cmd->value(i));
|
export_groups.push_back(cmd->value(i));
|
||||||
cmd->setProcessed(i,true);
|
cmd->setProcessed(i,true);
|
||||||
@ -326,7 +335,7 @@ QString MainObject::ResolveOutputName(RDCart *cart,RDCut *cut,
|
|||||||
name.replace("%u",cart->userDefined());
|
name.replace("%u",cart->userDefined());
|
||||||
name.replace("%y",QString().sprintf("%d",cart->year()));
|
name.replace("%y",QString().sprintf("%d",cart->year()));
|
||||||
|
|
||||||
QString ret=name;
|
QString ret=SanitizePath(name);
|
||||||
int count=1;
|
int count=1;
|
||||||
while(QFile::exists(export_output_to+"/"+ret+"."+exten)) {
|
while(QFile::exists(export_output_to+"/"+ret+"."+exten)) {
|
||||||
ret=name+QString().sprintf("[%d]",count++);
|
ret=name+QString().sprintf("[%d]",count++);
|
||||||
@ -336,6 +345,29 @@ QString MainObject::ResolveOutputName(RDCart *cart,RDCut *cut,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString MainObject::SanitizePath(const QString &pathname) const
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Remove illegal characters from the filepath.
|
||||||
|
// (from https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx#naming_conventions
|
||||||
|
//
|
||||||
|
QString ret=pathname;
|
||||||
|
|
||||||
|
ret.replace("/",export_escape_string);
|
||||||
|
ret.replace(":",export_escape_string);
|
||||||
|
ret.replace("<",export_escape_string);
|
||||||
|
ret.replace(">",export_escape_string);
|
||||||
|
ret.replace(":",export_escape_string);
|
||||||
|
ret.replace("\"",export_escape_string);
|
||||||
|
ret.replace("\\",export_escape_string);
|
||||||
|
ret.replace("|",export_escape_string);
|
||||||
|
ret.replace("?",export_escape_string);
|
||||||
|
ret.replace("*",export_escape_string);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainObject::Verbose(const QString &msg)
|
void MainObject::Verbose(const QString &msg)
|
||||||
{
|
{
|
||||||
if(export_verbose) {
|
if(export_verbose) {
|
||||||
|
@ -49,6 +49,7 @@ class MainObject : public QObject
|
|||||||
void ExportCart(unsigned cartnum);
|
void ExportCart(unsigned cartnum);
|
||||||
void ExportCut(RDCart *cart,RDCut *cut);
|
void ExportCut(RDCart *cart,RDCut *cut);
|
||||||
QString ResolveOutputName(RDCart *cart,RDCut *cut,const QString &exten);
|
QString ResolveOutputName(RDCart *cart,RDCut *cut,const QString &exten);
|
||||||
|
QString SanitizePath(const QString &pathname) const;
|
||||||
void Verbose(const QString &msg);
|
void Verbose(const QString &msg);
|
||||||
std::vector<unsigned> export_start_carts;
|
std::vector<unsigned> export_start_carts;
|
||||||
std::vector<unsigned> export_end_carts;
|
std::vector<unsigned> export_end_carts;
|
||||||
@ -60,6 +61,7 @@ class MainObject : public QObject
|
|||||||
RDStation *export_station;
|
RDStation *export_station;
|
||||||
RDUser *export_user;
|
RDUser *export_user;
|
||||||
bool export_verbose;
|
bool export_verbose;
|
||||||
|
QString export_escape_string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user