2017-10-14 Fred Gleason <fredg@paravelsystems.com>

* Implemented a '%r' wildcard for Rivendell Host Name.
This commit is contained in:
Fred Gleason 2017-10-14 10:38:55 -04:00
parent 162ebe545b
commit fb9487810b
43 changed files with 211 additions and 156 deletions

View File

@ -16094,3 +16094,5 @@
methods.
* Added a 'Set End Date/Time' control to the 'Edit Group' dialog in
RDAdmin(1).
2017-10-14 Fred Gleason <fredg@paravelsystems.com>
* Implemented a '%r' wildcard for Rivendell Host Name.

View File

@ -83,7 +83,7 @@ where:
Q -- [unassigned]
r -- [unassigned]
r -- Rivendell Host Name [not FQDN]
R -- [unassigned]

View File

@ -2,7 +2,7 @@
//
// Export a Rivendell Report to BMI EMR Format
//
// (C) Copyright 2002-2006,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2006,2016-2017 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
@ -39,11 +39,11 @@ bool RDReport::ExportBmiEmr(const QDate &startdate,const QDate &enddate,
QString station_format=stationFormat();
#ifdef WIN32
QString filename=
RDDateDecode(exportPath(RDReport::Windows),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Windows),startdate,
report_config,serviceName());
#else
QString filename=
RDDateDecode(exportPath(RDReport::Linux),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Linux),startdate,
report_config,serviceName());
#endif
//

View File

@ -2,7 +2,7 @@
//
// Export a Rivendell Cut Report.
//
// (C) Copyright 2002-2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2017 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
@ -41,11 +41,11 @@ bool RDReport::ExportCutLog(const QDate &startdate,const QDate &enddate,
QString cart_num;
#ifdef WIN32
QString filename=
RDDateDecode(exportPath(RDReport::Windows),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Windows),startdate,
report_config,serviceName());
#else
QString filename=
RDDateDecode(exportPath(RDReport::Linux),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Linux),startdate,
report_config,serviceName());
#endif
QFile file(filename);

View File

@ -2,7 +2,7 @@
//
// Export a Rivendell Report to CBSI DeltaFlex
//
// (C) Copyright 2002-2005,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2005,2016-2017 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
@ -43,11 +43,11 @@ bool RDReport::ExportDeltaflex(const QDate &startdate,const QDate &enddate,
QString air_fmt;
#ifdef WIN32
QString filename=
RDDateDecode(exportPath(RDReport::Windows),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Windows),startdate,
report_config,serviceName());
#else
QString filename=
RDDateDecode(exportPath(RDReport::Linux),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Linux),startdate,
report_config,serviceName());
#endif
QFile file(filename);

View File

@ -2,7 +2,7 @@
//
// Export a Rivendell Classical Music Playout report
//
// (C) Copyright 2014,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2014,2016-2017 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
@ -41,11 +41,11 @@ bool RDReport::ExportMusicClassical(const QDate &startdate,const QDate &enddate,
QString cart_num;
#ifdef WIN32
QString filename=
RDDateDecode(exportPath(RDReport::Windows),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Windows),startdate,
report_config,serviceName());
#else
QString filename=
RDDateDecode(exportPath(RDReport::Linux),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Linux),startdate,
report_config,serviceName());
#endif
QFile file(filename);

View File

@ -2,7 +2,7 @@
//
// Export a Rivendell Report to an ASCII Text File.
//
// (C) Copyright 2012,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2012,2016-2017 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
@ -41,11 +41,11 @@ bool RDReport::ExportMusicPlayout(const QDate &startdate,const QDate &enddate,
QString cart_num;
#ifdef WIN32
QString filename=
RDDateDecode(exportPath(RDReport::Windows),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Windows),startdate,
report_config,serviceName());
#else
QString filename=
RDDateDecode(exportPath(RDReport::Linux),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Linux),startdate,
report_config,serviceName());
#endif
QFile file(filename);

View File

@ -2,7 +2,7 @@
//
// Export a Rivendell Report to an ASCII Text File.
//
// (C) Copyright 2012,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2012,2016-2017 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
@ -40,11 +40,11 @@ bool RDReport::ExportMusicSummary(const QDate &startdate,const QDate &enddate,
QString str;
#ifdef WIN32
QString filename=
RDDateDecode(exportPath(RDReport::Windows),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Windows),startdate,
report_config,serviceName());
#else
QString filename=
RDDateDecode(exportPath(RDReport::Linux),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Linux),startdate,
report_config,serviceName());
#endif
QFile file(filename);

View File

@ -2,7 +2,7 @@
//
// Export a Rivendell NPR SoundExchange Report to an ASCII Text File.
//
// (C) Copyright 2002-2006,2013,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2006,2013,2016-2017 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
@ -51,11 +51,11 @@ bool RDReport::ExportNprSoundEx(const QDate &startdate,const QDate &enddate,
QString channel_name=stationId();
#ifdef WIN32
QString filename=
RDDateDecode(exportPath(RDReport::Windows),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Windows),startdate,
report_config,serviceName());
#else
QString filename=
RDDateDecode(exportPath(RDReport::Linux),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Linux),startdate,
report_config,serviceName());
#endif
if((f=fopen(filename,"wb"))==NULL) {
report_error_code=RDReport::ErrorCantOpen;

View File

@ -2,7 +2,7 @@
//
// Export a Rivendell Report to RadioTraffic.com
//
// (C) Copyright 2002-2005,2009,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2005,2009,2016-2017 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
@ -38,11 +38,11 @@ bool RDReport::ExportRadioTraffic(const QDate &startdate,const QDate &enddate,
QString air_fmt;
#ifdef WIN32
QString filename=
RDDateDecode(exportPath(RDReport::Windows),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Windows),startdate,
report_config,serviceName());
#else
QString filename=
RDDateDecode(exportPath(RDReport::Linux),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Linux),startdate,
report_config,serviceName());
#endif
QFile file(filename);

View File

@ -2,7 +2,7 @@
//
// Export a Rivendell SoundExchange Report to an ASCII Text File.
//
// (C) Copyright 2002-2006,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2006,2016-2017 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
@ -48,11 +48,11 @@ bool RDReport::ExportSoundEx(const QDate &startdate,const QDate &enddate,
QString channel_name=stationId();
#ifdef WIN32
QString filename=
RDDateDecode(exportPath(RDReport::Windows),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Windows),startdate,
report_config,serviceName());
#else
QString filename=
RDDateDecode(exportPath(RDReport::Linux),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Linux),startdate,
report_config,serviceName());
#endif
//

View File

@ -2,7 +2,7 @@
//
// Export a Rivendell Spin Count Report to an ASCII Text File.
//
// (C) Copyright 2015 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2015,2017 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
@ -50,11 +50,11 @@ bool RDReport::ExportSpinCount(const QDate &startdate,const QDate &enddate,
#ifdef WIN32
QString filename=
RDDateDecode(exportPath(RDReport::Windows),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Windows),startdate,
report_config,serviceName());
#else
QString filename=
RDDateDecode(exportPath(RDReport::Linux),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Linux),startdate,
report_config,serviceName());
#endif
QFile file(filename);

View File

@ -2,7 +2,7 @@
//
// Export a Rivendell Technical Report to an ASCII Text File.
//
// (C) Copyright 2002-2006,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2006,2016-2017 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
@ -44,11 +44,11 @@ bool RDReport::ExportTechnical(const QDate &startdate,const QDate &enddate,
char eol[3]="\n";
#ifdef WIN32
QString filename=
RDDateDecode(exportPath(RDReport::Windows),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Windows),startdate,
report_config,serviceName());
#else
QString filename=
RDDateDecode(exportPath(RDReport::Linux),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Linux),startdate,
report_config,serviceName());
if(incl_crs) {
strcpy(eol,"\r\n");
}

View File

@ -2,7 +2,7 @@
//
// Export a Rivendell Report to an ASCII Text File.
//
// (C) Copyright 2002-2005,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2005,2016-2017 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
@ -42,11 +42,11 @@ bool RDReport::ExportTextLog(const QDate &startdate,const QDate &enddate,
QString cart_num;
#ifdef WIN32
QString filename=
RDDateDecode(exportPath(RDReport::Windows),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Windows),startdate,
report_config,serviceName());
#else
QString filename=
RDDateDecode(exportPath(RDReport::Linux),startdate,serviceName());
QString filename=RDDateDecode(exportPath(RDReport::Linux),startdate,
report_config,serviceName());
#endif
QFile file(filename);

View File

@ -22,7 +22,8 @@
#include <rddatedecode.h>
QString RDDateDecode(QString str,const QDate &date,const QString &svcname)
QString RDDateDecode(QString str,const QDate &date,RDConfig *config,
const QString &svcname)
{
QString string;
int yearnum;
@ -117,6 +118,10 @@ QString RDDateDecode(QString str,const QDate &date,const QString &svcname)
field=QString().sprintf("%02d",date.month());
break;
case 'r': // Rivendell Host Name
field=config->stationName();
break;
case 's': // Service name
if(!svcname.isEmpty()) {
field=svcname;
@ -171,7 +176,7 @@ QString RDDateDecode(QString str,const QDate &date,const QString &svcname)
QString RDDateTimeDecode(QString str,const QDateTime &datetime,
const QString &svcname)
RDConfig *config,const QString &svcname)
{
QString string;
int yearnum;
@ -294,6 +299,10 @@ QString RDDateTimeDecode(QString str,const QDateTime &datetime,
field=datetime.time().toString("ap");
break;
case 'r': // Rivendell Host Name
field=config->stationName();
break;
case 'S': // Second (SS)
field=QString().sprintf("%02d",datetime.time().second());
break;

View File

@ -23,9 +23,12 @@
#include <qdatetime.h>
QString RDDateDecode(QString str,const QDate &date,const QString &svcname="");
#include <rdconfig.h>
QString RDDateDecode(QString str,const QDate &date,RDConfig *config,
const QString &svcname="");
QString RDDateTimeDecode(QString str,const QDateTime &datetime,
const QString &svcname="");
RDConfig *config,const QString &svcname="");
#endif // RDDATEDECODE

View File

@ -32,9 +32,10 @@
#include <rdescape_string.h>
#include <rddatedecode.h>
RDReport::RDReport(const QString &rptname,QObject *parent)
RDReport::RDReport(const QString &rptname,RDConfig *config,QObject *parent)
{
report_name=rptname;
report_config=config;
report_error_code=RDReport::ErrorOk;
}
@ -311,9 +312,11 @@ bool RDReport::outputExists(const QDate &startdate)
{
QString out_path;
#ifdef WIN32
out_path=RDDateDecode(exportPath(RDReport::Windows),startdate);
out_path=RDDateDecode(exportPath(RDReport::Windows),startdate,report_config,
serviceName());
#else
out_path=RDDateDecode(exportPath(RDReport::Linux),startdate);
out_path=RDDateDecode(exportPath(RDReport::Linux),startdate,report_config,
serviceName());
#endif
return QFile::exists(out_path);
}
@ -448,7 +451,7 @@ bool RDReport::generateReport(const QDate &startdate,const QDate &enddate,
(const char *)name());
q=new RDSqlQuery(sql);
while(q->next()) {
svc=new RDSvc(q->value(0).toString());
svc=new RDSvc(q->value(0).toString(),report_config);
if(svc->exists()) {
rec_name=q->value(0).toString();
rec_name.replace(" ","_");
@ -672,10 +675,13 @@ bool RDReport::generateReport(const QDate &startdate,const QDate &enddate,
}
#ifdef WIN32
*out_path=RDDateDecode(exportPath(RDReport::Windows),startdate);
QString post_cmd=RDDateDecode(postExportCommand(RDReport::Windows),startdate);
QString post_cmd=RDDateDecode(postExportCommand(RDReport::Windows),startdate,
report_config,serviceName());
#else
*out_path=RDDateDecode(exportPath(RDReport::Linux),startdate);
QString post_cmd=RDDateDecode(postExportCommand(RDReport::Linux),startdate);
*out_path=RDDateDecode(exportPath(RDReport::Linux),startdate,report_config,
serviceName());
QString post_cmd=RDDateDecode(postExportCommand(RDReport::Linux),startdate,
report_config,serviceName());
#endif
system(post_cmd);
// printf("MIXDOWN TABLE: %s_SRT\n",(const char *)mixname);

View File

@ -2,7 +2,7 @@
//
// Abstract a Rivendell Report Descriptor
//
// (C) Copyright 2002-2006,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2006,2017 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
@ -24,9 +24,10 @@
#include <qobject.h>
#include <qsqldatabase.h>
#include <rdconfig.h>
#include <rdlog_line.h>
#include <rdstation.h>
#include <rdsvc.h>
#include <rdlog_line.h>
class RDReport
{
@ -41,7 +42,7 @@ class RDReport
enum ExportType {Generic=0,Traffic=1,Music=2};
enum StationType {TypeOther=0,TypeAm=1,TypeFm=2,TypeLast=3};
enum ErrorCode {ErrorOk=0,ErrorCanceled=1,ErrorCantOpen=2};
RDReport(const QString &rptname,QObject *parent=0);
RDReport(const QString &rptname,RDConfig *config,QObject *parent=0);
QString name() const;
bool exists() const;
QString description() const;
@ -127,6 +128,7 @@ class RDReport
QString OsFieldName(ExportOs os) const;
QString TypeFieldName(ExportType type,bool forced) const;
QString report_name;
RDConfig *report_config;
RDReport::ErrorCode report_error_code;
};

View File

@ -34,10 +34,11 @@
//
// Global Classes
//
RDSvc::RDSvc(QString svcname,QObject *parent)
RDSvc::RDSvc(QString svcname,RDConfig *config,QObject *parent)
: QObject(parent)
{
svc_name=svcname;
svc_config=config;
}
@ -337,7 +338,7 @@ QString RDSvc::importFilename(ImportSource src,const QDate &date) const
QString ret;
RDSqlQuery *q=new RDSqlQuery(sql);
if(q->first()) {
ret=RDDateDecode(q->value(0).toString(),date);
ret=RDDateDecode(q->value(0).toString(),date,svc_config,svc_name);
}
delete q;
return ret;
@ -417,7 +418,8 @@ bool RDSvc::import(ImportSource src,const QDate &date,const QString &break_str,
//
// Open Source File
//
if((infile=fopen(RDDateDecode(infilename,date),"r"))==NULL) {
if((infile=fopen(RDDateDecode(infilename,date,svc_config,svc_name),"r"))==
NULL) {
return false;
}
@ -425,7 +427,7 @@ bool RDSvc::import(ImportSource src,const QDate &date,const QString &break_str,
// Run Preimport Command
//
if(!preimport_cmd.isEmpty()) {
system(RDDateDecode(preimport_cmd,date));
system(RDDateDecode(preimport_cmd,date,svc_config,svc_name));
}
QString parser_table;
@ -733,7 +735,7 @@ bool RDSvc::generateLog(const QDate &date,const QString &logname,
MODIFIED_DATETIME=now(),START_DATE=null,\
END_DATE=null,NEXT_ID=0",
(const char *)RDEscapeString(svc_name),
(const char *)RDEscapeString(RDDateDecode(descriptionTemplate(),date)),
(const char *)RDEscapeString(RDDateDecode(descriptionTemplate(),date,svc_config,svc_name)),
"RDLogManager");
if(!purge_date.isValid()) {
sql+=(",PURGE_DATE=\""+purge_date.toString("yyyy-MM-dd")+"\"");
@ -755,7 +757,7 @@ bool RDSvc::generateLog(const QDate &date,const QString &logname,
PURGE_DATE=%s",
(const char *)RDEscapeString(logname),
(const char *)RDEscapeString(svc_name),
(const char *)RDEscapeString(RDDateDecode(descriptionTemplate(),date)),
(const char *)RDEscapeString(RDDateDecode(descriptionTemplate(),date,svc_config,svc_name)),
"RDLogManager",
(const char *)RDCheckDateTime(purge_date,"yyyy-MM-dd"));
q=new RDSqlQuery(sql);

View File

@ -26,6 +26,8 @@
#include <qobject.h>
#include <qsqldatabase.h>
#include <rdconfig.h>
class RDSvc : public QObject
{
Q_OBJECT
@ -35,7 +37,7 @@ class RDSvc : public QObject
enum ImportField {CartNumber=0,ExtData=3,ExtEventId=4,ExtAnncType=5,
Title=6,StartHours=7,StartMinutes=8,StartSeconds=9,
LengthHours=10,LengthMinutes=11,LengthSeconds=12};
RDSvc(QString svcname,QObject *parent=0);
RDSvc(QString svcname,RDConfig *config,QObject *parent=0);
QString name() const;
bool exists() const;
QString description() const;
@ -109,6 +111,7 @@ class RDSvc : public QObject
QString *label_cart,QString *track_cart);
bool CheckId(std::vector<int> *v,int value);
QString svc_name;
RDConfig *svc_config;
};

View File

@ -31,11 +31,13 @@
#include <qbuttongroup.h>
#include <rddb.h>
#include <edit_svc.h>
#include <add_svc.h>
#include <rdpasswd.h>
#include <rdtextvalidator.h>
#include "add_svc.h"
#include "edit_svc.h"
#include "globals.h"
AddSvc::AddSvc(QString *svcname,QWidget *parent)
: QDialog(parent,"",true)
{
@ -145,7 +147,7 @@ void AddSvc::okData()
return;
}
RDSvc *svc=new RDSvc(svc_name_edit->text(),this);
RDSvc *svc=new RDSvc(svc_name_edit->text(),admin_config,this);
if(svc->exists()) {
QMessageBox::warning(this,tr("Service Exists"),
tr("Service Already Exists!"));

View File

@ -2588,7 +2588,7 @@ bool InitDb(QString name,QString pwd,QString station_name)
//
// Create Default Service
//
RDSvc *svc=new RDSvc(RD_SERVICE_NAME);
RDSvc *svc=new RDSvc(RD_SERVICE_NAME,admin_config);
svc->create("");
svc->setDescription(RD_SERVICE_DESCRIPTION);
delete svc;

View File

@ -34,10 +34,11 @@
#include <rd.h>
#include <rdtextvalidator.h>
#include <edit_report.h>
#include <test_import.h>
#include <autofill_carts.h>
#include <edit_svc_perms.h>
#include "autofill_carts.h"
#include "edit_report.h"
#include "edit_svc_perms.h"
#include "globals.h"
#include "test_import.h"
EditReport::EditReport(QString rptname,QWidget *parent)
: QDialog(parent,"",true)
@ -55,7 +56,7 @@ EditReport::EditReport(QString rptname,QWidget *parent)
setMinimumHeight(sizeHint().height());
setMaximumHeight(sizeHint().height());
edit_report=new RDReport(rptname);
edit_report=new RDReport(rptname,admin_config);
str=QString(tr("Edit Report"));
setCaption(QString().sprintf("%s - %s",(const char *)str,
(const char *)rptname));

View File

@ -37,10 +37,11 @@
#include <rdidvalidator.h>
#include <rdtextvalidator.h>
#include <edit_svc.h>
#include <test_import.h>
#include <autofill_carts.h>
#include <edit_svc_perms.h>
#include "autofill_carts.h"
#include "edit_svc.h"
#include "globals.h"
#include "edit_svc_perms.h"
#include "test_import.h"
EditSvc::EditSvc(QString svc,QWidget *parent)
: QDialog(parent,"",true)
@ -58,7 +59,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent)
setMinimumHeight(sizeHint().height());
setMaximumHeight(sizeHint().height());
svc_svc=new RDSvc(svc);
svc_svc=new RDSvc(svc,admin_config);
setCaption(tr("Edit Service"));

View File

@ -30,9 +30,10 @@
#include <qbuttongroup.h>
#include <rddb.h>
#include <list_svcs.h>
#include <edit_svc.h>
#include <add_svc.h>
#include "add_svc.h"
#include "edit_svc.h"
#include "globals.h"
#include "list_svcs.h"
ListSvcs::ListSvcs(QWidget *parent)
: QDialog(parent,"",true)
@ -184,7 +185,7 @@ void ListSvcs::deleteData()
}
}
delete q;
RDSvc *svc=new RDSvc(list_box->currentText());
RDSvc *svc=new RDSvc(list_box->currentText(),admin_config);
svc->remove();
delete svc;
list_box->removeItem(list_box->currentItem());

View File

@ -22,15 +22,17 @@
#include <qpainter.h>
#include <qmessagebox.h>
#include <rddatedialog.h>
#include <rdconf.h>
#include <rddb.h>
#include <test_import.h>
#include <rduser.h>
#include <rdpasswd.h>
#include <rddatedecode.h>
#include <rdlistviewitem.h>
#include <rdevent_line.h>
#include "globals.h"
#include "rdconf.h"
#include "rddatedecode.h"
#include "rddatedialog.h"
#include "rddb.h"
#include "rdevent_line.h"
#include "rdlistviewitem.h"
#include "rdpasswd.h"
#include "rduser.h"
#include "test_import.h"
TestImport::TestImport(RDSvc *svc,RDSvc::ImportSource src,QWidget *parent)
: QDialog(parent,"",true)
@ -254,7 +256,7 @@ void TestImport::dateChangedData(const QDate &date)
{
test_filename_edit->
setText(RDDateDecode(test_svc->importPath(test_src,RDSvc::Linux),date,
test_svc->name()));
admin_config,test_svc->name()));
}

View File

@ -162,7 +162,8 @@ MainWidget::MainWidget(QWidget *parent)
for(unsigned k=0;k<cmd->value(j).length();k++) {
if(cmd->value(j).at(k)==QChar(':')) {
air_start_logname[i]=
RDDateTimeDecode(cmd->value(j).left(k),air_startup_datetime);
RDDateTimeDecode(cmd->value(j).left(k),air_startup_datetime,
air_config);
lineno=cmd->value(j).right(cmd->value(j).length()-(k+1));
if(lineno.right(1)=="+") {
air_start_start[i]=true;
@ -969,7 +970,7 @@ void MainWidget::ripcConnected(bool state)
case RDAirPlayConf::StartPrevious:
air_start_logname[i]=
RDDateTimeDecode(rdairplay_conf->currentLog(i),
air_startup_datetime);
air_startup_datetime,air_config);
if(!air_start_logname[i].isEmpty()) {
if(rdairplay_previous_exit_code==RDAirPlayConf::ExitDirty) {
if((air_start_line[i]=rdairplay_conf->logCurrentLine(i))>=0) {
@ -987,7 +988,7 @@ void MainWidget::ripcConnected(bool state)
case RDAirPlayConf::StartSpecified:
air_start_logname[i]=
RDDateTimeDecode(rdairplay_conf->logName(i),
air_startup_datetime);
air_startup_datetime,air_config);
if(!air_start_logname[i].isEmpty()) {
if(rdairplay_previous_exit_code==RDAirPlayConf::ExitDirty) {
if(air_start_logname[i]==rdairplay_conf->currentLog(i)) {

View File

@ -85,7 +85,7 @@ void RLMHost::sendEvent(const QString &svcname,const QString &logname,
struct rlm_pad *now=new struct rlm_pad;
struct rlm_pad *next=new struct rlm_pad;
memset(svc,0,sizeof(struct rlm_svc));
RDSvc *service=new RDSvc(svcname);
RDSvc *service=new RDSvc(svcname,air_config);
if(!svcname.isEmpty()) {
sprintf(svc->svc_name,"%s",(const char *)svcname.left(255));
if(!service->programCode().isEmpty()) {

View File

@ -156,7 +156,7 @@ void MainObject::RunBatch(RDCmdSwitch *cmd)
fprintf(stderr,"rdcatchd: id %d not found\n",id);
exit(256);
}
batch_event=new CatchEvent();
batch_event=new CatchEvent(RDConfiguration());
LoadEvent(q,batch_event,false);
delete q;

View File

@ -22,8 +22,9 @@
#include <catch_event.h>
CatchEvent::CatchEvent()
CatchEvent::CatchEvent(RDConfig *config)
{
catch_config=config;
clear();
}
@ -661,7 +662,7 @@ void CatchEvent::resolveUrl(int time_offset)
}
setResolvedUrl(RDDateTimeDecode(url(),
QDateTime(date.addDays(eventdateOffset()),
current_time)));
current_time),catch_config));
}

View File

@ -23,14 +23,15 @@
#include <qtimer.h>
#include <rdrecording.h>
#include <rddeck.h>
#include <rdcae.h>
#include <rdconfig.h>
#include <rddeck.h>
#include <rdrecording.h>
class CatchEvent
{
public:
CatchEvent();
CatchEvent(RDConfig *config);
unsigned id() const;
void setId(int id);
bool isActive() const;
@ -191,6 +192,7 @@ class CatchEvent
int catch_podcast_length;
int catch_podcast_time;
int catch_eventdate_offset;
RDConfig *catch_config;
};

View File

@ -39,7 +39,7 @@ void MainObject::RunLocalMacros(RDMacro *rml)
QDateTime dt;
RDUser *user;
bool ok=false;
CatchEvent e;
CatchEvent e(RDConfiguration());
unsigned event_ptr=0;
QString sql;
RDSqlQuery *q;

View File

@ -821,7 +821,7 @@ void MainObject::engineData(int id)
catch_events[event].
setResolvedUrl(RDDateTimeDecode(catch_events[event].url(),
QDateTime(date.addDays(catch_events[event].eventdateOffset()),
current_time)));
current_time),RDConfiguration()));
StartDownloadEvent(event);
break;
@ -1911,7 +1911,7 @@ void MainObject::LoadEngine(bool adv_day)
(const char *)catch_rdstation->name());
q=new RDSqlQuery(sql);
while(q->next()) {
catch_events.push_back(CatchEvent());
catch_events.push_back(CatchEvent(RDConfiguration()));
LoadEvent(q,&catch_events.back(),true);
}
LogLine(RDConfig::LogInfo,QString().sprintf("loaded %d events",(int)catch_events.size()));
@ -2184,7 +2184,7 @@ bool MainObject::AddEvent(int id)
(const char *)catch_rdstation->name(),id);
q=new RDSqlQuery(sql);
if(q->first()) {
catch_events.push_back(CatchEvent());
catch_events.push_back(CatchEvent(RDConfiguration()));
LoadEvent(q,&catch_events.back(),true);
switch((RDRecording::Type)q->value(2).toInt()) {
case RDRecording::Recording:
@ -2685,7 +2685,7 @@ void MainObject::StartRmlRecording(int chan,int cartnum,int cutnum,int maxlen)
RDDeck *deck=new RDDeck(catch_config->stationName(),chan);
RDCut *cut=new RDCut(cartnum,cutnum);
QDateTime dt=QDateTime(QDate::currentDate(),QTime::currentTime());
catch_events.push_back(CatchEvent());
catch_events.push_back(CatchEvent(RDConfiguration()));
catch_events.back().setId(GetNextDynamicId());
catch_events.back().setIsActive(true);
catch_events.back().setOneShot(true);

View File

@ -214,7 +214,7 @@ VoiceTracker::VoiceTracker(const QString &logname,QString *import_path,
// Voicetrack Group
//
RDLog *log=new RDLog(logname);
RDSvc *svc=new RDSvc(log->service());
RDSvc *svc=new RDSvc(log->service(),log_config);
track_group=new RDGroup(svc->trackGroup());
track_tracks=log->scheduledTracks()-log->completedTracks();
delete svc;

View File

@ -77,13 +77,14 @@ int RunLogOperation(int argc,char *argv[],const QString &svcname,
#ifndef WIN32
rduser=new RDUser(rdstation_conf->defaultName());
#endif // WIN32
RDSvc *svc=new RDSvc(svcname);
RDSvc *svc=new RDSvc(svcname,config);
if(!svc->exists()) {
fprintf(stderr,"rdlogmanager: no such service\n");
return 256;
}
QDate start_date=QDate::currentDate().addDays(1+start_offset);
QString logname=RDDateDecode(svc->nameTemplate(),start_date,svc->name());
QString logname=
RDDateDecode(svc->nameTemplate(),start_date,config,svc->name());
RDLog *log=new RDLog(logname);
//
@ -107,9 +108,9 @@ int RunLogOperation(int argc,char *argv[],const QString &svcname,
delete q;
if(!svc->generateLog(start_date,
RDDateDecode(svc->nameTemplate(),start_date,
svc->name()),
config,svc->name()),
RDDateDecode(svc->nameTemplate(),start_date.addDays(1),
svc->name()),
config,svc->name()),
&unused_report)) {
fprintf(stderr,"rdlogmanager: unable to generate log\n");
return 256;
@ -234,7 +235,7 @@ int RunReportOperation(int argc,char *argv[],const QString &rptname,
//
// Open Report Generator
//
RDReport *report=new RDReport(rptname);
RDReport *report=new RDReport(rptname,config);
if(!report->exists()) {
fprintf(stderr,"rdlogmanager: no such report\n");
return 256;

View File

@ -306,9 +306,9 @@ void GenerateLog::createData()
//
// Generate Log
//
RDSvc *svc=new RDSvc(gen_service_box->currentText(),this);
RDSvc *svc=new RDSvc(gen_service_box->currentText(),log_config,this);
QString logname=RDDateDecode(svc->nameTemplate(),gen_date_edit->date(),
svc->name());
log_config,svc->name());
RDLog *log=new RDLog(logname);
if(log->exists()) {
str1=QString(tr("The log for"));
@ -363,9 +363,10 @@ void GenerateLog::createData()
gen_progress_dialog,SLOT(setProgress(int)));
svc->generateLog(gen_date_edit->date(),
RDDateDecode(svc->nameTemplate(),gen_date_edit->date(),
svc->name()),
log_config,svc->name()),
RDDateDecode(svc->nameTemplate(),gen_date_edit->date().
addDays(1),svc->name()),&unused_report);
addDays(1),log_config,svc->name()),
&unused_report);
log->updateTracks();
delete log;
delete svc;
@ -393,9 +394,9 @@ void GenerateLog::musicData()
{
unsigned tracks=0;
RDSvc *svc=new RDSvc(gen_service_box->currentText(),this);
RDSvc *svc=new RDSvc(gen_service_box->currentText(),log_config,this);
QString logname=RDDateDecode(svc->nameTemplate(),gen_date_edit->date(),
svc->name());
log_config,svc->name());
RDLog *log=new RDLog(logname);
if(((log->linkState(RDLog::SourceMusic)==RDLog::LinkDone)||
(log->linkState(RDLog::SourceTraffic)==RDLog::LinkDone))) {
@ -445,9 +446,9 @@ void GenerateLog::musicData()
void GenerateLog::trafficData()
{
RDSvc *svc=new RDSvc(gen_service_box->currentText(),this);
RDSvc *svc=new RDSvc(gen_service_box->currentText(),log_config,this);
QString logname=RDDateDecode(svc->nameTemplate(),gen_date_edit->date(),
svc->name());
log_config,svc->name());
RDLog *log=new RDLog(logname);
if((log->linkState(RDLog::SourceTraffic)==RDLog::LinkDone)) {
QString str1=QString(tr("The log for"));
@ -480,9 +481,9 @@ void GenerateLog::trafficData()
void GenerateLog::fileScanData()
{
RDSvc *svc=new RDSvc(gen_service_box->currentText(),this);
RDSvc *svc=new RDSvc(gen_service_box->currentText(),log_config,this);
QString logname=RDDateDecode(svc->nameTemplate(),gen_date_edit->date(),
svc->name());
log_config,svc->name());
RDLog *log=new RDLog(logname);
if(gen_music_enabled) {
if(QFile::exists(svc->
@ -549,9 +550,9 @@ void GenerateLog::resizeEvent(QResizeEvent *e)
void GenerateLog::UpdateControls()
{
RDSvc *svc=new RDSvc(gen_service_box->currentText(),this);
RDSvc *svc=new RDSvc(gen_service_box->currentText(),log_config,this);
QString logname=RDDateDecode(svc->nameTemplate(),gen_date_edit->date(),
svc->name());
log_config,svc->name());
RDLog *log=new RDLog(logname);
if(log->exists()) {
if(log->linkQuantity(RDLog::SourceMusic)>0) {

View File

@ -178,7 +178,7 @@ void PickReportDates::generateData()
tr("The end date cannot be earlier than the start date!"));
return;
}
RDReport *report=new RDReport(edit_report_box->currentText(),this);
RDReport *report=new RDReport(edit_report_box->currentText(),log_config,this);
if((edit_startdate_edit->date()!=edit_enddate_edit->date())&&
(!RDReport::multipleDaysAllowed(report->filter()))) {
QMessageBox::warning(this,tr("Invalid Date Range"),
@ -194,11 +194,13 @@ void PickReportDates::generateData()
return;
}
#ifdef WIN32
QString filename=RDDateDecode(report->exportPath(RDReport::Windows),
edit_startdate_edit->date(),edit_svcname);
QString filename=
RDDateDecode(report->exportPath(RDReport::Windows),
edit_startdate_edit->date(),log_config,edit_svcname);
#else
QString filename=RDDateDecode(report->exportPath(RDReport::Linux),
edit_startdate_edit->date(),edit_svcname);
QString filename=
RDDateDecode(report->exportPath(RDReport::Linux),
edit_startdate_edit->date(),log_config,edit_svcname);
#endif
QFile file(filename);
if(file.exists()) {

View File

@ -34,6 +34,7 @@ MainObject::MainObject(QObject *parent)
{
QString date="";
QString datetime="";
QString service="";
//
// Read Command Options
@ -50,6 +51,10 @@ MainObject::MainObject(QObject *parent)
datetime=cmd->value(i);
cmd->setProcessed(i,true);
}
if(cmd->key(i)=="--service") {
service=cmd->value(i);
cmd->setProcessed(i,true);
}
if(!cmd->processed(i)) {
fprintf(stderr,"datedecode_test: unknown option \"%s\"\n",
(const char *)cmd->value(i));
@ -67,15 +72,23 @@ MainObject::MainObject(QObject *parent)
exit(256);
}
//
// Open Config
//
RDConfig *config=new RDConfig();
config->load();
//
// Process Code
//
if(!date.isEmpty()) {
printf("%s\n",
(const char *)RDDateDecode(date,QDate::currentDate()));
(const char *)RDDateDecode(date,QDate::currentDate(),config,
service));
}
if(!datetime.isEmpty()) {
printf("%s\n",(const char *)RDDateTimeDecode(datetime,QDateTime(QDate::currentDate(),QTime::currentTime())));
printf("%s\n",(const char *)RDDateTimeDecode(datetime,
QDateTime(QDate::currentDate(),QTime::currentTime()),config,service));
}
exit(0);
}

View File

@ -23,7 +23,7 @@
#include <qobject.h>
#define DATEDECODE_TEST_USAGE "[options]\n\nTest the Rivendell date decoding routines\n\nOptions are:\n--date=<date-code>\n Decode the <date-code> string using RDDateDecode() and print the result\n on stdout.\n\n--datetime=<datetime-code>\n Decode the <datetime-code> string using RDDateTimeDecode() and print\n the result on stdout.\n\n"
#define DATEDECODE_TEST_USAGE "[options]\n\nTest the Rivendell date decoding routines\n\nOptions are:\n--date=<date-code>\n Decode the <date-code> string using RDDateDecode() and print the result\n on stdout.\n\n--datetime=<datetime-code>\n Decode the <datetime-code> string using RDDateTimeDecode() and print\n the result on stdout.\n\n--service=<svc-name>\n Service name to use.\n\n"
class MainObject : public QObject
{

View File

@ -509,7 +509,7 @@ void MainObject::Setpurgedate(const QDate &date)
void MainObject::Setservice(const QString &str)
{
RDSvc *svc=new RDSvc(str);
RDSvc *svc=new RDSvc(str,edit_config);
if(svc->exists()) {
edit_service=str;
edit_modified=true;

View File

@ -209,7 +209,7 @@ void MainWidget::serviceActivatedData(int index)
if(dg_svc!=NULL) {
delete dg_svc;
}
dg_svc=new RDSvc(dg_service_box->currentText());
dg_svc=new RDSvc(dg_service_box->currentText(),dg_config);
if(dg_group!=NULL) {
delete dg_group;
}
@ -391,7 +391,7 @@ bool MainWidget::WriteTrafficFile()
// Open Output File
//
outname=RDDateDecode(dg_svc->importPath(RDSvc::Traffic,RDSvc::Linux),
dg_date_edit->date());
dg_date_edit->date(),dg_config,dg_svc->name());
if((f=fopen(outname,"w"))==NULL) {
LogMessage(tr("WARNING: Unable to open traffic output file")+" \""+
outname+"\" ["+strerror(errno)+"].");

View File

@ -52,7 +52,7 @@ void Xport::AddLog()
if(!xport_post->getValue("SERVICE_NAME",&service_name)) {
XmlExit("Missing SERVICE_NAME",400,"logs.cpp",LINE_NUMBER);
}
RDSvc *svc=new RDSvc(service_name);
RDSvc *svc=new RDSvc(service_name,xport_config);
if(!svc->exists()) {
XmlExit("No such service",404,"logs.cpp",LINE_NUMBER);
}

View File

@ -64,7 +64,7 @@ void Xport::ListServices()
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
printf("<serviceList>\n");
while(q->next()) {
svc=new RDSvc(q->value(0).toString());
svc=new RDSvc(q->value(0).toString(),xport_config);
printf("%s",(const char *)svc->xml());
delete svc;
}