mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-07-08 16:37:46 +02:00
2018-02-03 Fred Gleason <fredg@paravelsystems.com>
* Converted nexgen_filter(1) to use RDApplication.
This commit is contained in:
parent
0b59fa865a
commit
16b028bbd9
@ -16653,3 +16653,5 @@
|
|||||||
* Converted rdfeed.xml to use RDApplication.
|
* Converted rdfeed.xml to use RDApplication.
|
||||||
2018-02-03 Fred Gleason <fredg@paravelsystems.com>
|
2018-02-03 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Converted rdxport.cgi to use RDApplication.
|
* Converted rdxport.cgi to use RDApplication.
|
||||||
|
2018-02-03 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Converted nexgen_filter(1) to use RDApplication.
|
||||||
|
@ -30,10 +30,11 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <qapplication.h>
|
#include <qapplication.h>
|
||||||
#include <qstringlist.h>
|
|
||||||
#include <qfile.h>
|
#include <qfile.h>
|
||||||
#include <qregexp.h>
|
#include <qregexp.h>
|
||||||
|
#include <qstringlist.h>
|
||||||
|
|
||||||
|
#include <rdapplication.h>
|
||||||
#include <rd.h>
|
#include <rd.h>
|
||||||
#include <rdcart.h>
|
#include <rdcart.h>
|
||||||
#include <rdconfig.h>
|
#include <rdconfig.h>
|
||||||
@ -45,13 +46,7 @@
|
|||||||
#include <rdwavefile.h>
|
#include <rdwavefile.h>
|
||||||
#include <rdweb.h>
|
#include <rdweb.h>
|
||||||
|
|
||||||
#include <nexgen_filter.h>
|
#include "nexgen_filter.h"
|
||||||
|
|
||||||
//
|
|
||||||
// Global Variables
|
|
||||||
//
|
|
||||||
RDConfig *rdconfig;
|
|
||||||
|
|
||||||
|
|
||||||
MainObject::MainObject(QObject *parent)
|
MainObject::MainObject(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
@ -62,54 +57,61 @@ MainObject::MainObject(QObject *parent)
|
|||||||
QStringList xml_files;
|
QStringList xml_files;
|
||||||
bool ok=false;
|
bool ok=false;
|
||||||
char tempdir[PATH_MAX];
|
char tempdir[PATH_MAX];
|
||||||
|
QString err_msg;
|
||||||
|
|
||||||
filter_cart_offset=0;
|
filter_cart_offset=0;
|
||||||
filter_delete_cuts=false;
|
filter_delete_cuts=false;
|
||||||
filter_normalization_level=0;
|
filter_normalization_level=0;
|
||||||
filter_verbose=false;
|
filter_verbose=false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Open the Database
|
||||||
|
//
|
||||||
|
rda=new RDApplication("nexgen_filter","nexgen_filter",NEXGEN_FILTER_USAGE,this);
|
||||||
|
if(!rda->open(&err_msg)) {
|
||||||
|
fprintf(stderr,"nexgen_filter: %s\n",(const char *)err_msg);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Read Command Options
|
// Read Command Options
|
||||||
//
|
//
|
||||||
RDCmdSwitch *cmd=
|
|
||||||
new RDCmdSwitch(qApp->argc(),qApp->argv(),"nexgen_filter",
|
|
||||||
NEXGEN_FILTER_USAGE);
|
|
||||||
bool options=true;
|
bool options=true;
|
||||||
for(unsigned i=0;i<cmd->keys();i++) {
|
for(unsigned i=0;i<rda->cmdSwitch()->keys();i++) {
|
||||||
if(!options) {
|
if(!options) {
|
||||||
xml_files.push_back(cmd->key(i));
|
xml_files.push_back(rda->cmdSwitch()->key(i));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(cmd->key(i)=="--verbose") {
|
if(rda->cmdSwitch()->key(i)=="--verbose") {
|
||||||
filter_verbose=true;
|
filter_verbose=true;
|
||||||
cmd->setProcessed(i,true);
|
rda->cmdSwitch()->setProcessed(i,true);
|
||||||
}
|
}
|
||||||
if(cmd->key(i)=="--group") {
|
if(rda->cmdSwitch()->key(i)=="--group") {
|
||||||
group_name=cmd->value(i);
|
group_name=rda->cmdSwitch()->value(i);
|
||||||
cmd->setProcessed(i,true);
|
rda->cmdSwitch()->setProcessed(i,true);
|
||||||
}
|
}
|
||||||
if(cmd->key(i)=="--audio-dir") {
|
if(rda->cmdSwitch()->key(i)=="--audio-dir") {
|
||||||
audio_dir=cmd->value(i);
|
audio_dir=rda->cmdSwitch()->value(i);
|
||||||
cmd->setProcessed(i,true);
|
rda->cmdSwitch()->setProcessed(i,true);
|
||||||
}
|
}
|
||||||
if(cmd->key(i)=="--reject-dir") {
|
if(rda->cmdSwitch()->key(i)=="--reject-dir") {
|
||||||
reject_dir=cmd->value(i);
|
reject_dir=rda->cmdSwitch()->value(i);
|
||||||
cmd->setProcessed(i,true);
|
rda->cmdSwitch()->setProcessed(i,true);
|
||||||
}
|
}
|
||||||
if(cmd->key(i)=="--cart-offset") {
|
if(rda->cmdSwitch()->key(i)=="--cart-offset") {
|
||||||
filter_cart_offset=cmd->value(i).toInt(&ok);
|
filter_cart_offset=rda->cmdSwitch()->value(i).toInt(&ok);
|
||||||
if(!ok) {
|
if(!ok) {
|
||||||
fprintf(stderr,"nexgen_filter: --cart-offset must be an integer\n");
|
fprintf(stderr,"nexgen_filter: --cart-offset must be an integer\n");
|
||||||
exit(256);
|
exit(256);
|
||||||
}
|
}
|
||||||
cmd->setProcessed(i,true);
|
rda->cmdSwitch()->setProcessed(i,true);
|
||||||
}
|
}
|
||||||
if(cmd->key(i)=="--delete-cuts") {
|
if(rda->cmdSwitch()->key(i)=="--delete-cuts") {
|
||||||
filter_delete_cuts=true;
|
filter_delete_cuts=true;
|
||||||
cmd->setProcessed(i,true);
|
rda->cmdSwitch()->setProcessed(i,true);
|
||||||
}
|
}
|
||||||
if(cmd->key(i)=="--normalization-level") {
|
if(rda->cmdSwitch()->key(i)=="--normalization-level") {
|
||||||
filter_normalization_level=cmd->value(i).toInt(&ok);
|
filter_normalization_level=rda->cmdSwitch()->value(i).toInt(&ok);
|
||||||
if(!ok) {
|
if(!ok) {
|
||||||
fprintf(stderr,"nexgen_filter: --cart-offset must be an integer\n");
|
fprintf(stderr,"nexgen_filter: --cart-offset must be an integer\n");
|
||||||
exit(256);
|
exit(256);
|
||||||
@ -119,51 +121,19 @@ MainObject::MainObject(QObject *parent)
|
|||||||
"nexgen_filter: positive --normalization-level is invalid\n");
|
"nexgen_filter: positive --normalization-level is invalid\n");
|
||||||
exit(256);
|
exit(256);
|
||||||
}
|
}
|
||||||
cmd->setProcessed(i,true);
|
rda->cmdSwitch()->setProcessed(i,true);
|
||||||
}
|
}
|
||||||
if(!cmd->processed(i)) {
|
if(!rda->cmdSwitch()->processed(i)) {
|
||||||
options=false;
|
options=false;
|
||||||
xml_files.push_back(cmd->key(i));
|
xml_files.push_back(rda->cmdSwitch()->key(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete cmd;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Open Config
|
|
||||||
//
|
|
||||||
rdconfig=new RDConfig(RD_CONF_FILE);
|
|
||||||
rdconfig->load();
|
|
||||||
rdconfig->setModuleName("nexgen_filter");
|
|
||||||
|
|
||||||
//
|
|
||||||
// Open Database
|
|
||||||
//
|
|
||||||
filter_db=QSqlDatabase::addDatabase(rdconfig->mysqlDriver());
|
|
||||||
if(!filter_db) {
|
|
||||||
fprintf(stderr,"nexgen_filter: can't open mySQL database\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
filter_db->setDatabaseName(rdconfig->mysqlDbname());
|
|
||||||
filter_db->setUserName(rdconfig->mysqlUsername());
|
|
||||||
filter_db->setPassword(rdconfig->mysqlPassword());
|
|
||||||
filter_db->setHostName(rdconfig->mysqlHostname());
|
|
||||||
if(!filter_db->open()) {
|
|
||||||
fprintf(stderr,"nexgen_filter: unable to connect to mySQL Server\n");
|
|
||||||
filter_db->removeDatabase(rdconfig->mysqlDbname());
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Station Configuration
|
|
||||||
//
|
|
||||||
filter_rdstation=new RDStation(rdconfig->stationName());
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// RIPCD Connection
|
// RIPCD Connection
|
||||||
//
|
//
|
||||||
filter_ripc=new RDRipc(filter_rdstation,rdconfig,this);
|
rda->ripc()->connectHost("localhost",RIPCD_TCP_PORT,rda->config()->password());
|
||||||
filter_ripc->connectHost("localhost",RIPCD_TCP_PORT,rdconfig->password());
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Validate Arguments
|
// Validate Arguments
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// A Library import filter for the Prophet NexGen system
|
// A Library import filter for the Prophet NexGen system
|
||||||
//
|
//
|
||||||
// (C) Copyright 2012 Fred Gleason <fredg@paravelsystems.com>
|
// (C) Copyright 2012,2018 Fred Gleason <fredg@paravelsystems.com>
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// 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
|
// it under the terms of the GNU General Public License version 2 as
|
||||||
@ -23,14 +23,11 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <qobject.h>
|
|
||||||
#include <qapplication.h>
|
#include <qapplication.h>
|
||||||
#include <qsqldatabase.h>
|
|
||||||
#include <qdatetime.h>
|
#include <qdatetime.h>
|
||||||
#include <qdir.h>
|
#include <qdir.h>
|
||||||
|
#include <qobject.h>
|
||||||
|
|
||||||
#include <rdstation.h>
|
|
||||||
#include <rdripc.h>
|
|
||||||
#include <rdgroup.h>
|
#include <rdgroup.h>
|
||||||
#include <rdwavedata.h>
|
#include <rdwavedata.h>
|
||||||
|
|
||||||
@ -65,9 +62,6 @@ class MainObject : public QObject
|
|||||||
int filter_cart_offset;
|
int filter_cart_offset;
|
||||||
bool filter_delete_cuts;
|
bool filter_delete_cuts;
|
||||||
int filter_normalization_level;
|
int filter_normalization_level;
|
||||||
RDStation *filter_rdstation;
|
|
||||||
RDRipc *filter_ripc;
|
|
||||||
QSqlDatabase *filter_db;
|
|
||||||
bool filter_verbose;
|
bool filter_verbose;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user