mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-10 16:43:35 +02:00
2018-02-03 Fred Gleason <fredg@paravelsystems.com>
* Converted sas_filter(1) to use RDApplication.
This commit is contained in:
@@ -16655,3 +16655,5 @@
|
|||||||
* Converted rdxport.cgi to use RDApplication.
|
* Converted rdxport.cgi to use RDApplication.
|
||||||
2018-02-03 Fred Gleason <fredg@paravelsystems.com>
|
2018-02-03 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Converted nexgen_filter(1) to use RDApplication.
|
* Converted nexgen_filter(1) to use RDApplication.
|
||||||
|
2018-02-03 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Converted sas_filter(1) to use RDApplication.
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// An RDCatch event import filter for the SAS64000
|
// An RDCatch event import filter for the SAS64000
|
||||||
//
|
//
|
||||||
// (C) Copyright 2002-2004 Fred Gleason <fredg@paravelsystems.com>
|
// (C) Copyright 2002-2004,2018 Fred Gleason <fredg@paravelsystems.com>
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// 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
|
// it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -27,76 +27,38 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <qapplication.h>
|
#include <qapplication.h>
|
||||||
#include <rddb.h>
|
|
||||||
#include <rd.h>
|
#include <rd.h>
|
||||||
#include <rdcmd_switch.h>
|
#include <rdapplication.h>
|
||||||
#include <dbversion.h>
|
#include <rddb.h>
|
||||||
|
|
||||||
#include <sas_filter.h>
|
|
||||||
|
|
||||||
//
|
|
||||||
// Global Variables
|
|
||||||
//
|
|
||||||
|
|
||||||
|
#include "sas_filter.h"
|
||||||
|
|
||||||
MainObject::MainObject(QObject *parent)
|
MainObject::MainObject(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
bool skip_db_check=false;
|
QString err_msg;
|
||||||
unsigned schema=0;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Read Command Options
|
// Open the Database
|
||||||
//
|
//
|
||||||
RDCmdSwitch *cmd=
|
rda=new RDApplication("sas_filter","sas_filter",SAS_FILTER_USAGE,this);
|
||||||
new RDCmdSwitch(qApp->argc(),qApp->argv(),"sas_filter",SAS_FILTER_USAGE);
|
if(!rda->open(&err_msg)) {
|
||||||
for(unsigned i=0;i<cmd->keys();i++) {
|
fprintf(stderr,"sas_filter: %s\n",(const char *)err_msg);
|
||||||
if(cmd->key(i)=="--skip-db-check") {
|
|
||||||
skip_db_check=true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delete cmd;
|
|
||||||
|
|
||||||
rd_config=new RDConfig(RD_CONF_FILE);
|
|
||||||
rd_config->load();
|
|
||||||
rd_config->setModuleName("sas_filter");
|
|
||||||
|
|
||||||
filter_switch_count=0;
|
|
||||||
filter_macro_count=0;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Open Database
|
|
||||||
//
|
|
||||||
QString err(tr("sas_filter: "));
|
|
||||||
filter_db=RDInitDb(&schema,&err);
|
|
||||||
if(!filter_db) {
|
|
||||||
fprintf(stderr,"%s\n",err.ascii());
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if((schema!=RD_VERSION_DATABASE)&&(!skip_db_check)) {
|
|
||||||
fprintf(stderr,
|
|
||||||
"sas_filter: database version mismatch, should be %u, is %u\n",
|
|
||||||
RD_VERSION_DATABASE,schema);
|
|
||||||
exit(256);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Station Configuration
|
|
||||||
//
|
|
||||||
filter_rdstation=new RDStation(rd_config->stationName());
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// RIPCD Connection
|
// RIPCD Connection
|
||||||
//
|
//
|
||||||
filter_ripc=new RDRipc(filter_rdstation,rd_config,this);
|
rda->ripc()->connectHost("localhost",RIPCD_TCP_PORT,rda->config()->password());
|
||||||
filter_ripc->connectHost("localhost",RIPCD_TCP_PORT,rd_config->password());
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// RDCatchd Connection
|
// RDCatchd Connection
|
||||||
//
|
//
|
||||||
filter_connect=new RDCatchConnect(0,this);
|
filter_connect=new RDCatchConnect(0,this);
|
||||||
filter_connect->connectHost("localhost",RDCATCHD_TCP_PORT,
|
filter_connect->connectHost("localhost",RDCATCHD_TCP_PORT,
|
||||||
rd_config->password());
|
rda->config()->password());
|
||||||
|
|
||||||
//
|
//
|
||||||
// Read Switches
|
// Read Switches
|
||||||
@@ -164,8 +126,8 @@ void MainObject::InjectLine(char *line)
|
|||||||
//
|
//
|
||||||
QString base_sql=QString().sprintf("insert into RECORDINGS set\
|
QString base_sql=QString().sprintf("insert into RECORDINGS set\
|
||||||
STATION_NAME=\"%s\",CHANNEL=%d,",
|
STATION_NAME=\"%s\",CHANNEL=%d,",
|
||||||
(const char *)rd_config->sasStation(),
|
(const char *)rda->config()->sasStation(),
|
||||||
rd_config->sasMatrix());
|
rda->config()->sasMatrix());
|
||||||
|
|
||||||
//
|
//
|
||||||
// Day of the week fields
|
// Day of the week fields
|
||||||
@@ -266,7 +228,7 @@ void MainObject::InjectCartEvent(QString sql,int gpo)
|
|||||||
//
|
//
|
||||||
// Macro Cart
|
// Macro Cart
|
||||||
//
|
//
|
||||||
sql+=QString().sprintf("MACRO_CART=%d",gpo+rd_config->sasBaseCart());
|
sql+=QString().sprintf("MACRO_CART=%d",gpo+rda->config()->sasBaseCart());
|
||||||
filter_macro_count++;
|
filter_macro_count++;
|
||||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||||
delete q;
|
delete q;
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// An RDCatch event import filter for the SAS64000
|
// An RDCatch event import filter for the SAS64000
|
||||||
//
|
//
|
||||||
// (C) Copyright 2002-2004 Fred Gleason <fredg@paravelsystems.com>
|
// (C) Copyright 2002-2004,2018 Fred Gleason <fredg@paravelsystems.com>
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// 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
|
// it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -22,14 +22,8 @@
|
|||||||
#define SAS_FILTER_H
|
#define SAS_FILTER_H
|
||||||
|
|
||||||
#include <qobject.h>
|
#include <qobject.h>
|
||||||
#include <qapplication.h>
|
|
||||||
#include <qsqldatabase.h>
|
|
||||||
|
|
||||||
#include <rdstation.h>
|
|
||||||
#include <rdripc.h>
|
|
||||||
#include <rdcatch_connect.h>
|
#include <rdcatch_connect.h>
|
||||||
#include <rdstation.h>
|
|
||||||
#include <rdconfig.h>
|
|
||||||
|
|
||||||
#define SAS_FILTER_USAGE "-d|-i <insert-list>\n"
|
#define SAS_FILTER_USAGE "-d|-i <insert-list>\n"
|
||||||
|
|
||||||
@@ -45,13 +39,9 @@ class MainObject : public QObject
|
|||||||
void InjectLine(char *line);
|
void InjectLine(char *line);
|
||||||
void InjectSwitchEvent(QString sql,int input,int output);
|
void InjectSwitchEvent(QString sql,int input,int output);
|
||||||
void InjectCartEvent(QString sql,int gpo);
|
void InjectCartEvent(QString sql,int gpo);
|
||||||
RDStation *filter_rdstation;
|
|
||||||
RDRipc *filter_ripc;
|
|
||||||
RDCatchConnect *filter_connect;
|
RDCatchConnect *filter_connect;
|
||||||
QSqlDatabase *filter_db;
|
|
||||||
int filter_switch_count;
|
int filter_switch_count;
|
||||||
int filter_macro_count;
|
int filter_macro_count;
|
||||||
RDConfig *rd_config;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user