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