mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-08-10 17:11:20 +02:00
2022-04-01 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in rdlogmanager(1) where attempting to generate a SoundExchange Statutory License report using the command-line option would cause a crash. * Added an '-h' option to rdlogmanager(1). Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
91345cb991
commit
3cc7806db1
@ -22970,3 +22970,8 @@
|
|||||||
2022-03-29 Fred Gleason <fredg@paravelsystems.com>
|
2022-03-29 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Fixed a bug in rdlogmanager(1) that caused startup to fail when
|
* Fixed a bug in rdlogmanager(1) that caused startup to fail when
|
||||||
using the '-r' option when an X11 display context was not available.
|
using the '-r' option when an X11 display context was not available.
|
||||||
|
2022-04-01 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Fixed a bug in rdlogmanager(1) where attempting to generate
|
||||||
|
a SoundExchange Statutory License report using the command-line
|
||||||
|
option would cause a crash.
|
||||||
|
* Added an '-h' option to rdlogmanager(1).
|
||||||
|
@ -183,6 +183,21 @@
|
|||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<option>-h
|
||||||
|
<arg choice='req'><replaceable>hours</replaceable></arg>
|
||||||
|
</option>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Supply the Aggregate Tuning Hours value in hours. Currently only
|
||||||
|
required for the
|
||||||
|
<computeroutput>SoundExchange Statutory License</computeroutput>
|
||||||
|
report.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
|
@ -31,7 +31,8 @@
|
|||||||
#include "rdreport.h"
|
#include "rdreport.h"
|
||||||
|
|
||||||
bool RDReport::ExportSoundEx(const QString &filename,const QDate &startdate,
|
bool RDReport::ExportSoundEx(const QString &filename,const QDate &startdate,
|
||||||
const QDate &enddate,const QString &mixtable)
|
const QDate &enddate,double ath,
|
||||||
|
const QString &mixtable)
|
||||||
{
|
{
|
||||||
QString sql;
|
QString sql;
|
||||||
RDSqlQuery *q;
|
RDSqlQuery *q;
|
||||||
@ -49,12 +50,13 @@ bool RDReport::ExportSoundEx(const QString &filename,const QDate &startdate,
|
|||||||
//
|
//
|
||||||
// Get ATH Value
|
// Get ATH Value
|
||||||
//
|
//
|
||||||
double ath=0.0;
|
if(ath<0.0) {
|
||||||
RDGetAth *getath=new RDGetAth(&ath);
|
RDGetAth *getath=new RDGetAth(&ath);
|
||||||
if(getath->exec()<0) {
|
if(getath->exec()<0) {
|
||||||
report_error_code=RDReport::ErrorCanceled;
|
report_error_code=RDReport::ErrorCanceled;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QFile *file=new QFile(filename);
|
QFile *file=new QFile(filename);
|
||||||
if(!file->open(QIODevice::WriteOnly|QIODevice::Truncate)) {
|
if(!file->open(QIODevice::WriteOnly|QIODevice::Truncate)) {
|
||||||
|
@ -298,6 +298,12 @@ void RDReport::setEndTime() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool RDReport::aggregateTuningHoursRequired() const
|
||||||
|
{
|
||||||
|
return RDReport::aggregateTuningHoursRequired(filter());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
RDReport::ErrorCode RDReport::errorCode() const
|
RDReport::ErrorCode RDReport::errorCode() const
|
||||||
{
|
{
|
||||||
return report_error_code;
|
return report_error_code;
|
||||||
@ -314,7 +320,7 @@ bool RDReport::outputExists(const QDate &startdate)
|
|||||||
|
|
||||||
|
|
||||||
bool RDReport::generateReport(const QDate &startdate,const QDate &enddate,
|
bool RDReport::generateReport(const QDate &startdate,const QDate &enddate,
|
||||||
RDStation *station,QString *out_path)
|
RDStation *station,QString *out_path,double ath)
|
||||||
{
|
{
|
||||||
QString sql;
|
QString sql;
|
||||||
RDSqlQuery *q;
|
RDSqlQuery *q;
|
||||||
@ -595,7 +601,7 @@ bool RDReport::generateReport(const QDate &startdate,const QDate &enddate,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case RDReport::SoundExchange:
|
case RDReport::SoundExchange:
|
||||||
ret=ExportSoundEx(filename,startdate,enddate,mixname);
|
ret=ExportSoundEx(filename,startdate,enddate,ath,mixname);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RDReport::NprSoundExchange:
|
case RDReport::NprSoundExchange:
|
||||||
@ -834,6 +840,43 @@ bool RDReport::multipleMonthsAllowed(RDReport::ExportFilter filter)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool RDReport::aggregateTuningHoursRequired(RDReport::ExportFilter filter)
|
||||||
|
{
|
||||||
|
bool ret=false;
|
||||||
|
|
||||||
|
switch(filter) {
|
||||||
|
case RDReport::CbsiDeltaFlex:
|
||||||
|
case RDReport::TextLog:
|
||||||
|
case RDReport::BmiEmr:
|
||||||
|
case RDReport::RadioTraffic:
|
||||||
|
case RDReport::RadioTraffic2:
|
||||||
|
case RDReport::VisualTraffic:
|
||||||
|
case RDReport::CounterPoint:
|
||||||
|
case RDReport::CounterPoint2:
|
||||||
|
case RDReport::MrMaster:
|
||||||
|
case RDReport::Music1:
|
||||||
|
case RDReport::MusicClassical:
|
||||||
|
case RDReport::MusicPlayout:
|
||||||
|
case RDReport::NaturalLog:
|
||||||
|
case RDReport::WideOrbit:
|
||||||
|
case RDReport::CutLog:
|
||||||
|
case RDReport::ResultsReport:
|
||||||
|
case RDReport::MusicSummary:
|
||||||
|
case RDReport::NprSoundExchange:
|
||||||
|
case RDReport::SpinCount:
|
||||||
|
case RDReport::Technical:
|
||||||
|
case RDReport::LastFilter:
|
||||||
|
ret=false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RDReport::SoundExchange:
|
||||||
|
ret=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
QString RDReport::errorText(RDReport::ErrorCode code)
|
QString RDReport::errorText(RDReport::ErrorCode code)
|
||||||
{
|
{
|
||||||
QString ret;
|
QString ret;
|
||||||
|
@ -84,14 +84,16 @@ class RDReport
|
|||||||
QTime endTime(bool *is_null=NULL) const;
|
QTime endTime(bool *is_null=NULL) const;
|
||||||
void setEndTime(const QTime &time) const;
|
void setEndTime(const QTime &time) const;
|
||||||
void setEndTime() const;
|
void setEndTime() const;
|
||||||
|
bool aggregateTuningHoursRequired() const;
|
||||||
RDReport::ErrorCode errorCode() const;
|
RDReport::ErrorCode errorCode() const;
|
||||||
bool outputExists(const QDate &startdate);
|
bool outputExists(const QDate &startdate);
|
||||||
bool generateReport(const QDate &startdate,const QDate &enddate,
|
bool generateReport(const QDate &startdate,const QDate &enddate,
|
||||||
RDStation *station,QString *out_path);
|
RDStation *station,QString *out_path,double ath=-1.0);
|
||||||
static QString filterText(RDReport::ExportFilter filter);
|
static QString filterText(RDReport::ExportFilter filter);
|
||||||
static QString stationTypeText(RDReport::StationType type);
|
static QString stationTypeText(RDReport::StationType type);
|
||||||
static bool multipleDaysAllowed(RDReport::ExportFilter filter);
|
static bool multipleDaysAllowed(RDReport::ExportFilter filter);
|
||||||
static bool multipleMonthsAllowed(RDReport::ExportFilter filter);
|
static bool multipleMonthsAllowed(RDReport::ExportFilter filter);
|
||||||
|
static bool aggregateTuningHoursRequired(RDReport::ExportFilter filter);
|
||||||
static QString errorText(RDReport::ErrorCode code);
|
static QString errorText(RDReport::ErrorCode code);
|
||||||
static QString leftJustify(const QString &str,int width);
|
static QString leftJustify(const QString &str,int width);
|
||||||
static QString rightJustify(const QString &str,int width);
|
static QString rightJustify(const QString &str,int width);
|
||||||
@ -108,7 +110,7 @@ class RDReport
|
|||||||
const QDate &enddate,bool incl_hdr,bool incl_crs,
|
const QDate &enddate,bool incl_hdr,bool incl_crs,
|
||||||
const QString &mixtable);
|
const QString &mixtable);
|
||||||
bool ExportSoundEx(const QString &filename,const QDate &startdate,
|
bool ExportSoundEx(const QString &filename,const QDate &startdate,
|
||||||
const QDate &enddate,const QString &mixtable);
|
const QDate &enddate,double ath,const QString &mixtable);
|
||||||
bool ExportNprSoundEx(const QString &filename,const QDate &startdate,
|
bool ExportNprSoundEx(const QString &filename,const QDate &startdate,
|
||||||
const QDate &enddate,const QString &mixtable);
|
const QDate &enddate,const QString &mixtable);
|
||||||
bool ExportRadioTraffic(const QString &filename,const QDate &startdate,
|
bool ExportRadioTraffic(const QString &filename,const QDate &startdate,
|
||||||
|
@ -31,7 +31,8 @@
|
|||||||
#include <globals.h>
|
#include <globals.h>
|
||||||
|
|
||||||
int RunReportOperation(int argc,char *argv[],const QString &rptname,
|
int RunReportOperation(int argc,char *argv[],const QString &rptname,
|
||||||
bool protect_existing,int start_offset,int end_offset)
|
bool protect_existing,int start_offset,int end_offset,
|
||||||
|
double aggregate_tuning_hours)
|
||||||
{
|
{
|
||||||
QString out_path;
|
QString out_path;
|
||||||
QString err_msg;
|
QString err_msg;
|
||||||
@ -59,6 +60,14 @@ int RunReportOperation(int argc,char *argv[],const QString &rptname,
|
|||||||
return RDApplication::ExitNoReport;
|
return RDApplication::ExitNoReport;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check for Aggregate Tuning Hours
|
||||||
|
//
|
||||||
|
if((aggregate_tuning_hours<0)&&(report->aggregateTuningHoursRequired())) {
|
||||||
|
fprintf(stderr,"rdlogmanager: -h option required\n");
|
||||||
|
return RDApplication::ExitInvalidOption;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Generate Report
|
// Generate Report
|
||||||
//
|
//
|
||||||
@ -71,7 +80,7 @@ int RunReportOperation(int argc,char *argv[],const QString &rptname,
|
|||||||
}
|
}
|
||||||
if(!report->generateReport(yesterday.addDays(start_offset),
|
if(!report->generateReport(yesterday.addDays(start_offset),
|
||||||
yesterday.addDays(end_offset),rda->station(),
|
yesterday.addDays(end_offset),rda->station(),
|
||||||
&out_path)) {
|
&out_path,aggregate_tuning_hours)) {
|
||||||
fprintf(stderr,"rdlogmanager: report generation failed [%s]\n",
|
fprintf(stderr,"rdlogmanager: report generation failed [%s]\n",
|
||||||
RDReport::errorText(report->errorCode()).toUtf8().constData());
|
RDReport::errorText(report->errorCode()).toUtf8().constData());
|
||||||
return RDApplication::ExitReportFailed;
|
return RDApplication::ExitReportFailed;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// The Log Generator Utility for Rivendell.
|
// The Log Generator Utility for Rivendell.
|
||||||
//
|
//
|
||||||
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
|
// (C) Copyright 2002-2022 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
|
||||||
@ -288,6 +288,8 @@ int main(int argc,char *argv[])
|
|||||||
QString cmd_report=NULL;
|
QString cmd_report=NULL;
|
||||||
int cmd_start_offset=0;
|
int cmd_start_offset=0;
|
||||||
int cmd_end_offset=0;
|
int cmd_end_offset=0;
|
||||||
|
double cmd_hours=-1.0;
|
||||||
|
bool ok=false;
|
||||||
|
|
||||||
RDCmdSwitch *cmd=
|
RDCmdSwitch *cmd=
|
||||||
new RDCmdSwitch(argc,argv,"rdlogmanager",RDLOGMANAGER_USAGE);
|
new RDCmdSwitch(argc,argv,"rdlogmanager",RDLOGMANAGER_USAGE);
|
||||||
@ -366,6 +368,21 @@ int main(int argc,char *argv[])
|
|||||||
}
|
}
|
||||||
cmd->setProcessed(i,true);
|
cmd->setProcessed(i,true);
|
||||||
}
|
}
|
||||||
|
if (cmd->key(i)=="-h") {
|
||||||
|
if (i+1<cmd->keys()) {
|
||||||
|
i++;
|
||||||
|
cmd_hours=cmd->key(i).toDouble(&ok);
|
||||||
|
if((!ok)||(cmd_hours<0.0)) {
|
||||||
|
fprintf(stderr,"rdlogmanager: invalid argument to -h\n");
|
||||||
|
exit(RDApplication::ExitInvalidOption);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,"rdlogmanager: missing argument to \"-h\"\n");
|
||||||
|
exit(RDApplication::ExitInvalidOption);
|
||||||
|
}
|
||||||
|
cmd->setProcessed(i,true);
|
||||||
|
}
|
||||||
if(!cmd->processed(i)) {
|
if(!cmd->processed(i)) {
|
||||||
fprintf(stderr,"rdlogmanager: unknown command option \"%s\"\n",
|
fprintf(stderr,"rdlogmanager: unknown command option \"%s\"\n",
|
||||||
cmd->key(i).toUtf8().constData());
|
cmd->key(i).toUtf8().constData());
|
||||||
@ -388,7 +405,7 @@ int main(int argc,char *argv[])
|
|||||||
}
|
}
|
||||||
if(!cmd_report.isEmpty()) {
|
if(!cmd_report.isEmpty()) {
|
||||||
return RunReportOperation(argc,argv,cmd_report,cmd_protect_existing,
|
return RunReportOperation(argc,argv,cmd_report,cmd_protect_existing,
|
||||||
cmd_start_offset,cmd_end_offset);
|
cmd_start_offset,cmd_end_offset,cmd_hours);
|
||||||
}
|
}
|
||||||
return gui_main(argc,argv);
|
return gui_main(argc,argv);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// The Log Manager Utility for Rivendell.
|
// The Log Manager Utility for Rivendell.
|
||||||
//
|
//
|
||||||
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
|
// (C) Copyright 2002-2022 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
|
||||||
@ -38,7 +38,7 @@ extern int RunLogOperation(int argc,char *argv[],const QString &svcname,
|
|||||||
bool merge_mus,bool merge_tfc);
|
bool merge_mus,bool merge_tfc);
|
||||||
extern int RunReportOperation(int argc,char *argv[],const QString &rptname,
|
extern int RunReportOperation(int argc,char *argv[],const QString &rptname,
|
||||||
bool protect_existing,int start_offset,
|
bool protect_existing,int start_offset,
|
||||||
int end_offset);
|
int end_offset,double aggregate_tuning_hours);
|
||||||
|
|
||||||
class MainWidget : public RDMainWindow
|
class MainWidget : public RDMainWindow
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user