mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-07-23 07:58:09 +02:00
2018-02-01 Fred Gleason <fredg@paravelsystems.com>
* Converted rddgimport(1) to use RDApplication.
This commit is contained in:
parent
0e47266a4d
commit
914d903dc6
@ -16627,3 +16627,5 @@
|
||||
* Converted rddelete(1) to use RDApplication.
|
||||
2018-02-01 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added an 'RDApplication::userChanged() signal.
|
||||
2018-02-01 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Converted rddgimport(1) to use RDApplication.
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// A Qt-based application for importing Dial Global CDN downloads
|
||||
//
|
||||
// (C) Copyright 2012,2016 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2012,2016-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// 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
|
||||
@ -30,33 +30,48 @@
|
||||
#include <qstringlist.h>
|
||||
#include <qfile.h>
|
||||
|
||||
#include <rdescape_string.h>
|
||||
#include <rdcmd_switch.h>
|
||||
#include <rdconf.h>
|
||||
#include <rddatedialog.h>
|
||||
#include <rdgroup.h>
|
||||
#include <rdcart.h>
|
||||
#include <rdcut.h>
|
||||
#include <rdapplication.h>
|
||||
#include <rdaudioimport.h>
|
||||
#include <rdcart.h>
|
||||
#include <rdconf.h>
|
||||
#include <rdcut.h>
|
||||
#include <rddatedecode.h>
|
||||
#include <rddatedialog.h>
|
||||
#include <rdescape_string.h>
|
||||
#include <rdgroup.h>
|
||||
|
||||
#include <rddgimport.h>
|
||||
#include "rddgimport.h"
|
||||
|
||||
MainWidget::MainWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
dg_user=NULL;
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
QString err_msg;
|
||||
|
||||
dg_group=NULL;
|
||||
dg_svc=NULL;
|
||||
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
//
|
||||
// Open the Database
|
||||
//
|
||||
rda=new RDApplication("RDDgImport","rddgimport",RDDGIMPORT_USAGE,this);
|
||||
if(!rda->open(&err_msg)) {
|
||||
QMessageBox::critical(this,"RDDgImport - "+tr("Error"),err_msg);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//
|
||||
// Read Command Options
|
||||
//
|
||||
RDCmdSwitch *cmd=new RDCmdSwitch(qApp->argc(),qApp->argv(),"rddgimport","\n");
|
||||
delete cmd;
|
||||
for(unsigned i=0;i<rda->cmdSwitch()->keys();i++) {
|
||||
if(!rda->cmdSwitch()->processed(i)) {
|
||||
QMessageBox::critical(this,"RDDgImport - "+tr("Error"),
|
||||
tr("Unknown command option")+": "+
|
||||
rda->cmdSwitch()->key(i));
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Set Window Size
|
||||
@ -66,33 +81,6 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
|
||||
SetCaption();
|
||||
|
||||
//
|
||||
// Load Local Configs
|
||||
//
|
||||
dg_config=new RDConfig();
|
||||
dg_config->load();
|
||||
dg_config->setModuleName("RDDgiImport");
|
||||
|
||||
//
|
||||
// Open Database
|
||||
//
|
||||
dg_db=QSqlDatabase::addDatabase(dg_config->mysqlDriver());
|
||||
if(!dg_db) {
|
||||
QMessageBox::warning(this,tr("Database Error"),
|
||||
tr("Can't Connect","Unable to connect to mySQL Server!"));
|
||||
exit(0);
|
||||
}
|
||||
dg_db->setDatabaseName(dg_config->mysqlDbname());
|
||||
dg_db->setUserName(dg_config->mysqlUsername());
|
||||
dg_db->setPassword(dg_config->mysqlPassword());
|
||||
dg_db->setHostName(dg_config->mysqlHostname());
|
||||
if(!dg_db->open()) {
|
||||
QMessageBox::warning(this,tr("Can't Connect"),
|
||||
tr("Unable to connect to mySQL Server!"));
|
||||
dg_db->removeDatabase(dg_config->mysqlDbname());
|
||||
exit(0);
|
||||
}
|
||||
|
||||
//
|
||||
// Fonts
|
||||
//
|
||||
@ -105,11 +93,8 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
//
|
||||
// Configuration Elements
|
||||
//
|
||||
dg_station=new RDStation(dg_config->stationName(),this);
|
||||
dg_library_conf=new RDLibraryConf(dg_config->stationName());
|
||||
dg_ripc=new RDRipc(dg_station,dg_config,this);
|
||||
connect(dg_ripc,SIGNAL(userChanged()),this,SLOT(userChangedData()));
|
||||
dg_ripc->connectHost("localhost",RIPCD_TCP_PORT,dg_config->password());
|
||||
connect(rda,SIGNAL(userChanged()),this,SLOT(userChangedData()));
|
||||
rda->ripc()->connectHost("localhost",RIPCD_TCP_PORT,rda->config()->password());
|
||||
|
||||
//
|
||||
// Service Selector
|
||||
@ -209,7 +194,7 @@ void MainWidget::serviceActivatedData(int index)
|
||||
if(dg_svc!=NULL) {
|
||||
delete dg_svc;
|
||||
}
|
||||
dg_svc=new RDSvc(dg_service_box->currentText(),dg_station,dg_config);
|
||||
dg_svc=new RDSvc(dg_service_box->currentText(),rda->station(),rda->config());
|
||||
if(dg_group!=NULL) {
|
||||
delete dg_group;
|
||||
}
|
||||
@ -269,10 +254,6 @@ void MainWidget::processData()
|
||||
|
||||
void MainWidget::userChangedData()
|
||||
{
|
||||
if(dg_user!=NULL) {
|
||||
delete dg_user;
|
||||
}
|
||||
dg_user=new RDUser(dg_ripc->user());
|
||||
SetCaption();
|
||||
}
|
||||
|
||||
@ -304,9 +285,7 @@ void MainWidget::resizeEvent(QResizeEvent *e)
|
||||
void MainWidget::SetCaption()
|
||||
{
|
||||
QString username=tr("[unknown]");
|
||||
if(dg_user!=NULL) {
|
||||
username=dg_user->name();
|
||||
}
|
||||
username=rda->user()->name();
|
||||
setCaption(tr("RDDgImport")+" v"+VERSION+" "+tr("User")+": "+username);
|
||||
}
|
||||
|
||||
@ -391,8 +370,8 @@ bool MainWidget::WriteTrafficFile()
|
||||
// Open Output File
|
||||
//
|
||||
outname=RDDateDecode(dg_svc->importPath(RDSvc::Traffic,RDSvc::Linux),
|
||||
dg_date_edit->date(),dg_station,
|
||||
dg_config,dg_svc->name());
|
||||
dg_date_edit->date(),rda->station(),
|
||||
rda->config(),dg_svc->name());
|
||||
if((f=fopen(outname,"w"))==NULL) {
|
||||
LogMessage(tr("WARNING: Unable to open traffic output file")+" \""+
|
||||
outname+"\" ["+strerror(errno)+"].");
|
||||
@ -495,8 +474,8 @@ bool MainWidget::ImportSpot(Event *evt,QString *err_msg)
|
||||
//
|
||||
// Initialize Audio Importer
|
||||
//
|
||||
settings.setNormalizationLevel(dg_library_conf->ripperLevel()/100);
|
||||
settings.setChannels(dg_library_conf->defaultChannels());
|
||||
settings.setNormalizationLevel(rda->libraryConf()->ripperLevel()/100);
|
||||
settings.setChannels(rda->libraryConf()->defaultChannels());
|
||||
|
||||
if((dg_carts[evt->isci()]=dg_group->nextFreeCart())==0) {
|
||||
LogMessage(tr("Unable to allocate new cart for")+" "+evt->isci()+" ["+
|
||||
@ -514,9 +493,9 @@ bool MainWidget::ImportSpot(Event *evt,QString *err_msg)
|
||||
}
|
||||
cart=new RDCart(dg_carts[evt->isci()]);
|
||||
|
||||
if((cutnum=cart->addCut(dg_library_conf->defaultLayer(),
|
||||
dg_library_conf->defaultBitrate(),
|
||||
dg_library_conf->defaultChannels(),
|
||||
if((cutnum=cart->addCut(rda->libraryConf()->defaultLayer(),
|
||||
rda->libraryConf()->defaultBitrate(),
|
||||
rda->libraryConf()->defaultChannels(),
|
||||
evt->isci(),evt->title()))<0) {
|
||||
LogMessage(tr("WARNING: Unable to create cut for cart")+" \""+
|
||||
QString().sprintf("%u",dg_carts[evt->isci()])+"\".");
|
||||
@ -529,14 +508,14 @@ bool MainWidget::ImportSpot(Event *evt,QString *err_msg)
|
||||
addDays(RDDGIMPORT_KILLDATE_OFFSET),
|
||||
QTime(23,59,59)),true);
|
||||
|
||||
conv=new RDAudioImport(dg_station,dg_config,this);
|
||||
conv=new RDAudioImport(rda->station(),rda->config(),this);
|
||||
conv->setCartNumber(dg_carts[evt->isci()]);
|
||||
conv->setCutNumber(cutnum);
|
||||
conv->setSourceFile(audiofile);
|
||||
conv->setDestinationSettings(&settings);
|
||||
conv->setUseMetadata(false);
|
||||
conv_err=conv->
|
||||
runImport(dg_user->name(),dg_user->password(),&audio_conv_err);
|
||||
runImport(rda->user()->name(),rda->user()->password(),&audio_conv_err);
|
||||
switch(conv_err) {
|
||||
case RDAudioImport::ErrorOk:
|
||||
break;
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// A Qt-based application for importing Dial Global CDN downloads
|
||||
//
|
||||
// (C) Copyright 2012,2016 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2012,2016-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// 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
|
||||
@ -35,17 +35,12 @@
|
||||
#include <qdatetimeedit.h>
|
||||
#include <qtextedit.h>
|
||||
|
||||
#include <rdconfig.h>
|
||||
#include <rdbusybar.h>
|
||||
#include <rddb.h>
|
||||
#include <rdgroup.h>
|
||||
#include <rdlibrary_conf.h>
|
||||
#include <rdstation.h>
|
||||
#include <rdbusybar.h>
|
||||
#include <rdsvc.h>
|
||||
#include <rduser.h>
|
||||
#include <rdripc.h>
|
||||
|
||||
#include <event.h>
|
||||
#include "event.h"
|
||||
|
||||
#define RDDGIMPORT_USAGE "\n"
|
||||
#define RDDGIMPORT_KILLDATE_OFFSET 7
|
||||
@ -100,12 +95,6 @@ class MainWidget : public QWidget
|
||||
std::vector<Event *> dg_events;
|
||||
RDGroup *dg_group;
|
||||
RDSvc *dg_svc;
|
||||
RDRipc *dg_ripc;
|
||||
RDUser *dg_user;
|
||||
RDStation *dg_station;
|
||||
RDLibraryConf *dg_library_conf;
|
||||
RDConfig *dg_config;
|
||||
QSqlDatabase *dg_db;
|
||||
};
|
||||
|
||||
|
||||
|
@ -29,23 +29,6 @@
|
||||
<source>Unable to open source file</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Database Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Can't Connect</source>
|
||||
<comment>Unable to connect to mySQL Server!</comment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Can't Connect</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to connect to mySQL Server!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to find event for ISCI code</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -110,5 +93,9 @@
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unknown command option</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -29,23 +29,6 @@
|
||||
<source>Unable to open source file</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Database Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Can't Connect</source>
|
||||
<comment>Unable to connect to mySQL Server!</comment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Can't Connect</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to connect to mySQL Server!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to find event for ISCI code</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -110,5 +93,9 @@
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unknown command option</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -29,23 +29,6 @@
|
||||
<source>Unable to open source file</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Database Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Can't Connect</source>
|
||||
<comment>Unable to connect to mySQL Server!</comment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Can't Connect</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to connect to mySQL Server!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to find event for ISCI code</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -110,5 +93,9 @@
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unknown command option</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -29,23 +29,6 @@
|
||||
<source>Unable to open source file</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Database Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Can't Connect</source>
|
||||
<comment>Unable to connect to mySQL Server!</comment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Can't Connect</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to connect to mySQL Server!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to find event for ISCI code</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -110,5 +93,9 @@
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unknown command option</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -29,23 +29,6 @@
|
||||
<source>Unable to open source file</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Database Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Can't Connect</source>
|
||||
<comment>Unable to connect to mySQL Server!</comment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Can't Connect</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to connect to mySQL Server!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to find event for ISCI code</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -110,5 +93,9 @@
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unknown command option</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -29,23 +29,6 @@
|
||||
<source>Unable to open source file</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Database Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Can't Connect</source>
|
||||
<comment>Unable to connect to mySQL Server!</comment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Can't Connect</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to connect to mySQL Server!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to find event for ISCI code</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -110,5 +93,9 @@
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unknown command option</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
Loading…
x
Reference in New Issue
Block a user