mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-07-09 08:57:46 +02:00
2017-10-02 Fred Gleason <fredg@paravelsystems.com>
* Added an '%s' datetime wildcard for Service Name.
This commit is contained in:
parent
2992fcd5c9
commit
75883359b9
@ -16035,3 +16035,5 @@
|
||||
* Added static 'RDSvc::create()' and 'RDSvc::remove()' methods.
|
||||
* Implemented 'CreateService=' and 'NewServiceTemplate=' parameters
|
||||
in the [Provisioning] section of rd.conf(5).
|
||||
2017-10-02 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added an '%s' datetime wildcard for Service Name.
|
||||
|
@ -42,7 +42,8 @@ NewHostTemplate=some_host_entry
|
||||
|
||||
; If CreateService=Yes, a Service entry will be automatically created in the DB
|
||||
; when the 'rivendell' system service is started, using the Service definition
|
||||
; specified in NewServiceTemplate= as the template.
|
||||
; specified in NewServiceTemplate= as the template. The new service entry will
|
||||
; have the same name as the hostname.
|
||||
CreateService=No
|
||||
NewServiceTemplate=some_service_entry
|
||||
|
||||
|
@ -87,7 +87,7 @@ where:
|
||||
|
||||
R -- [unassigned]
|
||||
|
||||
s -- [unassigned]
|
||||
s -- Service Name
|
||||
|
||||
S -- Seconds, zero padded (00 - 60)
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include <rddatedecode.h>
|
||||
|
||||
QString RDDateDecode(QString str,QDate date)
|
||||
QString RDDateDecode(QString str,const QDate &date,const QString &svcname)
|
||||
{
|
||||
QString string;
|
||||
int yearnum;
|
||||
@ -117,6 +117,12 @@ QString RDDateDecode(QString str,QDate date)
|
||||
field=QString().sprintf("%02d",date.month());
|
||||
break;
|
||||
|
||||
case 's': // Service name
|
||||
if(!svcname.isEmpty()) {
|
||||
field=svcname;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'u': // Day of week (numeric, 1..7, 1=Monday)
|
||||
field=QString().sprintf("%d",date.dayOfWeek());
|
||||
break;
|
||||
@ -164,7 +170,8 @@ QString RDDateDecode(QString str,QDate date)
|
||||
}
|
||||
|
||||
|
||||
QString RDDateTimeDecode(QString str,QDateTime datetime)
|
||||
QString RDDateTimeDecode(QString str,const QDateTime &datetime,
|
||||
const QString &svcname)
|
||||
{
|
||||
QString string;
|
||||
int yearnum;
|
||||
@ -291,6 +298,12 @@ QString RDDateTimeDecode(QString str,QDateTime datetime)
|
||||
field=QString().sprintf("%02d",datetime.time().second());
|
||||
break;
|
||||
|
||||
case 's': // Service name
|
||||
if(!svcname.isEmpty()) {
|
||||
field=svcname;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'u': // Day of week (numeric, 1..7, 1=Monday)
|
||||
field=QString().sprintf("%d",datetime.date().dayOfWeek());
|
||||
break;
|
||||
|
@ -23,8 +23,9 @@
|
||||
|
||||
#include <qdatetime.h>
|
||||
|
||||
QString RDDateDecode(QString str,QDate date);
|
||||
QString RDDateTimeDecode(QString str,QDateTime datetime);
|
||||
QString RDDateDecode(QString str,const QDate &date,const QString &svcname="");
|
||||
QString RDDateTimeDecode(QString str,const QDateTime &datetime,
|
||||
const QString &svcname="");
|
||||
|
||||
|
||||
#endif // RDDATEDECODE
|
||||
|
@ -83,7 +83,7 @@ int RunLogOperation(int argc,char *argv[],const QString &svcname,
|
||||
return 256;
|
||||
}
|
||||
QDate start_date=QDate::currentDate().addDays(1+start_offset);
|
||||
QString logname=RDDateDecode(svc->nameTemplate(),start_date);
|
||||
QString logname=RDDateDecode(svc->nameTemplate(),start_date,svc->name());
|
||||
RDLog *log=new RDLog(logname);
|
||||
|
||||
//
|
||||
@ -106,8 +106,10 @@ int RunLogOperation(int argc,char *argv[],const QString &svcname,
|
||||
}
|
||||
delete q;
|
||||
if(!svc->generateLog(start_date,
|
||||
RDDateDecode(svc->nameTemplate(),start_date),
|
||||
RDDateDecode(svc->nameTemplate(),start_date.addDays(1)),
|
||||
RDDateDecode(svc->nameTemplate(),start_date,
|
||||
svc->name()),
|
||||
RDDateDecode(svc->nameTemplate(),start_date.addDays(1),
|
||||
svc->name()),
|
||||
&unused_report)) {
|
||||
fprintf(stderr,"rdlogmanager: unable to generate log\n");
|
||||
return 256;
|
||||
|
@ -307,7 +307,8 @@ void GenerateLog::createData()
|
||||
// Generate Log
|
||||
//
|
||||
RDSvc *svc=new RDSvc(gen_service_box->currentText(),this);
|
||||
QString logname=RDDateDecode(svc->nameTemplate(),gen_date_edit->date());
|
||||
QString logname=RDDateDecode(svc->nameTemplate(),gen_date_edit->date(),
|
||||
svc->name());
|
||||
RDLog *log=new RDLog(logname);
|
||||
if(log->exists()) {
|
||||
str1=QString(tr("The log for"));
|
||||
@ -361,9 +362,10 @@ void GenerateLog::createData()
|
||||
connect(svc,SIGNAL(generationProgress(int)),
|
||||
gen_progress_dialog,SLOT(setProgress(int)));
|
||||
svc->generateLog(gen_date_edit->date(),
|
||||
RDDateDecode(svc->nameTemplate(),gen_date_edit->date()),
|
||||
RDDateDecode(svc->nameTemplate(),gen_date_edit->date(),
|
||||
svc->name()),
|
||||
RDDateDecode(svc->nameTemplate(),gen_date_edit->date().
|
||||
addDays(1)),&unused_report);
|
||||
addDays(1),svc->name()),&unused_report);
|
||||
log->updateTracks();
|
||||
delete log;
|
||||
delete svc;
|
||||
@ -392,7 +394,8 @@ void GenerateLog::musicData()
|
||||
unsigned tracks=0;
|
||||
|
||||
RDSvc *svc=new RDSvc(gen_service_box->currentText(),this);
|
||||
QString logname=RDDateDecode(svc->nameTemplate(),gen_date_edit->date());
|
||||
QString logname=RDDateDecode(svc->nameTemplate(),gen_date_edit->date(),
|
||||
svc->name());
|
||||
RDLog *log=new RDLog(logname);
|
||||
if(((log->linkState(RDLog::SourceMusic)==RDLog::LinkDone)||
|
||||
(log->linkState(RDLog::SourceTraffic)==RDLog::LinkDone))) {
|
||||
@ -443,7 +446,8 @@ void GenerateLog::musicData()
|
||||
void GenerateLog::trafficData()
|
||||
{
|
||||
RDSvc *svc=new RDSvc(gen_service_box->currentText(),this);
|
||||
QString logname=RDDateDecode(svc->nameTemplate(),gen_date_edit->date());
|
||||
QString logname=RDDateDecode(svc->nameTemplate(),gen_date_edit->date(),
|
||||
svc->name());
|
||||
RDLog *log=new RDLog(logname);
|
||||
if((log->linkState(RDLog::SourceTraffic)==RDLog::LinkDone)) {
|
||||
QString str1=QString(tr("The log for"));
|
||||
@ -477,7 +481,8 @@ void GenerateLog::trafficData()
|
||||
void GenerateLog::fileScanData()
|
||||
{
|
||||
RDSvc *svc=new RDSvc(gen_service_box->currentText(),this);
|
||||
QString logname=RDDateDecode(svc->nameTemplate(),gen_date_edit->date());
|
||||
QString logname=RDDateDecode(svc->nameTemplate(),gen_date_edit->date(),
|
||||
svc->name());
|
||||
RDLog *log=new RDLog(logname);
|
||||
if(gen_music_enabled) {
|
||||
if(QFile::exists(svc->
|
||||
@ -545,7 +550,8 @@ void GenerateLog::resizeEvent(QResizeEvent *e)
|
||||
void GenerateLog::UpdateControls()
|
||||
{
|
||||
RDSvc *svc=new RDSvc(gen_service_box->currentText(),this);
|
||||
QString logname=RDDateDecode(svc->nameTemplate(),gen_date_edit->date());
|
||||
QString logname=RDDateDecode(svc->nameTemplate(),gen_date_edit->date(),
|
||||
svc->name());
|
||||
RDLog *log=new RDLog(logname);
|
||||
if(log->exists()) {
|
||||
if(log->linkQuantity(RDLog::SourceMusic)>0) {
|
||||
|
@ -195,10 +195,10 @@ void PickReportDates::generateData()
|
||||
}
|
||||
#ifdef WIN32
|
||||
QString filename=RDDateDecode(report->exportPath(RDReport::Windows),
|
||||
edit_startdate_edit->date());
|
||||
edit_startdate_edit->date(),edit_svcname);
|
||||
#else
|
||||
QString filename=RDDateDecode(report->exportPath(RDReport::Linux),
|
||||
edit_startdate_edit->date());
|
||||
edit_startdate_edit->date(),edit_svcname);
|
||||
#endif
|
||||
QFile file(filename);
|
||||
if(file.exists()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user