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:
Fred Gleason
2022-04-01 20:26:44 -04:00
parent 91345cb991
commit 3cc7806db1
8 changed files with 109 additions and 16 deletions

View File

@@ -31,7 +31,8 @@
#include "rdreport.h"
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;
RDSqlQuery *q;
@@ -49,11 +50,12 @@ bool RDReport::ExportSoundEx(const QString &filename,const QDate &startdate,
//
// Get ATH Value
//
double ath=0.0;
RDGetAth *getath=new RDGetAth(&ath);
if(getath->exec()<0) {
report_error_code=RDReport::ErrorCanceled;
return false;
if(ath<0.0) {
RDGetAth *getath=new RDGetAth(&ath);
if(getath->exec()<0) {
report_error_code=RDReport::ErrorCanceled;
return false;
}
}
QFile *file=new QFile(filename);

View File

@@ -298,6 +298,12 @@ void RDReport::setEndTime() const
}
bool RDReport::aggregateTuningHoursRequired() const
{
return RDReport::aggregateTuningHoursRequired(filter());
}
RDReport::ErrorCode RDReport::errorCode() const
{
return report_error_code;
@@ -314,7 +320,7 @@ bool RDReport::outputExists(const QDate &startdate)
bool RDReport::generateReport(const QDate &startdate,const QDate &enddate,
RDStation *station,QString *out_path)
RDStation *station,QString *out_path,double ath)
{
QString sql;
RDSqlQuery *q;
@@ -595,7 +601,7 @@ bool RDReport::generateReport(const QDate &startdate,const QDate &enddate,
break;
case RDReport::SoundExchange:
ret=ExportSoundEx(filename,startdate,enddate,mixname);
ret=ExportSoundEx(filename,startdate,enddate,ath,mixname);
break;
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 ret;

View File

@@ -84,14 +84,16 @@ class RDReport
QTime endTime(bool *is_null=NULL) const;
void setEndTime(const QTime &time) const;
void setEndTime() const;
bool aggregateTuningHoursRequired() const;
RDReport::ErrorCode errorCode() const;
bool outputExists(const QDate &startdate);
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 stationTypeText(RDReport::StationType type);
static bool multipleDaysAllowed(RDReport::ExportFilter filter);
static bool multipleMonthsAllowed(RDReport::ExportFilter filter);
static bool aggregateTuningHoursRequired(RDReport::ExportFilter filter);
static QString errorText(RDReport::ErrorCode code);
static QString leftJustify(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 QString &mixtable);
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,
const QDate &enddate,const QString &mixtable);
bool ExportRadioTraffic(const QString &filename,const QDate &startdate,