1
0
mirror of https://github.com/ElvishArtisan/rivendell.git synced 2025-04-11 07:12:56 +02:00

2020-10-08 Fred Gleason <fredg@paravelsystems.com>

* Added an 'IMPORTER_LINES.FILE_LINE' field to the database.
	* Added an 'IMPORTER_LINES.LINK_START_TIME' field to the database.
	* Added an 'IMPORTER_LINES.LINK_LENGTH' field to the database.
	* Incremented the database version to 341.
	* Reimplemented the 'RDSvc::linkLog()' and 'RDEventLine::linkLog()'
	methods to use the updated 'IMPORTER_LINES' table schema.
	* Added generation of an 'RDLogManager Error Report' when errors
	are detected when importing an external scheduler file in
	rdlogmanager(1).

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2020-10-08 20:08:57 -04:00
parent 53faf2a4b9
commit b9f84fca37
32 changed files with 547 additions and 207 deletions

@ -20422,3 +20422,13 @@
* Incremented the database version to 340.
* Added type icons to the 'Imported Events' list in the 'Test Import'
dialog in rdadmin(1).
2020-10-08 Fred Gleason <fredg@paravelsystems.com>
* Added an 'IMPORTER_LINES.FILE_LINE' field to the database.
* Added an 'IMPORTER_LINES.LINK_START_TIME' field to the database.
* Added an 'IMPORTER_LINES.LINK_LENGTH' field to the database.
* Incremented the database version to 341.
* Reimplemented the 'RDSvc::linkLog()' and 'RDEventLine::linkLog()'
methods to use the updated 'IMPORTER_LINES' table schema.
* Added generation of an 'RDLogManager Error Report' when errors
are detected when importing an external scheduler file in
rdlogmanager(1).

@ -7,16 +7,19 @@ FIELD NAME TYPE REMARKS
----------------------------------------------------------------
ID int(10) unsigned Primary key, auto increment
STATION_NAME varchar(64) From STATIONS.NAME
PROCESS_ID int unsigned
PROCESS_ID int(10) unsigned
FILE_LINE int(10) unsigned
LINE_ID int(10) unsigned
TYPE int(10) unsigned RDLogLine::Type
START_HOUR int (11) signed
START_HOUR int(11) signed
START_SECS int(11) signed
CART_NUMBER int (10) unsigned
CART_NUMBER int(10) unsigned
TITLE varchar(191)
LENGTH int (11) signed
LENGTH int(11) signed
EXT_DATA varchar(32)
EXT_EVENT_ID varchar(32)
EXT_ANNC_TYPE varchar(8)
EXT_CART_NAME varchar(32)
LINK_START_TIME time
LINK_LENGTH int(11)
EVENT_USED enum('N','Y')

@ -24,7 +24,7 @@
/*
* Current Database Version
*/
#define RD_VERSION_DATABASE 340
#define RD_VERSION_DATABASE 341
#endif // DBVERSION_H

@ -2958,5 +2958,21 @@ Zkuste to, prosím, znovu!</translation>
<source>Import failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Line</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>invalid start time and/or length on inline traffic break.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>multiple inline traffic breaks not permitted within the same music event</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>In event</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

@ -2953,5 +2953,21 @@ bitte erneut versuchen!</translation>
<source>Import failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Line</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>invalid start time and/or length on inline traffic break.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>multiple inline traffic breaks not permitted within the same music event</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>In event</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

@ -2937,5 +2937,21 @@ please try again!</source>
<source>Import failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Line</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>invalid start time and/or length on inline traffic break.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>multiple inline traffic breaks not permitted within the same music event</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>In event</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

@ -2323,5 +2323,21 @@ please try again!</source>
<source>Import failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Line</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>invalid start time and/or length on inline traffic break.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>multiple inline traffic breaks not permitted within the same music event</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>In event</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

@ -2859,5 +2859,21 @@ prøv ein gong til!</translation>
<source>Import failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Line</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>invalid start time and/or length on inline traffic break.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>multiple inline traffic breaks not permitted within the same music event</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>In event</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

@ -2859,5 +2859,21 @@ prøv ein gong til!</translation>
<source>Import failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Line</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>invalid start time and/or length on inline traffic break.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>multiple inline traffic breaks not permitted within the same music event</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>In event</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

@ -2904,5 +2904,21 @@ por favor, tente novamente!</translation>
<source>Import failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Line</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>invalid start time and/or length on inline traffic break.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>multiple inline traffic breaks not permitted within the same music event</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>In event</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

@ -1003,13 +1003,10 @@ bool RDEventLine::linkLog(RDLogEvent *e,RDLog *log,const QString &svcname,
"EXT_EVENT_ID,"+ // 04
"EXT_ANNC_TYPE,"+ // 05
"EXT_CART_NAME,"+ // 06
"INSERT_BREAK,"+ // 07
"INSERT_TRACK,"+ // 08
"INSERT_FIRST,"+ // 09
"TITLE,"+ // 10
"TRACK_STRING,"+ // 11
"LINK_START_TIME,"+ // 12
"LINK_LENGTH "+ // 13
"TITLE,"+ // 07
"TYPE,"+ // 08
"LINK_START_TIME,"+ // 09
"LINK_LENGTH "+ // 10
"from IMPORTER_LINES where "+
"STATION_NAME=\""+RDEscapeString(event_station->name())+"\" && "+
QString().sprintf("PROCESS_ID=%u && ",getpid())+
@ -1020,142 +1017,99 @@ bool RDEventLine::linkLog(RDLogEvent *e,RDLog *log,const QString &svcname,
q=new RDSqlQuery(sql);
while(q->next()) {
int length=GetLength(q->value(0).toUInt(),q->value(2).toInt());
if(q->value(9).toUInt()==RDEventLine::InsertBreak) {
if(q->value(7).toString()=="Y") { // Insert Break
if((!event_nested_event.isEmpty()&&(event_nested_event!=event_name))) {
e->insert(e->size(),1);
logline=e->logLine(e->size()-1);
logline->setId(e->nextId());
logline->setStartTime(RDLogLine::Logged,time);
logline->setType(RDLogLine::TrafficLink);
logline->setSource(event_src);
logline->setTransType(trans_type);
logline->setEventLength(event_length);
logline->setLinkEventName(event_nested_event);
if(!q->value(13).isNull()) {
logline->setLinkStartTime(q->value(12).toTime());
logline->setLinkLength(q->value(13).toInt());
}
else {
logline->setLinkStartTime(link_logline->linkStartTime());
logline->setLinkLength(link_logline->linkLength());
}
logline->setLinkStartSlop(link_logline->linkStartSlop());
logline->setLinkEndSlop(link_logline->linkEndSlop());
logline->setLinkId(link_logline->linkId());
logline->setLinkEmbedded(true);
}
}
if(q->value(8).toString()=="Y") { // Insert Track
//
// Inline Traffic Break
//
if(q->value(8).toUInt()==RDLogLine::TrafficLink) {
if((!event_nested_event.isEmpty()&&(event_nested_event!=event_name))) {
e->insert(e->size(),1);
logline=e->logLine(e->size()-1);
logline->setId(e->nextId());
logline->setStartTime(RDLogLine::Logged,time);
logline->setType(RDLogLine::Track);
logline->setType(RDLogLine::TrafficLink);
logline->setSource(event_src);
logline->setTransType(RDLogLine::Segue);
logline->setMarkerComment(q->value(11).toString());
logline->setTransType(trans_type);
logline->setEventLength(event_length);
logline->setLinkEventName(event_name);
logline->setLinkStartTime(link_logline->linkStartTime());
logline->setLinkLength(link_logline->linkLength());
logline->setLinkEventName(event_nested_event);
logline->setLinkStartTime(q->value(9).toTime());
logline->setLinkLength(q->value(10).toInt());
logline->setLinkStartSlop(link_logline->linkStartSlop());
logline->setLinkEndSlop(link_logline->linkEndSlop());
logline->setLinkId(link_logline->linkId());
logline->setLinkEmbedded(true);
}
}
else {
if(q->value(8).toString()=="Y") { // Insert Track
e->insert(e->size(),1);
logline=e->logLine(e->size()-1);
logline->setId(e->nextId());
logline->setStartTime(RDLogLine::Logged,time);
logline->setType(RDLogLine::Track);
logline->setSource(event_src);
logline->setTransType(RDLogLine::Segue);
logline->setMarkerComment(q->value(11).toString());
logline->setEventLength(event_length);
logline->setLinkEventName(event_name);
logline->setLinkStartTime(link_logline->linkStartTime());
logline->setLinkLength(link_logline->linkLength());
logline->setLinkStartSlop(link_logline->linkStartSlop());
logline->setLinkEndSlop(link_logline->linkEndSlop());
logline->setLinkId(link_logline->linkId());
logline->setLinkEmbedded(true);
}
if(q->value(7).toString()=="Y") { // Insert Break
if((!event_nested_event.isEmpty()&&(event_nested_event!=event_name))) {
e->insert(e->size(),1);
logline=e->logLine(e->size()-1);
logline->setId(e->nextId());
logline->setStartTime(RDLogLine::Logged,time);
logline->setType(RDLogLine::TrafficLink);
logline->setSource(event_src);
logline->setTransType(trans_type);
logline->setEventLength(event_length);
logline->setLinkEventName(event_nested_event);
if(!q->value(13).isNull()) {
logline->setLinkStartTime(q->value(12).toTime());
logline->setLinkLength(q->value(13).toInt());
}
else {
logline->setLinkStartTime(link_logline->linkStartTime());
logline->setLinkLength(link_logline->linkLength());
}
logline->setLinkStartSlop(link_logline->linkStartSlop());
logline->setLinkEndSlop(link_logline->linkEndSlop());
logline->setLinkId(link_logline->linkId());
logline->setLinkEmbedded(true);
}
}
}
//
// Insert imported event
// Voicetrack Marker
//
e->insert(e->size(),1);
logline=e->logLine(e->size()-1);
logline->setId(e->nextId());
logline->setSource(event_src);
logline->
setStartTime(RDLogLine::Logged,
QTime(start_start_hour,0,0).addSecs(q->value(1).toInt()));
logline->setGraceTime(grace_time);
logline->setTimeType(time_type);
logline->setTransType(trans_type);
logline->setExtStartTime(QTime().addSecs(3600*start_start_hour+
q->value(1).toInt()));
logline->setExtLength(q->value(2).toInt());
logline->setExtData(q->value(3).toString().trimmed());
logline->setExtEventId(q->value(4).toString().trimmed());
logline->setExtAnncType(q->value(5).toString().trimmed());
logline->setExtCartName(q->value(6).toString().trimmed());
logline->setEventLength(event_length);
logline->setLinkEventName(event_name);
logline->setLinkStartTime(link_logline->linkStartTime());
logline->setLinkLength(link_logline->linkLength());
logline->setLinkStartSlop(link_logline->linkStartSlop());
logline->setLinkEndSlop(link_logline->linkEndSlop());
logline->setLinkId(link_logline->linkId());
logline->setLinkEmbedded(link_logline->linkEmbedded());
if((q->value(6).toString()==label_cart)&&(!label_cart.isEmpty())) {
logline->setType(RDLogLine::Marker);
logline->setMarkerComment(q->value(10).toString());
logline->setCartNumber(0);
if(q->value(8).toUInt()==RDLogLine::Track) {
e->insert(e->size(),1);
logline=e->logLine(e->size()-1);
logline->setId(e->nextId());
logline->setStartTime(RDLogLine::Logged,time);
logline->setType(RDLogLine::Track);
logline->setSource(event_src);
logline->setTransType(RDLogLine::Segue);
logline->setMarkerComment(q->value(7).toString());
logline->setEventLength(event_length);
logline->setLinkEventName(event_name);
logline->setLinkStartTime(link_logline->linkStartTime());
logline->setLinkLength(link_logline->linkLength());
logline->setLinkStartSlop(link_logline->linkStartSlop());
logline->setLinkEndSlop(link_logline->linkEndSlop());
logline->setLinkId(link_logline->linkId());
logline->setLinkEmbedded(true);
}
else {
if((q->value(6).toString()==track_cart)&&(!track_cart.isEmpty())) {
logline->setType(RDLogLine::Track);
logline->setMarkerComment(q->value(10).toString());
//
// Cart
//
if(q->value(8).toUInt()==RDLogLine::Cart) {
e->insert(e->size(),1);
logline=e->logLine(e->size()-1);
logline->setId(e->nextId());
logline->setSource(event_src);
logline->
setStartTime(RDLogLine::Logged,
QTime(start_start_hour,0,0).addSecs(q->value(1).toInt()));
logline->setGraceTime(grace_time);
logline->setTimeType(time_type);
logline->setTransType(trans_type);
logline->setExtStartTime(QTime().addSecs(3600*start_start_hour+
q->value(1).toInt()));
logline->setExtLength(q->value(2).toInt());
logline->setExtData(q->value(3).toString().trimmed());
logline->setExtEventId(q->value(4).toString().trimmed());
logline->setExtAnncType(q->value(5).toString().trimmed());
logline->setExtCartName(q->value(6).toString().trimmed());
logline->setEventLength(event_length);
logline->setLinkEventName(event_name);
logline->setLinkStartTime(link_logline->linkStartTime());
logline->setLinkLength(link_logline->linkLength());
logline->setLinkStartSlop(link_logline->linkStartSlop());
logline->setLinkEndSlop(link_logline->linkEndSlop());
logline->setLinkId(link_logline->linkId());
logline->setLinkEmbedded(link_logline->linkEmbedded());
if((q->value(6).toString()==label_cart)&&(!label_cart.isEmpty())) {
logline->setType(RDLogLine::Marker);
logline->setMarkerComment(q->value(7).toString());
logline->setCartNumber(0);
}
else {
logline->setType(RDLogLine::Cart);
logline->setCartNumber(q->value(0).toUInt());
if((q->value(6).toString()==track_cart)&&(!track_cart.isEmpty())) {
logline->setType(RDLogLine::Track);
logline->setMarkerComment(q->value(7).toString());
logline->setCartNumber(0);
}
else {
logline->setType(RDLogLine::Cart);
logline->setCartNumber(q->value(0).toUInt());
}
}
time=time.addMSecs(length);
}
time=time.addMSecs(length);
//
// Clear Leading Event Values

@ -569,6 +569,7 @@ bool RDSvc::import(ImportSource src,const QDate &date,const QString &break_str,
QString track_label;
QTime link_time;
int file_line=0;
while(fgets(buf,RD_MAX_IMPORT_LINE_LENGTH,infile)!=NULL) {
str_buf=QString::fromUtf8(buf);
@ -598,11 +599,26 @@ bool RDSvc::import(ImportSource src,const QDate &date,const QString &break_str,
//
// Length
//
hours_len_buf=str_buf.mid(hours_len_offset,hours_len_length);
minutes_len_buf=str_buf.mid(minutes_len_offset,minutes_len_length);
seconds_len_buf=str_buf.mid(seconds_len_offset,seconds_len_length);
cartlen=3600000*hours_len_buf.toInt()+60000*minutes_len_buf.toInt()+
1000*seconds_len_buf.toInt();
cartlen=-1;
int len=0;
bool ok1=true;
bool ok2=true;
bool ok3=true;
if(hours_len_length>0) {
QString buf=str_buf.mid(hours_len_offset,hours_len_length);
len+=3600000*buf.toUInt(&ok1);
}
if(minutes_len_length>0) {
QString buf=str_buf.mid(minutes_len_offset,minutes_len_length);
len+=60000*buf.toInt(&ok2);
}
if(seconds_len_length>0) {
QString buf=str_buf.mid(seconds_len_offset,seconds_len_length);
len+=1000*buf.toUInt(&ok3);
}
if(ok1&&ok2&&ok3) {
cartlen=len;
}
//
// External Data
@ -627,13 +643,14 @@ bool RDSvc::import(ImportSource src,const QDate &date,const QString &break_str,
sql=QString("insert into IMPORTER_LINES set ")+
"STATION_NAME=\""+RDEscapeString(svc_station->name())+"\","+
QString().sprintf("PROCESS_ID=%d,",getpid())+
QString().sprintf("FILE_LINE=%u,",file_line)+
QString().sprintf("LINE_ID=%d,",line_id);
if(start_time_ok) {
sql+=QString().sprintf("START_HOUR=%d,",start_hour)+
QString().sprintf("START_SECS=%d,",
60*start_minutes+start_seconds);
}
if(cartlen>0) {
if(cartlen>=0) {
sql+=QString().sprintf("LENGTH=%d,",cartlen);
}
@ -650,6 +667,7 @@ bool RDSvc::import(ImportSource src,const QDate &date,const QString &break_str,
"TITLE=\""+RDEscapeString(title)+"\"";
RDSqlQuery::apply(sql);
line_id++;
file_line++;
continue;
}
@ -661,6 +679,7 @@ bool RDSvc::import(ImportSource src,const QDate &date,const QString &break_str,
sql+=QString().sprintf("TYPE=%u",RDLogLine::TrafficLink);
RDSqlQuery::apply(sql);
line_id++;
file_line++;
continue;
}
}
@ -673,8 +692,10 @@ bool RDSvc::import(ImportSource src,const QDate &date,const QString &break_str,
"TITLE=\""+RDEscapeString(str_buf.simplified().trimmed())+"\"";
RDSqlQuery::apply(sql);
line_id++;
file_line++;
continue;
}
file_line++;
}
//
@ -800,6 +821,10 @@ bool RDSvc::linkLog(RDSvc::ImportSource src,const QDate &date,
QString sql;
RDSqlQuery *q;
QString autofill_errors;
QTime prev_start_time;
RDLogEvent *src_event=NULL;
RDLogEvent *dest_event=NULL;
RDLogLine *logline=NULL;
RDLogLock *log_lock=new RDLogLock(logname,user,svc_station,this);
if(!TryLock(log_lock,err_msg)) {
@ -847,13 +872,21 @@ bool RDSvc::linkLog(RDSvc::ImportSource src,const QDate &date,
return false;
}
//
// Resolve embedded link parameters
//
if(src==RDSvc::Music) {
if(!ResolveInlineTrafficLinks(logname,err_msg)) {
return false;
}
}
//
// Iterate Through the Log
//
RDLogEvent *src_event=new RDLogEvent(logname);
RDLogEvent *dest_event=new RDLogEvent(logname);
src_event=new RDLogEvent(logname);
dest_event=new RDLogEvent(logname);
src_event->load();
RDLogLine *logline=NULL;
for(int i=0;i<src_event->size();i++) {
logline=src_event->logLine(i);
if(logline->type()==src_type) {
@ -904,7 +937,8 @@ bool RDSvc::linkLog(RDSvc::ImportSource src,const QDate &date,
"IMPORTER_LINES.STATION_NAME=\""+
RDEscapeString(svc_station->name())+"\" && "+
QString().sprintf("IMPORTER_LINES.PROCESS_ID=%u && ",getpid())+
"IMPORTER_LINES.EVENT_USED=\"N\"";
"IMPORTER_LINES.EVENT_USED=\"N\" "+
"order by LINE_ID";
q=new RDSqlQuery(sql);
while(q->next()) {
event=true;
@ -945,7 +979,7 @@ bool RDSvc::linkLog(RDSvc::ImportSource src,const QDate &date,
sql=QString("delete from IMPORTER_LINES where ")+
"STATION_NAME=\""+RDEscapeString(svc_station->name())+"\" && "+
QString().sprintf("PROCESS_ID=%u",getpid());
// printf("Importer Table Cleanup SQL: %s\n",(const char *)sql);
// printf("Importer Table Cleanup SQL: %s\n",(const char *)sql);
RDSqlQuery::apply(sql);
delete log_lock;
@ -1582,3 +1616,130 @@ bool RDSvc::CheckId(std::vector<int> *v,int value)
v->push_back(value);
return true;
}
QString RDSvc::MakeErrorLine(int indent,unsigned lineno,const QString &msg)
const
{
QString margin;
for(int i=0;i<indent;i++) {
margin+=" ";
}
return margin+tr("Line")+QString().sprintf(" %u: ",1+lineno)+msg+"\n";
}
bool RDSvc::ResolveInlineTrafficLinks(const QString &logname,QString *err_msg)
const
{
RDLogEvent *evt=NULL;
RDLogLine *logline=NULL;
QTime start;
QTime end;
QString sql;
RDSqlQuery *q=NULL;
bool ok=false;
switch(subEventInheritance()) {
case RDSvc::ParentEvent:
evt=new RDLogEvent(logname);
evt->load();
ok=true;
for(int i=0;i<evt->size();i++) {
logline=evt->logLine(i);
if(logline->type()==RDLogLine::MusicLink) {
start=logline->linkStartTime();
end=logline->linkStartTime().addSecs(logline->linkLength());
sql=QString("select ")+
"ID,"+ // 00
"FILE_LINE "+ // 01
"from IMPORTER_LINES where "+
"IMPORTER_LINES.STATION_NAME=\""+
RDEscapeString(svc_station->name())+"\" && "+
QString().sprintf("IMPORTER_LINES.PROCESS_ID=%u && ",getpid())+
QString().sprintf("TYPE=%u && ",RDLogLine::TrafficLink)+
QString().sprintf("START_HOUR=%d && ",start.hour())+
QString().sprintf("START_SECS>=%d && ",
60*start.minute()+start.second())+
QString().sprintf("START_SECS<%d",60*start.minute()+start.second()+logline->linkLength()/1000);
q=new RDSqlQuery(sql);
if(q->size()>1) {
*err_msg+=tr("In event")+" \""+logline->linkEventName()+"\"@"+
logline->startTime(RDLogLine::Logged).toString("hh:mm:ss")+":\n";
while(q->next()) {
*err_msg+=MakeErrorLine(4,q->value(1).toUInt(),
tr("multiple inline traffic breaks not permitted within the same music event"));
}
*err_msg+="\n";
ok=false;
}
if(q->first()) {
sql=QString("update IMPORTER_LINES set ")+
"LINK_START_TIME=\""+
logline->linkStartTime().toString("hh:mm:ss")+"\","+
QString().sprintf("LINK_LENGTH=%d where ",logline->linkLength())+
QString().sprintf("ID=%u",q->value(0).toUInt());
RDSqlQuery::apply(sql);
}
delete q;
}
}
delete evt;
evt=NULL;
if(!ok) {
return false;
}
break;
case RDSvc::SchedFile:
//
// Verify that all inline traffic events have explicit start times
// and length
//
sql=QString("select ")+
"FILE_LINE "+ // 00
"from IMPORTER_LINES where "+
"IMPORTER_LINES.STATION_NAME=\""+
RDEscapeString(svc_station->name())+"\" && "+
QString().sprintf("IMPORTER_LINES.PROCESS_ID=%u && ",getpid())+
QString().sprintf("TYPE=%u && ",RDLogLine::TrafficLink)+
"(START_HOUR is null || START_SECS is null || LENGTH is null)";
ok=true;
q=new RDSqlQuery(sql);
while(q->next()) {
*err_msg=MakeErrorLine(0,q->value(0).toUInt(),
tr("invalid start time and/or length on inline traffic break."));
ok=false;
}
delete q;
if(!ok) {
return false;
}
//
// Resolve link parameters
//
sql=QString("select ")+
"ID,"+ // 00
"START_HOUR,"+ // 01
"START_SECS,"+ // 02
"LENGTH "+ // 03
"from IMPORTER_LINES where "+
QString().sprintf("TYPE=%u",RDLogLine::TrafficLink);
q=new RDSqlQuery(sql);
while(q->next()) {
sql=QString("update IMPORTER_LINES set ")+
"LINK_START_TIME=\""+QTime(q->value(1).toInt(),0,0).
addSecs(q->value(2).toInt()).toString("hh:mm:ss")+"\","+
QString().sprintf("LINK_LENGTH=%d where ",q->value(3).toInt())+
QString().sprintf("ID=%u",q->value(0).toUInt());
RDSqlQuery::apply(sql);
}
delete q;
break;
}
return true;
}

@ -120,6 +120,8 @@ class RDSvc : public QObject
void GetParserStrings(ImportSource src,QString *break_str,QString *track_str,
QString *label_cart,QString *track_cart);
bool CheckId(std::vector<int> *v,int value);
QString MakeErrorLine(int indent,unsigned lineno,const QString &msg) const;
bool ResolveInlineTrafficLinks(const QString &logname,QString *err_msg) const;
QString svc_name;
RDStation *svc_station;
RDConfig *svc_config;

@ -6681,6 +6681,10 @@ Prověřte, prosím, svá nastavení a zkuste to znovu.</translation>
<source>[voice track]</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Line</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ViewAdapters</name>

@ -6307,6 +6307,10 @@ Bitte überprüfen Sie ihre Einstellungen und versuchen sie es erneut.</translat
<source>[voice track]</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Line</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ViewAdapters</name>

@ -6648,6 +6648,10 @@ Revise los parámetros e intente de nuevo.</translation>
<source>[voice track]</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Line</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ViewAdapters</name>

@ -5127,6 +5127,10 @@ please check your settings and try again.</source>
<source>[voice track]</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Line</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ViewAdapters</name>

@ -6153,6 +6153,10 @@ Sjekk oppsettet ditt og prøv att.</translation>
<source>[voice track]</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Line</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ViewAdapters</name>

@ -6153,6 +6153,10 @@ Sjekk oppsettet ditt og prøv att.</translation>
<source>[voice track]</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Line</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ViewAdapters</name>

@ -6275,6 +6275,10 @@ por favor, cheque suas configurações e tente novamente</translation>
<source>[voice track]</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Line</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ViewAdapters</name>

@ -134,6 +134,8 @@ TestImport::TestImport(RDSvc *svc,RDSvc::ImportSource src,QWidget *parent)
test_events_list->setColumnAlignment(6,Qt::AlignCenter);
test_events_list->addColumn(tr("Annc Type"));
test_events_list->setColumnAlignment(7,Qt::AlignCenter);
test_events_list->addColumn(tr("Line"));
test_events_list->setColumnAlignment(8,Qt::AlignRight);
test_events_list->setColumnSortType(0,RDListView::LineSort);
test_events_label=new QLabel(test_events_list,tr("Imported Events"),this);
test_events_label->setGeometry(15,160,sizeHint().width()-30,18);
@ -204,7 +206,8 @@ void TestImport::importData()
"EXT_EVENT_ID,"+ // 05
"EXT_ANNC_TYPE,"+ // 06
"TITLE,"+ // 07
"TYPE "+ // 08
"TYPE,"+ // 08
"FILE_LINE "+ // 09
"from IMPORTER_LINES where "+
"STATION_NAME=\""+RDEscapeString(rda->station()->name())+"\" && "+
QString().sprintf("PROCESS_ID=%u ",getpid())+
@ -223,6 +226,7 @@ void TestImport::importData()
item->setText(5,q->value(4).toString().trimmed());
item->setText(6,q->value(5).toString().trimmed());
item->setText(7,q->value(6).toString().trimmed());
item->setText(8,QString().sprintf("%u",1+q->value(9).toUInt()));
switch((RDLogLine::Type)q->value(8).toUInt()) {
case RDLogLine::Cart:
item->setPixmap(0,*test_playout_map);

@ -2,7 +2,7 @@
//
// Generate a Rivendell Log
//
// (C) Copyright 2002-2019 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
@ -427,14 +427,15 @@ void GenerateLog::musicData()
connect(svc,SIGNAL(generationProgress(int)),
gen_progress_dialog,SLOT(setValue(int)));
QString report;
if(!svc->linkLog(RDSvc::Music,gen_date_edit->date(),logname,&report,rda->user(),
&err_msg)) {
QMessageBox::warning(this,"RDLogManager - "+tr("Error"),
tr("Unable to link music log")+": "+err_msg);
delete log;
delete svc;
return;
if(!svc->linkLog(RDSvc::Music,gen_date_edit->date(),logname,&report,
rda->user(),&err_msg)) {
gen_progress_dialog->setValue(gen_progress_dialog->maximum());
RDTextFile(tr("RDLogManager Error Report")+"\n\n"+
tr("Music schedule import failed!")+"\n\n"+err_msg);
delete log;
delete svc;
UpdateControls();
return;
}
SendNotification(RDNotification::ModifyAction,log->name());
delete log;
@ -489,10 +490,12 @@ void GenerateLog::trafficData()
QString report;
if(!svc->linkLog(RDSvc::Traffic,gen_date_edit->date(),logname,&report,rda->user(),
&err_msg)) {
QMessageBox::warning(this,"RDLogManager - "+tr("Error"),
tr("Unable to link traffic log")+": "+err_msg);
gen_progress_dialog->setValue(gen_progress_dialog->maximum());
RDTextFile(tr("RDLogManager Error Report")+"\n\n"+
tr("Traffic schedule import failed!")+"\n\n"+err_msg);
delete log;
delete svc;
UpdateControls();
return;
}
SendNotification(RDNotification::ModifyAction,log->name());

@ -1012,14 +1012,6 @@ Opětovné sloučení tato data smaže. Sloučit znovu?</translation>
<source>Unable to clear music links</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to link music log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to link traffic log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Generate Log</source>
<translation type="unfinished"></translation>
@ -1064,6 +1056,18 @@ Opětovné sloučení tato data smaže. Sloučit znovu?</translation>
<source>No broken rules or validation exceptions found.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>RDLogManager Error Report</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Music schedule import failed!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Traffic schedule import failed!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImportListView</name>

@ -1012,14 +1012,6 @@ Einbinden wird diese entfernen. Fortfahren?</translation>
<source>Unable to clear music links</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to link music log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to link traffic log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Generate Log</source>
<translation type="unfinished"></translation>
@ -1064,6 +1056,18 @@ Einbinden wird diese entfernen. Fortfahren?</translation>
<source>No broken rules or validation exceptions found.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>RDLogManager Error Report</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Music schedule import failed!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Traffic schedule import failed!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImportListView</name>

@ -1014,14 +1014,6 @@ removerá estos datos. ¿Remezclar?</translation>
<source>Unable to clear music links</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to link music log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to link traffic log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Generate Log</source>
<translation type="unfinished"></translation>
@ -1066,6 +1058,18 @@ removerá estos datos. ¿Remezclar?</translation>
<source>No broken rules or validation exceptions found.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>RDLogManager Error Report</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Music schedule import failed!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Traffic schedule import failed!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImportListView</name>

@ -820,14 +820,6 @@ Do you want to save?</source>
<source>Unable to clear music links</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to link music log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to link traffic log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Generate Log</source>
<translation type="unfinished"></translation>
@ -876,6 +868,18 @@ Do you want to save?</source>
<source>No broken rules or validation exceptions found.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>RDLogManager Error Report</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Music schedule import failed!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Traffic schedule import failed!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImportListView</name>

@ -1013,14 +1013,6 @@ Flettar du på nytt, vil du fjerna desse dataa. Flett på nytt?</translation>
<source>Unable to clear music links</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to link music log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to link traffic log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>already exists. Recreating it</source>
<translation type="unfinished"></translation>
@ -1061,6 +1053,18 @@ Flettar du på nytt, vil du fjerna desse dataa. Flett på nytt?</translation>
<source>No broken rules or validation exceptions found.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>RDLogManager Error Report</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Music schedule import failed!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Traffic schedule import failed!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImportListView</name>

@ -1013,14 +1013,6 @@ Flettar du på nytt, vil du fjerna desse dataa. Flett på nytt?</translation>
<source>Unable to clear music links</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to link music log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to link traffic log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>already exists. Recreating it</source>
<translation type="unfinished"></translation>
@ -1061,6 +1053,18 @@ Flettar du på nytt, vil du fjerna desse dataa. Flett på nytt?</translation>
<source>No broken rules or validation exceptions found.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>RDLogManager Error Report</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Music schedule import failed!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Traffic schedule import failed!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImportListView</name>

@ -1014,14 +1014,6 @@ Re-agregar removerá estes dados. Re-agregar? </translation>
<source>Unable to clear music links</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to link music log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to link traffic log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Generate Log</source>
<translation type="unfinished"></translation>
@ -1066,6 +1058,18 @@ Re-agregar removerá estes dados. Re-agregar? </translation>
<source>No broken rules or validation exceptions found.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>RDLogManager Error Report</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Music schedule import failed!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Traffic schedule import failed!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImportListView</name>

@ -40,6 +40,16 @@ bool MainObject::RevertSchema(int cur_schema,int set_schema,QString *err_msg)
// NEW SCHEMA REVERSIONS GO HERE...
//
// Revert 341
//
if((cur_schema==341)&&(set_schema<cur_schema)) {
DropColumn("IMPORTER_LINES","FILE_LINE");
DropColumn("IMPORTER_LINES","LINK_START_TIME");
DropColumn("IMPORTER_LINES","LINK_LENGTH");
WriteSchemaVersion(--cur_schema);
}
//
// Revert 340
//
@ -85,6 +95,7 @@ bool MainObject::RevertSchema(int cur_schema,int set_schema,QString *err_msg)
return false;
}
DropColumn("IMPORTER_LINES","TYPE");
WriteSchemaVersion(--cur_schema);
}

@ -161,7 +161,7 @@ void MainObject::InitializeSchemaMap() {
global_version_map["3.2"]=311;
global_version_map["3.3"]=314;
global_version_map["3.4"]=317;
global_version_map["3.5"]=340;
global_version_map["3.5"]=341;
}

@ -10339,6 +10339,30 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg)
WriteSchemaVersion(++cur_schema);
}
if((cur_schema<341)&&(set_schema>cur_schema)) {
sql=QString("delete from IMPORTER_LINES"); // Purge stale lines first
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
sql=QString("alter table IMPORTER_LINES ")+
"add column FILE_LINE int unsigned not null after PROCESS_ID";
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
sql=QString("alter table IMPORTER_LINES ")+
"add column LINK_START_TIME time after EXT_CART_NAME";
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
sql=QString("alter table IMPORTER_LINES ")+
"add column LINK_LENGTH int after LINK_START_TIME";
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
WriteSchemaVersion(++cur_schema);
}
// NEW SCHEMA UPDATES GO HERE...