mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-04-09 14:33:28 +02:00
2020-06-04 Fred Gleason <fredg@paravelsystems.com>
* Added a 'Results Report' report in rdadmin(1). Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
6cd1b3bb19
commit
dd0db5c2a0
@ -19853,3 +19853,5 @@
|
||||
2020-05-29 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Fixed a bug in rdairplay(1) where attempting to audition an
|
||||
audio cart with a disabled cue output would crash the application.
|
||||
2020-06-04 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added a 'Results Report' report in rdadmin(1).
|
||||
|
@ -2,7 +2,7 @@
|
||||
##
|
||||
## Automake.am for rivendell/lib
|
||||
##
|
||||
## (C) Copyright 2002-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
## (C) Copyright 2002-2020 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
|
||||
@ -53,6 +53,7 @@ dist_librd_la_SOURCES = dbversion.h\
|
||||
export_musicsummary.cpp\
|
||||
export_nprsoundex.cpp\
|
||||
export_radiotraffic.cpp\
|
||||
export_resultsrecon.cpp\
|
||||
export_soundex.cpp\
|
||||
export_spincount.cpp\
|
||||
export_technical.cpp\
|
||||
|
115
lib/export_resultsrecon.cpp
Normal file
115
lib/export_resultsrecon.cpp
Normal file
@ -0,0 +1,115 @@
|
||||
// export_resultsreport.cpp
|
||||
//
|
||||
// Export a Rivendell Report in 'results' format
|
||||
//
|
||||
// (C) Copyright 2002-2020 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
|
||||
// published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public
|
||||
// License along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#include <qfile.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qtextstream.h>
|
||||
|
||||
#include "rdconf.h"
|
||||
#include "rddatedecode.h"
|
||||
#include "rddb.h"
|
||||
#include "rdescape_string.h"
|
||||
#include "rdreport.h"
|
||||
|
||||
bool RDReport::ExportResultsReport(const QString &filename,
|
||||
const QDate &startdate,const QDate &enddate,
|
||||
const QString &mixtable)
|
||||
{
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
QString air_fmt;
|
||||
|
||||
QFile *file=new QFile(filename);
|
||||
if(!file->open(QIODevice::WriteOnly|QIODevice::Truncate)) {
|
||||
report_error_code=RDReport::ErrorCantOpen;
|
||||
delete file;
|
||||
return false;
|
||||
}
|
||||
QTextStream *strm=new QTextStream(file);
|
||||
strm->setEncoding(QTextStream::UnicodeUTF8);
|
||||
sql=QString("select ")+
|
||||
"ELR_LINES.EVENT_DATETIME,"+ // 00
|
||||
"ELR_LINES.EVENT_TYPE,"+ // 01
|
||||
"ELR_LINES.LENGTH,"+ // 02
|
||||
"ELR_LINES.CART_NUMBER,"+ // 03
|
||||
"ELR_LINES.CUT_NUMBER,"+ // 04
|
||||
"ELR_LINES.TITLE,"+ // 05
|
||||
"ELR_LINES.ARTIST,"+ // 06
|
||||
"ELR_LINES.EXT_START_TIME "+ // 07
|
||||
"from ELR_LINES left join CART "+
|
||||
"on ELR_LINES.CART_NUMBER=CART.NUMBER where "+
|
||||
"SERVICE_NAME=\""+RDEscapeString(mixtable)+"\" "+
|
||||
"order by EVENT_DATETIME";
|
||||
q=new RDSqlQuery(sql);
|
||||
|
||||
//
|
||||
// Write Data Rows
|
||||
//
|
||||
QString cart_title;
|
||||
QString play_length;
|
||||
QString tfc_length;
|
||||
QString tfc_time;
|
||||
QString air_cartnum;
|
||||
QString tfc_cartnum;
|
||||
QString ext_data;
|
||||
QString ext_annc_type;
|
||||
int line=0;
|
||||
|
||||
while(q->next()) {
|
||||
// DateTime
|
||||
*strm << q->value(0).toDateTime().toString("yy-MM-dd,hh:mm:dd,");
|
||||
|
||||
*strm << "on-air,";
|
||||
|
||||
// Cart Number
|
||||
*strm << QString().sprintf("%06u,",q->value(3).toUInt());
|
||||
|
||||
// Cut Number
|
||||
*strm << QString().sprintf("%03d,",q->value(4).toInt());
|
||||
|
||||
// Title / Artist
|
||||
*strm << QString().
|
||||
sprintf("\"%-23s %-25s\",",
|
||||
q->value(5).toString().left(23).toUtf8().constData(),
|
||||
q->value(6).toString().left(25).toUtf8().constData());
|
||||
|
||||
// Length
|
||||
*strm << RDGetTimeLength(q->value(2).toInt(),true,false).right(5)+",";
|
||||
|
||||
// Scheduled Start Time
|
||||
*strm << q->value(7).toTime().toString("hh:mm:ss,");
|
||||
|
||||
// Line Counts
|
||||
*strm << QString().sprintf("%05d|-|%05d|00",line,line);
|
||||
|
||||
// EOL
|
||||
*strm << "\r\n";
|
||||
|
||||
line++;
|
||||
}
|
||||
|
||||
delete q;
|
||||
delete strm;
|
||||
delete file;
|
||||
report_error_code=RDReport::ErrorOk;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ SOURCES += export_musicplayout.cpp
|
||||
SOURCES += export_musicsummary.cpp
|
||||
SOURCES += export_nprsoundex.cpp
|
||||
SOURCES += export_radiotraffic.cpp
|
||||
SOURCES += export_resultsrecon.cpp
|
||||
SOURCES += export_spincount.cpp
|
||||
SOURCES += export_soundex.cpp
|
||||
SOURCES += export_technical.cpp
|
||||
|
@ -805,6 +805,10 @@
|
||||
<source>Inline Traffic, </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Results Report</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDAddCart</name>
|
||||
|
@ -801,6 +801,10 @@
|
||||
<source>Inline Traffic, </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Results Report</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDAddCart</name>
|
||||
|
@ -801,6 +801,10 @@
|
||||
<source>Inline Traffic, </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Results Report</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDAddCart</name>
|
||||
|
@ -771,6 +771,10 @@
|
||||
<source>Inline Traffic, </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Results Report</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDAddCart</name>
|
||||
|
@ -801,6 +801,10 @@
|
||||
<source>Inline Traffic, </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Results Report</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDAddCart</name>
|
||||
|
@ -801,6 +801,10 @@
|
||||
<source>Inline Traffic, </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Results Report</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDAddCart</name>
|
||||
|
@ -801,6 +801,10 @@
|
||||
<source>Inline Traffic, </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Results Report</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDAddCart</name>
|
||||
|
@ -654,6 +654,10 @@ bool RDReport::generateReport(const QDate &startdate,const QDate &enddate,
|
||||
ret=ExportCutLog(filename,startdate,enddate,mixname);
|
||||
break;
|
||||
|
||||
case RDReport::ResultsReport:
|
||||
ret=ExportResultsReport(filename,startdate,enddate,mixname);
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
@ -731,6 +735,9 @@ QString RDReport::filterText(RDReport::ExportFilter filter)
|
||||
case RDReport::CutLog:
|
||||
return QObject::tr("Cut Log");
|
||||
|
||||
case RDReport::ResultsReport:
|
||||
return QObject::tr("Results Report");
|
||||
|
||||
case RDReport::LastFilter:
|
||||
break;
|
||||
}
|
||||
@ -776,6 +783,7 @@ bool RDReport::multipleDaysAllowed(RDReport::ExportFilter filter)
|
||||
case RDReport::SpinCount:
|
||||
case RDReport::WideOrbit:
|
||||
case RDReport::CutLog:
|
||||
case RDReport::ResultsReport:
|
||||
return false;
|
||||
|
||||
case RDReport::BmiEmr:
|
||||
@ -807,6 +815,7 @@ bool RDReport::multipleMonthsAllowed(RDReport::ExportFilter filter)
|
||||
case RDReport::NaturalLog:
|
||||
case RDReport::WideOrbit:
|
||||
case RDReport::CutLog:
|
||||
case RDReport::ResultsReport:
|
||||
return false;
|
||||
|
||||
case RDReport::MusicSummary:
|
||||
|
@ -37,7 +37,7 @@ class RDReport
|
||||
CounterPoint=7,Music1=8,MusicSummary=9,WideOrbit=10,
|
||||
NprSoundExchange=11,MusicPlayout=12,NaturalLog=13,
|
||||
MusicClassical=14,MrMaster=15,SpinCount=16,CutLog=17,
|
||||
CounterPoint2=18,LastFilter=19};
|
||||
CounterPoint2=18,ResultsReport=19,LastFilter=20};
|
||||
enum ExportOs {Linux=0,Windows=1};
|
||||
enum ExportType {Generic=0,Traffic=1,Music=2};
|
||||
enum StationType {TypeOther=0,TypeAm=1,TypeFm=2,TypeLast=3};
|
||||
@ -124,6 +124,8 @@ class RDReport
|
||||
const QDate &enddate,const QString &mixtable);
|
||||
bool ExportCutLog(const QString &filename,const QDate &startdate,
|
||||
const QDate &enddate,const QString &mixtable);
|
||||
bool ExportResultsReport(const QString &filename,const QDate &startdate,
|
||||
const QDate &enddate,const QString &mixtable);
|
||||
void SetRow(const QString ¶m,const QString &value) const;
|
||||
void SetRow(const QString ¶m,int value) const;
|
||||
void SetRow(const QString ¶m,unsigned value) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user