1
0
mirror of https://github.com/ElvishArtisan/rivendell.git synced 2025-04-14 16:49:17 +02:00

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

* Added an 'IMPORTER_LINES.TYPE' field to the database.
	* Removed the 'not null' attribute from the
	'IMPORTER_LINES.START_HOUR' field in the database.
	* Removed the 'not null' attribute from the
	'IMPORTER_LINES.START_SECS' field in the database.
	* Removed the 'IMPORTER_LINES.LINK_LENGTH' field from the database.
	* Removed the 'IMPORTER_LINES.INSERT_TRACK' field from the database.
	* Removed the 'IMPORTER_LINES.INSERT_FIRST' field from the database.
	* Removed the 'IMPORTER_LINES.TRACK_STRING' field from the database.
	* Removed the 'IMPORTER_LINES.LINK_START_TIME' field from the database.
	* Removed the 'IMPORTER_LINES.LINK_LENGTH' field from the database.
	* Incremented the database version to 340.
	* Added type icons to the 'Imported Events' list in the 'Test Import'
	dialog in rdadmin(1).

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2020-10-07 19:05:32 -04:00
parent 2e60ea8f0b
commit 050ef6b500
16 changed files with 215 additions and 215 deletions

@ -20408,3 +20408,18 @@
'RDSvc::setSubEventInheritance()' methods.
* Added an 'Inline Traffic Inheritance' control to the 'Edit Service'
dialog in rdadmin(1).
2020-10-07 Fred Gleason <fredg@paravelsystems.com>
* Added an 'IMPORTER_LINES.TYPE' field to the database.
* Removed the 'not null' attribute from the
'IMPORTER_LINES.START_HOUR' field in the database.
* Removed the 'not null' attribute from the
'IMPORTER_LINES.START_SECS' field in the database.
* Removed the 'IMPORTER_LINES.LINK_LENGTH' field from the database.
* Removed the 'IMPORTER_LINES.INSERT_TRACK' field from the database.
* Removed the 'IMPORTER_LINES.INSERT_FIRST' field from the database.
* Removed the 'IMPORTER_LINES.TRACK_STRING' field from the database.
* Removed the 'IMPORTER_LINES.LINK_START_TIME' field from the database.
* Removed the 'IMPORTER_LINES.LINK_LENGTH' field from the database.
* Incremented the database version to 340.
* Added type icons to the 'Imported Events' list in the 'Test Import'
dialog in rdadmin(1).

@ -9,19 +9,14 @@ ID int(10) unsigned Primary key, auto increment
STATION_NAME varchar(64) From STATIONS.NAME
PROCESS_ID int unsigned
LINE_ID int(10) unsigned
TYPE int(10) unsigned RDLogLine::Type
START_HOUR int (11) signed
START_SECS int(11) signed
CART_NUMBER int (10) unsigned
TITLE varchar(191)
LENGTH int (11) signed
INSERT_BREAK enum('N','Y')
INSERT_TRACK enum('N','Y')
INSERT_FIRST int (10) unsigned
TRACK_STRING varchar(191)
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) signed
EVENT_USED enum('N','Y')

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

@ -564,27 +564,19 @@ bool RDSvc::import(ImportSource src,const QDate &date,const QString &break_str,
// Parse and Save
//
int line_id=0;
bool insert_found=false;
bool cart_ok=false;
bool start_time_ok=false;
bool line_used=false;
bool insert_break=false;
bool insert_track=false;
bool break_first=false;
bool track_first=false;
QString track_label;
QTime link_time;
int link_length=-1;
while(fgets(buf,RD_MAX_IMPORT_LINE_LENGTH,infile)!=NULL) {
line_used=false;
str_buf=QString(buf);
str_buf=QString::fromUtf8(buf);
//
// Cart Number
//
cartnum=0;
cartname=str_buf.mid(cart_offset,cart_length).stripWhiteSpace();
cartname=str_buf.mid(cart_offset,cart_length).trimmed();
//
// Start Time
@ -622,120 +614,67 @@ bool RDSvc::import(ImportSource src,const QDate &date,const QString &break_str,
//
// Title
//
title=str_buf.mid(title_offset,title_length).stripWhiteSpace();
title=str_buf.mid(title_offset,title_length).trimmed();
//
// Process Line
//
cartnum=cartname.toUInt(&cart_ok);
if(start_time_ok&&(cart_ok||
((!label_cart.isEmpty())&&(cartname==label_cart))||
((!track_cart.isEmpty())&&(cartname==track_cart)))) {
sql=QString("insert into IMPORTER_LINES set ")+
"STATION_NAME=\""+RDEscapeString(svc_station->name())+"\","+
QString().sprintf("PROCESS_ID=%d,",getpid())+
QString().sprintf("LINE_ID=%d,",line_id++)+
QString().sprintf("START_HOUR=%d,",start_hour)+
//
// Common SQL Elements
//
sql=QString("insert into IMPORTER_LINES set ")+
"STATION_NAME=\""+RDEscapeString(svc_station->name())+"\","+
QString().sprintf("PROCESS_ID=%d,",getpid())+
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)+
60*start_minutes+start_seconds);
}
if(cartlen>0) {
sql+=QString().sprintf("LENGTH=%d,",cartlen);
}
//
// Cart
//
if(start_time_ok&&cart_ok&&(cartnum>0)&&(cartnum<=RD_MAX_CART_NUMBER)) {
sql+=QString().sprintf("TYPE=%u,",RDLogLine::Cart)+
"EXT_DATA=\""+data_buf.trimmed()+"\","+
"EXT_EVENT_ID=\""+eventid_buf.trimmed()+"\","+
"EXT_ANNC_TYPE=\""+annctype_buf.trimmed()+"\","+
"EXT_CART_NAME=\""+cartname.trimmed()+"\","+
QString().sprintf("CART_NUMBER=%u,",cartnum)+
"TITLE=\""+RDEscapeString(title)+"\","+
QString().sprintf("LENGTH=%d,",cartlen)+
"EXT_DATA=\""+data_buf+"\","+
"EXT_EVENT_ID=\""+eventid_buf+"\","+
"EXT_ANNC_TYPE=\""+annctype_buf+"\","+
"EXT_CART_NAME=\""+cartname+"\"";
q=new RDSqlQuery(sql);
delete q;
//
// Insert Break
//
if(insert_break) {
sql=QString("update IMPORTER_LINES set ")+
"INSERT_BREAK=\"Y\"";
if(break_first) {
sql+=QString().sprintf(",INSERT_FIRST=%d",
RDEventLine::InsertBreak);
}
if(link_time.isValid()&&(link_length>=0)) {
sql+=",LINK_START_TIME=\""+
link_time.toString("hh:mm:ss")+"\""+
QString().sprintf(",LINK_LENGTH=%d",
link_length);
}
sql+=QString(" where ")+
"STATION_NAME=\""+RDEscapeString(svc_station->name())+"\" && "+
QString().sprintf("PROCESS_ID=%u && ",getpid())+
QString().sprintf("LINE_ID=%d",line_id-1);
q=new RDSqlQuery(sql);
delete q;
}
//
// Insert Track
//
if(insert_track) {
if(track_first) {
sql=QString("update IMPORTER_LINES set ")+
"INSERT_TRACK=\"Y\","+
"TRACK_STRING=\""+RDEscapeString(track_label)+"\","+
QString().sprintf("INSERT_FIRST=%d ",RDEventLine::InsertTrack)+
QString("where ")+
"STATION_NAME=\""+RDEscapeString(svc_station->name())+"\" && "+
QString().sprintf("PROCESS_ID=%u && ",getpid())+
QString().sprintf("LINE_ID=%d",line_id-1);
}
else {
sql=QString("update IMPORTER_LINES set ")+
"INSERT_TRACK=\"Y\","+
"TRACK_STRING=\""+RDEscapeString(track_label)+"\" "+
QString("where ")+
"STATION_NAME=\""+RDEscapeString(svc_station->name())+"\" && "+
QString().sprintf("PROCESS_ID=%u && ",getpid())+
QString().sprintf("LINE_ID=%d",line_id-1);
}
q=new RDSqlQuery(sql);
delete q;
}
insert_break=false;
break_first=false;
insert_track=false;
track_first=false;
insert_found=false;
line_used=true;
"TITLE=\""+RDEscapeString(title)+"\"";
RDSqlQuery::apply(sql);
line_id++;
continue;
}
if((cartname==break_str)&&start_time_ok) {
link_time=
QTime(start_hour,start_minutes,start_seconds);
link_length=cartlen;
}
else {
link_time=QTime();
link_length=-1;
}
if(!line_used) {
//
// Look for Break and Track Strings
//
if(!break_str.isEmpty()) {
if(str_buf.contains(break_str)) {
insert_break=true;
if(!insert_found) {
break_first=true;
insert_found=true;
}
}
}
if(!track_str.isEmpty()) {
if(str_buf.contains(track_str)) {
insert_track=true;
track_label=str_buf;
if(!insert_found) {
track_first=true;
insert_found=true;
}
}
//
// Inline Break
//
if((src==RDSvc::Music)&&(!break_str.isEmpty())) {
if(str_buf.contains(break_str)) {
sql+=QString().sprintf("TYPE=%u",RDLogLine::TrafficLink);
RDSqlQuery::apply(sql);
line_id++;
continue;
}
}
//
// Track Marker
//
if((!track_str.isEmpty())&&(str_buf.contains(track_str))) {
sql+=QString().sprintf("TYPE=%u,",RDLogLine::Track)+
"TITLE=\""+RDEscapeString(str_buf.simplified().trimmed())+"\"";
RDSqlQuery::apply(sql);
line_id++;
continue;
}
}
//

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

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

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

@ -5115,20 +5115,16 @@ please check your settings and try again.</source>
<source>Imported Events</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[spot break]</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Annc Type</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[voice track]</source>
<source>[spot break]</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[approximate spot break]</source>
<source>[voice track]</source>
<translation type="unfinished"></translation>
</message>
</context>

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

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

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

@ -35,6 +35,10 @@
#include "globals.h"
#include "test_import.h"
#include "../icons/play.xpm"
#include "../icons/mic16.xpm"
#include "../icons/traffic.xpm"
TestImport::TestImport(RDSvc *svc,RDSvc::ImportSource src,QWidget *parent)
: RDDialog(parent)
{
@ -61,6 +65,13 @@ TestImport::TestImport(RDSvc *svc,RDSvc::ImportSource src,QWidget *parent)
break;
}
//
// Create Icons
//
test_playout_map=new QPixmap(play_xpm);
test_mic16_map=new QPixmap(mic16_xpm);
test_traffic_map=new QPixmap(traffic_xpm);
//
// Date Selector
//
@ -107,20 +118,22 @@ TestImport::TestImport(RDSvc *svc,RDSvc::ImportSource src,QWidget *parent)
test_events_list->setSortColumn(0);
test_events_list->setSortOrder(Qt::Ascending);
test_events_list->setAllColumnsShowFocus(true);
test_events_list->addColumn(tr("Start Time"));
test_events_list->addColumn("");
test_events_list->setColumnAlignment(0,Qt::AlignCenter);
test_events_list->addColumn(tr("Cart"));
test_events_list->addColumn(tr("Start Time"));
test_events_list->setColumnAlignment(1,Qt::AlignCenter);
test_events_list->addColumn(tr("Cart"));
test_events_list->setColumnAlignment(2,Qt::AlignCenter);
test_events_list->addColumn(tr("Len"));
test_events_list->setColumnAlignment(2,Qt::AlignRight);
test_events_list->setColumnAlignment(3,Qt::AlignRight);
test_events_list->addColumn(tr("Title"));
test_events_list->setColumnAlignment(3,Qt::AlignLeft);
test_events_list->setColumnAlignment(4,Qt::AlignLeft);
test_events_list->addColumn(tr("GUID"));
test_events_list->setColumnAlignment(4,Qt::AlignCenter);
test_events_list->addColumn(tr("Event ID"));
test_events_list->setColumnAlignment(5,Qt::AlignCenter);
test_events_list->addColumn(tr("Annc Type"));
test_events_list->addColumn(tr("Event ID"));
test_events_list->setColumnAlignment(6,Qt::AlignCenter);
test_events_list->addColumn(tr("Annc Type"));
test_events_list->setColumnAlignment(7,Qt::AlignCenter);
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);
@ -190,76 +203,59 @@ void TestImport::importData()
"EXT_DATA,"+ // 04
"EXT_EVENT_ID,"+ // 05
"EXT_ANNC_TYPE,"+ // 06
"INSERT_BREAK,"+ // 07
"INSERT_TRACK,"+ // 08
"INSERT_FIRST,"+ // 09
"TITLE,"+ // 10
"LINK_START_TIME," // 11
"LINK_LENGTH "+ // 12
"TITLE,"+ // 07
"TYPE "+ // 08
"from IMPORTER_LINES where "+
"STATION_NAME=\""+RDEscapeString(rda->station()->name())+"\" && "+
QString().sprintf("PROCESS_ID=%u ",getpid())+
"order by START_HOUR,START_SECS";
"order by LINE_ID";
RDSqlQuery *q=new RDSqlQuery(sql);
while(q->next()) {
if(q->value(9).toUInt()==RDEventLine::InsertBreak) {
if(q->value(7).toString()=="Y") {
item=new RDListViewItem(test_events_list);
item->setLine(next_line++);
item->setText(3,tr("[spot break]"));
if(!q->value(11).isNull()) {
item->setText(3,tr("[spot break]"));
item->setText(0,q->value(11).toTime().toString("hh:mm:ss"));
item->setText(2,RDGetTimeLength(q->value(12).toInt(),false,false));
}
else {
item->setText(3,tr("[approximate spot break]"));
}
}
if(q->value(8).toString()=="Y") {
item=new RDListViewItem(test_events_list);
item->setLine(next_line++);
item->setText(3,tr("[voice track]"));
}
}
else {
if(q->value(8).toString()=="Y") {
item=new RDListViewItem(test_events_list);
item->setLine(next_line++);
item->setText(3,tr("[voice track]"));
}
if(q->value(7).toString()=="Y") {
item=new RDListViewItem(test_events_list);
item->setLine(next_line++);
if(!q->value(11).isNull()) {
item->setText(3,tr("[spot break]"));
item->setText(0,q->value(11).toTime().toString("hh:mm:ss"));
item->setText(2,RDGetTimeLength(q->value(12).toInt(),false,false));
}
else {
item->setText(3,tr("[approximate spot break]"));
}
}
}
item=new RDListViewItem(test_events_list);
item->setLine(next_line++);
item->setText(0,RDSvc::timeString(q->value(0).toInt(),
q->value(1).toInt()));
item->setText(1,q->value(2).toString());
if(q->value(3).toInt()>=0) {
item->setText(2,RDGetTimeLength(q->value(3).toInt(),false,false));
if((!q->value(0).isNull())&&(!q->value(1).isNull())) {
item->setText(1,RDSvc::timeString(q->value(0).toInt(),
q->value(1).toInt()));
}
if(!q->value(3).isNull()) {
item->setText(3,RDGetTimeLength(q->value(3).toInt(),false,false));
}
item->setText(5,q->value(4).toString().trimmed());
item->setText(6,q->value(5).toString().trimmed());
item->setText(7,q->value(6).toString().trimmed());
switch((RDLogLine::Type)q->value(8).toUInt()) {
case RDLogLine::Cart:
item->setPixmap(0,*test_playout_map);
item->setText(2,q->value(2).toString());
item->setText(4,q->value(7).toString().trimmed());
break;
case RDLogLine::TrafficLink:
item->setPixmap(0,*test_traffic_map);
item->setText(4,tr("[spot break]"));
break;
case RDLogLine::Track:
item->setPixmap(0,*test_mic16_map);
item->setText(4,tr("[voice track]"));
break;
case RDLogLine::Macro:
case RDLogLine::OpenBracket:
case RDLogLine::CloseBracket:
case RDLogLine::Chain:
case RDLogLine::MusicLink:
case RDLogLine::Marker:
case RDLogLine::UnknownType:
break;
}
item->setText(3,q->value(10).toString().trimmed());
item->setText(4,q->value(4).toString().trimmed());
item->setText(5,q->value(5).toString().trimmed());
item->setText(6,q->value(6).toString().trimmed());
}
delete q;
sql=QString("delete from IMPORTER_LINES where ")+
"STATION_NAME=\""+RDEscapeString(rda->station()->name())+"\" && "+
QString().sprintf("PROCESS_ID=%u",getpid());
// printf("IMPORTER_LINES cleanup SQL: %s\n",(const char *)sql);
//printf("IMPORTER_LINES cleanup SQL: %s\n",(const char *)sql);
RDSqlQuery::apply(sql);
}

@ -25,6 +25,7 @@
#include <q3datetimeedit.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpixmap.h>
#include <rddialog.h>
#include <rdlistview.h>
@ -60,6 +61,9 @@ class TestImport : public RDDialog
QLabel *test_filename_label;
QLineEdit *test_filename_edit;
QPushButton *test_close_button;
QPixmap *test_playout_map;
QPixmap *test_mic16_map;
QPixmap *test_traffic_map;
};

@ -40,6 +40,54 @@ bool MainObject::RevertSchema(int cur_schema,int set_schema,QString *err_msg)
// NEW SCHEMA REVERSIONS GO HERE...
//
// Revert 340
//
if((cur_schema==340)&&(set_schema<cur_schema)) {
sql=QString("alter table IMPORTER_LINES ")+
"add column INSERT_BREAK enum('N','Y') default 'N' after LENGTH";
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
sql=QString("alter table IMPORTER_LINES ")+
"add column INSERT_TRACK enum('N','Y') default 'N' after INSERT_BREAK";
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
sql=QString("alter table IMPORTER_LINES ")+
"add column INSERT_FIRST int unsigned default 0 after INSERT_TRACK";
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
sql=QString("alter table IMPORTER_LINES ")+
"add column TRACK_STRING varchar(191) after INSERT_FIRST";
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;
}
sql=QString("alter table IMPORTER_LINES ")+
"modify column START_HOUR int not null";
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
sql=QString("alter table IMPORTER_LINES ")+
"modify column START_SECS int not null";
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
DropColumn("IMPORTER_LINES","TYPE");
WriteSchemaVersion(--cur_schema);
}
//
// Revert 339
//

@ -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"]=339;
global_version_map["3.5"]=340;
}

@ -10308,6 +10308,37 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg)
WriteSchemaVersion(++cur_schema);
}
if((cur_schema<340)&&(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 TYPE int unsigned not null "+
"after LINE_ID";
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
sql=QString("alter table IMPORTER_LINES ")+
"modify column START_HOUR int";
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
sql=QString("alter table IMPORTER_LINES ")+
"modify column START_SECS int";
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
DropColumn("IMPORTER_LINES","INSERT_BREAK");
DropColumn("IMPORTER_LINES","INSERT_TRACK");
DropColumn("IMPORTER_LINES","INSERT_FIRST");
DropColumn("IMPORTER_LINES","LINK_START_TIME");
DropColumn("IMPORTER_LINES","LINK_LENGTH");
DropColumn("IMPORTER_LINES","TRACK_STRING");
WriteSchemaVersion(++cur_schema);
}
// NEW SCHEMA UPDATES GO HERE...