2018-08-02 Fred Gleason <fredg@paravelsystems.com>

* Modified reports in rdcatch(1) to display UTF-8 strings
	correctly.
This commit is contained in:
Fred Gleason
2018-08-02 18:37:45 -04:00
parent ec6207c7d6
commit ad767309c7
4 changed files with 177 additions and 155 deletions

View File

@@ -17302,3 +17302,6 @@
2018-08-02 Fred Gleason <fredg@paravelsystems.com> 2018-08-02 Fred Gleason <fredg@paravelsystems.com>
* Modified reports in rdlogedit(1) to display UTF-8 strings * Modified reports in rdlogedit(1) to display UTF-8 strings
correctly. correctly.
2018-08-02 Fred Gleason <fredg@paravelsystems.com>
* Modified reports in rdcatch(1) to display UTF-8 strings
correctly.

View File

@@ -31,21 +31,20 @@ QString RDCutPath(QString cutname)
RDCut *cut=new RDCut(cutname); RDCut *cut=new RDCut(cutname);
if(!cut->exists()) { if(!cut->exists()) {
delete cut; delete cut;
return QString(QObject::tr("UNKNOWN CUT")); return QObject::tr("UNKNOWN CUT");
} }
RDCart *cart=new RDCart(cut->cartNumber()); RDCart *cart=new RDCart(cut->cartNumber());
if(!cart->exists()) { if(!cart->exists()) {
delete cart; delete cart;
delete cut; delete cut;
return QString("UNKNOWN CUT"); return QObject::tr("UNKNOWN CUT");
} }
if((cart->title().isEmpty())&&(cut->description().isEmpty())) { if((cart->title().isEmpty())&&(cut->description().isEmpty())) {
path=QString(); path=QString();
} }
else { else {
path=QString().sprintf("%s->%s",(const char *)cart->title(), path=cart->title()+"->"+cut->description();
(const char *)cut->description());
} }
delete cart; delete cart;
delete cut; delete cut;

View File

@@ -383,7 +383,10 @@ void EditPlayout::PopulateDecks(QComboBox *box)
int count=0; int count=0;
box->clear(); box->clear();
QString sql=QString("select STATION_NAME,CHANNEL from DECKS where ")+ QString sql=QString("select ")+
"STATION_NAME,"+ // 00
"CHANNEL "+ // 01
"from DECKS where "+
"(CARD_NUMBER!=-1)&&"+ "(CARD_NUMBER!=-1)&&"+
"(PORT_NUMBER!=-1)&&"+ "(PORT_NUMBER!=-1)&&"+
"(CHANNEL>128) order by STATION_NAME,CHANNEL"; "(CHANNEL>128) order by STATION_NAME,CHANNEL";

View File

@@ -28,6 +28,7 @@
#include <rddb.h> #include <rddb.h>
#include <rdescape_string.h> #include <rdescape_string.h>
#include <rdrecording.h> #include <rdrecording.h>
#include <rdreport.h>
#include <rdtextfile.h> #include <rdtextfile.h>
#include "globals.h" #include "globals.h"
@@ -115,16 +116,16 @@ void ListReports::generateData()
QString report; QString report;
switch(list_reports_box->currentItem()) { switch(list_reports_box->currentItem()) {
case 0: // Event Report case 0: // Event Report
GenerateEventReport(&report); GenerateEventReport(&report);
break; break;
case 1: // XLoad Report case 1: // XLoad Report
GenerateXloadReport(&report); GenerateXloadReport(&report);
break; break;
default: default:
return; return;
} }
RDTextFile(report); RDTextFile(report);
} }
@@ -147,61 +148,77 @@ void ListReports::GenerateEventReport(QString *report)
// //
// Generate Header // Generate Header
// //
*report=" Rivendell RDCatch Event Report\n"; *report=RDReport::center("Rivendell RDCatch Event Report",132)+"\n";
*report+=QString(). *report+=QString("Generated: ")+QDateTime::currentDateTime().toString("MM/dd/yyyy - hh:mm:ss")+"\n";
sprintf("Generated: %s\n",
(const char *)QDateTime(QDate::currentDate(),QTime::currentTime()).
toString("MM/dd/yyyy - hh:mm:ss"));
*report+="\n"; *report+="\n";
*report+="T -Start-------- -End---------- -Days of Week- -Location----- -Source------------- -Destination-------- -Description-----------------\n"; *report+="T -Start-------- -End---------- -Days of Week- -Location----- -Source------------- -Destination-------- -Description-----------------\n";
// //
// Generate Rows // Generate Rows
// //
sql="select TYPE,START_TYPE,START_TIME,END_TYPE,END_TIME,LENGTH,SUN,MON,\ sql=QString("select ")+
TUE,WED,THU,FRI,SAT,STATION_NAME,CHANNEL,CUT_NAME,URL,MACRO_CART,\ "TYPE,"+ // 00
SWITCH_INPUT,SWITCH_OUTPUT,DESCRIPTION \ "START_TYPE,"+ // 01
from RECORDINGS order by START_TIME"; "START_TIME,"+ // 02
"END_TYPE,"+ // 03
"END_TIME,"+ // 04
"LENGTH,"+ // 05
"SUN,"+ // 06
"MON,"+ // 07
"TUE,"+ // 08
"WED,"+ // 09
"THU,"+ // 10
"FRI,"+ // 11
"SAT,"+ // 12
"STATION_NAME,"+ // 13
"CHANNEL,"+ // 14
"CUT_NAME,"+ // 15
"URL,"+ // 16
"MACRO_CART,"+ // 17
"SWITCH_INPUT,"+ // 18
"SWITCH_OUTPUT,"+ // 19
"DESCRIPTION "+ // 20
"from RECORDINGS order by START_TIME";
q=new RDSqlQuery(sql); q=new RDSqlQuery(sql);
while(q->next()) { while(q->next()) {
// //
// Event Type // Event Type
// //
switch((RDRecording::Type)q->value(0).toInt()) { switch((RDRecording::Type)q->value(0).toInt()) {
case RDRecording::Recording: case RDRecording::Recording:
*report+="R"; *report+="R";
exists=RDCut::exists(q->value(15).toString()); exists=RDCut::exists(q->value(15).toString());
break; break;
case RDRecording::MacroEvent: case RDRecording::MacroEvent:
*report+="M"; *report+="M";
exists=RDCart::exists(q->value(17).toUInt()); exists=RDCart::exists(q->value(17).toUInt());
break; break;
case RDRecording::SwitchEvent: case RDRecording::SwitchEvent:
*report+="S"; *report+="S";
exists=true; exists=true;
break; break;
case RDRecording::Playout: case RDRecording::Playout:
*report+="P"; *report+="P";
exists=RDCut::exists(q->value(15).toString()); exists=RDCut::exists(q->value(15).toString());
break; break;
case RDRecording::Download: case RDRecording::Download:
*report+="D"; *report+="D";
exists=RDCut::exists(q->value(15).toString()); exists=RDCut::exists(q->value(15).toString());
break; break;
case RDRecording::Upload: case RDRecording::Upload:
*report+="U"; *report+="U";
exists=RDCut::exists(q->value(15).toString()); exists=RDCut::exists(q->value(15).toString());
break; break;
default: default:
*report+="?"; *report+="?";
exists=true; exists=true;
break; break;
} }
if(exists) { if(exists) {
*report+=" "; *report+=" ";
@@ -214,47 +231,43 @@ void ListReports::GenerateEventReport(QString *report)
// Start Time // Start Time
// //
switch((RDRecording::StartType)q->value(1).toInt()) { switch((RDRecording::StartType)q->value(1).toInt()) {
case RDRecording::HardStart: case RDRecording::HardStart:
*report+=QString(). *report+=QString("Hard: ")+
sprintf("Hard: %-8s ",(const char *)q->value(2).toTime(). RDReport::leftJustify(q->value(2).toTime().toString("hh:mm:ss"),8)+" ";
toString("hh:mm:ss")); break;
break;
case RDRecording::GpiStart: case RDRecording::GpiStart:
*report+=QString(). *report+=QString("Gpi: ")+
sprintf("Gpi: %-8s ",(const char *)q->value(2).toTime(). RDReport::leftJustify(q->value(2).toTime().toString("hh:mm:ss"),8)+" ";
toString("hh:mm:ss")); break;
break;
} }
// //
// End Time // End Time
// //
switch((RDRecording::Type)q->value(0).toInt()) { switch((RDRecording::Type)q->value(0).toInt()) {
case RDRecording::Recording: case RDRecording::Recording:
switch((RDRecording::EndType)q->value(3).toInt()) { switch((RDRecording::EndType)q->value(3).toInt()) {
case RDRecording::HardEnd: case RDRecording::HardEnd:
*report+=QString(). *report+=QString("Hard: ")+
sprintf("Hard: %-8s ",(const char *)q->value(4).toTime(). RDReport::leftJustify(q->value(4).toTime().toString("hh:mm:ss"),8)+" ";
toString("hh:mm:ss")); break;
break;
case RDRecording::GpiEnd: case RDRecording::GpiEnd:
*report+=QString(). *report+=QString("Gpi: ")+
sprintf("Gpi: %-8s ",(const char *)q->value(4).toTime(). RDReport::leftJustify(q->value(4).toTime().toString("hh:mm:ss"),8)+" ";
toString("hh:mm:ss")); break;
break;
case RDRecording::LengthEnd: case RDRecording::LengthEnd:
*report+=QString().sprintf("Len: %-8s ", *report+=QString("Len: ")+
(const char *)RDGetTimeLength(q->value(5).toInt(),false,false)); RDReport::leftJustify(RDGetTimeLength(q->value(5).toInt(),false,false),8)+" ";
break; break;
} }
break; break;
default: default:
*report+=" "; *report+=" ";
break; break;
} }
// //
@@ -307,23 +320,21 @@ void ListReports::GenerateEventReport(QString *report)
// Location // Location
// //
switch((RDRecording::Type)q->value(0).toInt()) { switch((RDRecording::Type)q->value(0).toInt()) {
case RDRecording::Recording: case RDRecording::Recording:
str=QString().sprintf("%s:%d", str=q->value(13).toString().left(12)+
(const char *)q->value(13).toString().left(12), QString().sprintf(":%d",q->value(14).toInt());
q->value(14).toInt()); break;
break;
case RDRecording::Playout: case RDRecording::Playout:
str=QString().sprintf("%s:%d", str=q->value(13).toString().left(12)+
(const char *)q->value(13).toString().left(12), QString().sprintf(":%d",q->value(14).toInt()-128);
q->value(14).toInt()-128); break;
break;
default: default:
str=q->value(13).toString().left(14); str=q->value(13).toString().left(14);
break; break;
} }
*report+=QString().sprintf("%-14s ",(const char *)str); *report+=RDReport::leftJustify(str,14)+" ";
// //
// Source and Destination // Source and Destination
@@ -338,54 +349,52 @@ void ListReports::GenerateEventReport(QString *report)
QString().sprintf("(CHANNEL=%d)",q->value(14).toInt()); QString().sprintf("(CHANNEL=%d)",q->value(14).toInt());
q1=new RDSqlQuery(sql); q1=new RDSqlQuery(sql);
if(q1->first()) { if(q1->first()) {
*report+=QString().sprintf("%-20s ", *report+=
(const char *)GetSourceName(q1->value(0).toString(), RDReport::leftJustify(GetSourceName(q1->value(0).toString(),
q1->value(1).toInt(), q1->value(1).toInt(),
q->value(18).toInt()).left(20)); q->value(18).toInt()).left(20),20)+" ";
} }
else { else {
*report+=" "; *report+=" ";
} }
delete q1; delete q1;
*report+=QString().sprintf("Cut %10s ", *report+=QString("Cut ")+
(const char *)q->value(15).toString().left(20)); RDReport::leftJustify(q->value(15).toString(),10)+" ";
break; break;
case RDRecording::MacroEvent: case RDRecording::MacroEvent:
*report+=QString().sprintf("Cart %06u ", *report+=QString("Cart ")+
q->value(17).toUInt()); QString().sprintf("%06u ",q->value(17).toUInt());
*report+=" "; *report+=" ";
break; break;
case RDRecording::SwitchEvent: case RDRecording::SwitchEvent:
*report+=QString().sprintf("%-20s ", *report+=
(const char *)GetSourceName(q->value(13).toString(), RDReport::leftJustify(GetSourceName(q->value(13).toString(),
q->value(14).toInt(), q->value(14).toInt(),
q->value(18).toInt()).left(20)); q->value(18).toInt()),20)+" ";
*report+=QString().sprintf("%-20s ", *report+=
(const char *)GetDestinationName(q->value(13).toString(), RDReport::leftJustify(GetDestinationName(q->value(13).toString(),
q->value(14).toInt(), q->value(14).toInt(),
q->value(19).toInt()).left(20)); q->value(19).toInt()),20)+" ";
break; break;
case RDRecording::Playout: case RDRecording::Playout:
*report+=QString().sprintf("Cut %10s ", *report+=QString("Cut ")+
(const char *)q->value(15).toString().left(20)); RDReport::leftJustify(q->value(15).toString(),10)+" ";
*report+=" "; *report+=" ";
break; break;
case RDRecording::Download: case RDRecording::Download:
*report+=QString().sprintf("%-20s ", *report+=RDReport::leftJustify(q->value(16).toString().left(20),20)+" ";
(const char *)q->value(16).toString().left(20)); *report+=QString("Cut ")+
*report+=QString().sprintf("Cut %10s ", RDReport::leftJustify(q->value(15).toString(),10)+" ";
(const char *)q->value(15).toString().left(20));
break; break;
case RDRecording::Upload: case RDRecording::Upload:
*report+=QString().sprintf("Cut %10s ", *report+=QString("Cut ")+
(const char *)q->value(15).toString().left(20)); RDReport::leftJustify(q->value(15).toString(),10)+" ";
*report+=QString().sprintf("%-20s ", *report+=RDReport::leftJustify(q->value(16).toString(),20)+" ";
(const char *)q->value(16).toString().left(20));
break; break;
case RDRecording::LastType: case RDRecording::LastType:
@@ -415,41 +424,54 @@ void ListReports::GenerateXloadReport(QString *report)
// //
// Generate Header // Generate Header
// //
*report=" Rivendell RDCatch Upload/Download Report\n"; *report=RDReport::center("Rivendell RDCatch Upload/Download Report",132)+"\n";
*report+=QString(). *report+=QString("Generated: ")+
sprintf("Generated: %s\n", QDateTime::currentDateTime().toString("MM/dd/yyyy")+"\n";
(const char *)QDateTime(QDate::currentDate(),QTime::currentTime()).
toString("MM/dd/yyyy - hh:mm:ss"));
*report+="\n"; *report+="\n";
*report+="T -Start-- -Days of Week- -Location----- -Cut------- -URL------------------------------------- -Username---- -Description------------\n"; *report+="T -Start-- -Days of Week- -Location----- -Cut------- -URL------------------------------------- -Username---- -Description------------\n";
// //
// Generate Rows // Generate Rows
// //
sql=QString().sprintf("select TYPE,START_TIME,SUN,MON,TUE,WED,THU,FRI,SAT,\ sql=QString("select ")+
STATION_NAME,CUT_NAME,URL,URL_USERNAME,DESCRIPTION \ "TYPE,"+ // 00
from RECORDINGS where (TYPE=%d)||(TYPE=%d) order by START_TIME", "START_TIME,"+ // 01
RDRecording::Upload,RDRecording::Download); "SUN,"+ // 02
"MON,"+ // 03
"TUE,"+ // 04
"WED,"+ // 05
"THU,"+ // 06
"FRI,"+ // 07
"SAT,"+ // 08
"STATION_NAME,"+ // 09
"CUT_NAME,"+ // 10
"URL,"+ // 11
"URL_USERNAME,"+ // 12
"DESCRIPTION "+ // 13
"from RECORDINGS where "+
QString().sprintf("(TYPE=%d)||",RDRecording::Upload)+
QString().sprintf("(TYPE=%d) ",RDRecording::Download)+
"order by START_TIME";
q=new RDSqlQuery(sql); q=new RDSqlQuery(sql);
while(q->next()) { while(q->next()) {
// //
// Event Type // Event Type
// //
switch((RDRecording::Type)q->value(0).toInt()) { switch((RDRecording::Type)q->value(0).toInt()) {
case RDRecording::Download: case RDRecording::Download:
*report+="D"; *report+="D";
exists=RDCut::exists(q->value(10).toString()); exists=RDCut::exists(q->value(10).toString());
break; break;
case RDRecording::Upload: case RDRecording::Upload:
*report+="U"; *report+="U";
exists=RDCut::exists(q->value(10).toString()); exists=RDCut::exists(q->value(10).toString());
break; break;
default: default:
*report+="?"; *report+="?";
exists=true; exists=true;
break; break;
} }
if(exists) { if(exists) {
*report+=" "; *report+=" ";
@@ -461,8 +483,7 @@ void ListReports::GenerateXloadReport(QString *report)
// //
// Start Time // Start Time
// //
*report+=QString().sprintf("%8s ", *report+=RDReport::leftJustify(q->value(1).toTime().toString("hh:mm:ss"),8)+" ";
(const char *)q->value(1).toTime().toString("hh:mm:ss"));
// //
// Days of the Week // Days of the Week
@@ -494,7 +515,7 @@ void ListReports::GenerateXloadReport(QString *report)
if(q->value(6).toString()=="Y") { if(q->value(6).toString()=="Y") {
*report+="Th"; *report+="Th";
} }
else { else {
*report+=" "; *report+=" ";
} }
if(q->value(7).toString()=="Y") { if(q->value(7).toString()=="Y") {
@@ -509,35 +530,31 @@ void ListReports::GenerateXloadReport(QString *report)
else { else {
*report+=" "; *report+=" ";
} }
// //
// Location // Location
// //
*report+=QString().sprintf("%-14s ", *report+=RDReport::leftJustify(q->value(9).toString(),14)+" ";
(const char *)q->value(9).toString().left(14));
// //
// Cut // Cut
// //
*report+=QString().sprintf("%11s ",(const char *)q->value(10).toString()); *report+=RDReport::leftJustify(q->value(10).toString(),11)+" ";
// //
// URL // URL
// //
*report+=QString().sprintf("%-41s ", *report+=RDReport::leftJustify(q->value(11).toString(),41)+" ";
(const char *)q->value(11).toString().left(41));
// //
// URL Username // URL Username
// //
*report+=QString().sprintf("%-13s ", *report+=RDReport::leftJustify(q->value(12).toString(),13)+" ";
(const char *)q->value(12).toString().left(13));
// //
// Description // Description
// //
*report+=QString().sprintf("%s", *report+=RDReport::leftJustify(q->value(13).toString(),24);
(const char *)q->value(13).toString().left(24));
// //
// End of Line // End of Line