mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-20 15:02:27 +02:00
2022-11-01 Fred Gleason <fredg@paravelsystems.com>
* Refactored rdcatchd(1) to eliminate the need for the 'Set Exit Code' catch command. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
8e7df3585d
commit
47b6105b4b
@ -23599,3 +23599,6 @@
|
||||
2022-11-01 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Refactored rdcatch(1) to use the notification mechanism instead of
|
||||
the 'Input Monitor State' catch command.
|
||||
2022-11-01 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Refactored rdcatchd(1) to eliminate the need for the 'Set Exit Code'
|
||||
catch command.
|
||||
|
@ -131,45 +131,6 @@
|
||||
</variablelist>
|
||||
</sect2>
|
||||
|
||||
<sect2 xml:id="sect.privileged_commands.set_exit_code">
|
||||
<title>Set Exit Code</title>
|
||||
<para>
|
||||
Set the exit code of an event.
|
||||
</para>
|
||||
<para>
|
||||
<userinput>SC <replaceable>event-num</replaceable>
|
||||
<replaceable>code</replaceable>
|
||||
<replaceable>msg</replaceable>!</userinput>
|
||||
</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><replaceable>event-num</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The number of the event.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><replaceable>code</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The numeric code to set.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><replaceable>msg</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The text message to set.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</sect2>
|
||||
|
||||
|
||||
|
||||
</sect1>
|
||||
|
||||
|
@ -89,31 +89,6 @@ void RDCatchConnect::reloadDropboxes()
|
||||
SendCommand("RX!");
|
||||
}
|
||||
|
||||
/*
|
||||
void RDCatchConnect::monitor(int deck,bool state)
|
||||
{
|
||||
SendCommand(QString::asprintf("MN %d %d!",deck,state));
|
||||
}
|
||||
|
||||
|
||||
void RDCatchConnect::toggleMonitor(int deck)
|
||||
{
|
||||
if(cc_monitor_state[deck-1]) {
|
||||
SendCommand(QString::asprintf("MN %d 0!",deck));
|
||||
}
|
||||
else {
|
||||
SendCommand(QString::asprintf("MN %d 1!",deck));
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void RDCatchConnect::setExitCode(int id,RDRecording::ExitCode code,
|
||||
const QString &msg)
|
||||
{
|
||||
SendCommand(QString::asprintf("SC %d %d %s!",id,code,
|
||||
msg.trimmed().toUtf8().constData()));
|
||||
}
|
||||
|
||||
|
||||
void RDCatchConnect::connectedData()
|
||||
{
|
||||
|
@ -48,16 +48,10 @@ class RDCatchConnect : public QObject
|
||||
void enableMetering(bool state);
|
||||
void reloadDropboxes();
|
||||
|
||||
public slots:
|
||||
// void monitor(int deck,bool state);
|
||||
// void toggleMonitor(int deck);
|
||||
void setExitCode(int id,RDRecording::ExitCode code,const QString &msg);
|
||||
|
||||
signals:
|
||||
void connected(int serial,bool state);
|
||||
void statusChanged(int serial,unsigned channel,RDDeck::Status status,
|
||||
int id,const QString &cutname);
|
||||
// void monitorChanged(int serial,unsigned channel,bool state);
|
||||
void meterLevel(int serial,int deck,int chan,int level);
|
||||
void eventUpdated(int id);
|
||||
void eventPurged(int id);
|
||||
|
@ -186,7 +186,6 @@ bool RDCatchEvent::read(const QString &str)
|
||||
//
|
||||
// Operation-specific Fields
|
||||
//
|
||||
rda->syslog(LOG_NOTICE,"HERE0 op: %u",op);
|
||||
switch(op) {
|
||||
case RDCatchEvent::DeckEventProcessedOp:
|
||||
if(f0.size()!=5) {
|
||||
|
@ -181,6 +181,7 @@ void MainObject::RunImport(CatchEvent *evt)
|
||||
void MainObject::RunDownload(CatchEvent *evt)
|
||||
{
|
||||
RDDownload::ErrorCode conv_err;
|
||||
int event=GetEvent(evt->id());
|
||||
|
||||
//
|
||||
// Resolve Wildcards
|
||||
@ -220,8 +221,6 @@ void MainObject::RunDownload(CatchEvent *evt)
|
||||
break;
|
||||
|
||||
case RDDownload::ErrorInternal:
|
||||
catch_connect->setExitCode(evt->id(),RDRecording::InternalError,
|
||||
RDDownload::errorText(conv_err));
|
||||
qApp->processEvents();
|
||||
rda->syslog(LOG_WARNING,"download of %s returned an error: \"%s\", id=%d",
|
||||
(const char *)evt->tempName().toUtf8(),
|
||||
@ -232,7 +231,7 @@ void MainObject::RunDownload(CatchEvent *evt)
|
||||
exit(0);
|
||||
|
||||
default:
|
||||
catch_connect->setExitCode(evt->id(),RDRecording::ServerError,
|
||||
WriteExitCode(event,RDRecording::ServerError,
|
||||
RDDownload::errorText(conv_err));
|
||||
qApp->processEvents();
|
||||
rda->syslog(LOG_WARNING,"download of %s returned an error: \"%s\", id=%d",
|
||||
@ -249,13 +248,13 @@ void MainObject::RunDownload(CatchEvent *evt)
|
||||
// Execute Import
|
||||
//
|
||||
if(Import(evt)) {
|
||||
catch_connect->setExitCode(evt->id(),RDRecording::Ok,tr("OK"));
|
||||
WriteExitCode(event,RDRecording::Ok,tr("OK"));
|
||||
qApp->processEvents();
|
||||
}
|
||||
rda->syslog(LOG_INFO,"deleting file %s, id=%d",
|
||||
(const char *)evt->tempName().toUtf8(),evt->id());
|
||||
unlink(evt->tempName().toUtf8());
|
||||
catch_connect->setExitCode(evt->id(),RDRecording::Ok,"OK");
|
||||
WriteExitCode(event,RDRecording::Ok,"OK");
|
||||
}
|
||||
|
||||
|
||||
@ -283,8 +282,7 @@ void MainObject::RunUpload(CatchEvent *evt)
|
||||
rda->syslog(LOG_WARNING,"export of cut %s returned an error, id=%d",
|
||||
(const char *)evt->cutName().toUtf8(),
|
||||
evt->id());
|
||||
catch_connect->setExitCode(evt->id(),RDRecording::InternalError,
|
||||
tr("Export Error"));
|
||||
WriteExitCode(batch_event,RDRecording::InternalError,tr("Export Error"));
|
||||
qApp->processEvents();
|
||||
return;
|
||||
}
|
||||
@ -311,11 +309,15 @@ void MainObject::RunUpload(CatchEvent *evt)
|
||||
url_username=RD_ANON_FTP_USERNAME;
|
||||
url_password=QString(RD_ANON_FTP_PASSWORD)+"-"+VERSION;
|
||||
}
|
||||
switch((conv_err=conv->runUpload(url_username,url_password,id_filename,
|
||||
evt->useSshIdentity(),
|
||||
rda->config()->logXloadDebugData()))) {
|
||||
|
||||
|
||||
conv_err=conv->runUpload(url_username,url_password,id_filename,
|
||||
evt->useSshIdentity(),
|
||||
rda->config()->logXloadDebugData());
|
||||
rda->syslog(LOG_NOTICE,"CONV_ERR: %u",conv_err);
|
||||
switch(conv_err) {
|
||||
case RDUpload::ErrorOk:
|
||||
catch_connect->setExitCode(evt->id(),RDRecording::Ok,tr("Ok"));
|
||||
WriteExitCode(batch_event,RDRecording::Ok,tr("Ok"));
|
||||
qApp->processEvents();
|
||||
rda->syslog(LOG_INFO,"finished upload of %s to %s, id=%d",
|
||||
(const char *)evt->tempName().toUtf8(),
|
||||
@ -324,8 +326,8 @@ void MainObject::RunUpload(CatchEvent *evt)
|
||||
break;
|
||||
|
||||
case RDUpload::ErrorInternal:
|
||||
catch_connect->setExitCode(evt->id(),RDRecording::InternalError,
|
||||
RDUpload::errorText(conv_err));
|
||||
WriteExitCode(batch_event,RDRecording::InternalError,
|
||||
RDUpload::errorText(conv_err));
|
||||
qApp->processEvents();
|
||||
rda->syslog(LOG_WARNING,"upload of %s returned an error: \"%s\", id=%d",
|
||||
(const char *)evt->tempName().toUtf8(),
|
||||
@ -334,8 +336,8 @@ void MainObject::RunUpload(CatchEvent *evt)
|
||||
break;
|
||||
|
||||
default:
|
||||
catch_connect->setExitCode(evt->id(),RDRecording::ServerError,
|
||||
RDUpload::errorText(conv_err));
|
||||
WriteExitCode(batch_event,RDRecording::ServerError,
|
||||
RDUpload::errorText(conv_err));
|
||||
qApp->processEvents();
|
||||
rda->syslog(LOG_WARNING,"upload of %s returned an error: \"%s\", id=%d",
|
||||
(const char *)evt->tempName().toUtf8(),
|
||||
@ -374,8 +376,8 @@ void MainObject::RunUpload(CatchEvent *evt)
|
||||
feed->keyName().toUtf8().constData(),
|
||||
RDFeed::errorString(feed_err).toUtf8().constData(),
|
||||
evt->id());
|
||||
catch_connect->setExitCode(evt->id(),RDRecording::ServerError,
|
||||
RDFeed::errorString(feed_err));
|
||||
WriteExitCode(batch_event,RDRecording::ServerError,
|
||||
RDFeed::errorString(feed_err));
|
||||
delete feed;
|
||||
return;
|
||||
}
|
||||
@ -383,149 +385,13 @@ void MainObject::RunUpload(CatchEvent *evt)
|
||||
evt->tempName().toUtf8().constData(),
|
||||
cast_id,
|
||||
evt->id());
|
||||
catch_connect->setExitCode(evt->id(),RDRecording::Ok,tr("Ok"));
|
||||
WriteExitCode(batch_event,RDRecording::Ok,tr("Ok"));
|
||||
// catch_connect->setExitCode(evt->id(),RDRecording::Ok,tr("Ok"));
|
||||
delete feed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
void MainObject::RunUpload(CatchEvent *evt)
|
||||
{
|
||||
RDUpload::ErrorCode conv_err;
|
||||
|
||||
//
|
||||
// Resolve Wildcards
|
||||
//
|
||||
RDStation *station=new RDStation(rda->config()->stationName());
|
||||
evt->resolveUrl(station->timeOffset());
|
||||
delete station;
|
||||
|
||||
//
|
||||
// Execute Export
|
||||
//
|
||||
evt->setTempName(BuildTempName(evt,"upload"));
|
||||
evt->setDeleteTempFile(true);
|
||||
rda->syslog(LOG_INFO,"started export of cut %s to %s, id=%d",
|
||||
(const char *)evt->cutName().toUtf8(),
|
||||
(const char *)evt->tempName().toUtf8(),evt->id());
|
||||
if(!Export(evt)) {
|
||||
rda->syslog(LOG_WARNING,"export of cut %s returned an error, id=%d",
|
||||
(const char *)evt->cutName().toUtf8(),
|
||||
evt->id());
|
||||
catch_connect->setExitCode(evt->id(),RDRecording::InternalError,
|
||||
tr("Export Error"));
|
||||
qApp->processEvents();
|
||||
return;
|
||||
}
|
||||
rda->syslog(LOG_INFO,"finished export of cut %s to %s, id=%d",
|
||||
(const char *)evt->cutName().toUtf8(),
|
||||
(const char *)evt->tempName().toUtf8(),evt->id());
|
||||
|
||||
//
|
||||
// Execute Upload
|
||||
//
|
||||
rda->syslog(LOG_INFO,"starting upload of %s to %s, id=%d",
|
||||
(const char *)evt->tempName().toUtf8(),
|
||||
(const char *)evt->resolvedUrl().toUtf8(),
|
||||
evt->id());
|
||||
if(evt->feedId()<=0) { // Standard upload
|
||||
RDUpload *conv=new RDUpload(rda->config(),this);
|
||||
conv->setSourceFile(evt->tempName());
|
||||
conv->setDestinationUrl(evt->resolvedUrl());
|
||||
QString url_username=evt->urlUsername();
|
||||
QString url_password=evt->urlPassword();
|
||||
QString id_filename=rda->station()->sshIdentityFile();
|
||||
if(url_username.isEmpty()&&
|
||||
(QUrl(evt->resolvedUrl()).scheme().toLower()=="ftp")) {
|
||||
url_username=RD_ANON_FTP_USERNAME;
|
||||
url_password=QString(RD_ANON_FTP_PASSWORD)+"-"+VERSION;
|
||||
}
|
||||
switch((conv_err=conv->runUpload(url_username,url_password,id_filename,
|
||||
evt->useSshIdentity(),
|
||||
rda->config()->logXloadDebugData()))) {
|
||||
case RDUpload::ErrorOk:
|
||||
catch_connect->setExitCode(evt->id(),RDRecording::Ok,tr("Ok"));
|
||||
qApp->processEvents();
|
||||
rda->syslog(LOG_INFO,"finished upload of %s to %s, id=%d",
|
||||
(const char *)evt->tempName().toUtf8(),
|
||||
(const char *)evt->resolvedUrl().toUtf8(),
|
||||
evt->id());
|
||||
break;
|
||||
|
||||
case RDUpload::ErrorInternal:
|
||||
catch_connect->setExitCode(evt->id(),RDRecording::InternalError,
|
||||
RDUpload::errorText(conv_err));
|
||||
qApp->processEvents();
|
||||
rda->syslog(LOG_WARNING,"upload of %s returned an error: \"%s\", id=%d",
|
||||
(const char *)evt->tempName().toUtf8(),
|
||||
(const char *)RDUpload::errorText(conv_err).toUtf8(),
|
||||
evt->id());
|
||||
break;
|
||||
|
||||
default:
|
||||
catch_connect->setExitCode(evt->id(),RDRecording::ServerError,
|
||||
RDUpload::errorText(conv_err));
|
||||
qApp->processEvents();
|
||||
rda->syslog(LOG_WARNING,"upload of %s returned an error: \"%s\", id=%d",
|
||||
(const char *)evt->tempName().toUtf8(),
|
||||
(const char *)RDUpload::errorText(conv_err).toUtf8(),
|
||||
evt->id());
|
||||
break;
|
||||
}
|
||||
delete conv;
|
||||
|
||||
//
|
||||
// Clean Up
|
||||
//
|
||||
if(evt->deleteTempFile()) {
|
||||
unlink(evt->tempName().toUtf8());
|
||||
rda->
|
||||
syslog(LOG_INFO,"deleted file %s",evt->tempName().toUtf8().constData());
|
||||
}
|
||||
else {
|
||||
RDCheckExitCode("batch.cpp chown",chown(evt->tempName().toUtf8(),
|
||||
rda->config()->uid(),
|
||||
rda->config()->gid()));
|
||||
}
|
||||
}
|
||||
else { // Podcast upload
|
||||
unsigned cast_id;
|
||||
RDFeed::Error feed_err=RDFeed::ErrorOk;
|
||||
|
||||
RDFeed *feed=new RDFeed(evt->feedId(),rda->config(),this);
|
||||
rda->syslog(LOG_INFO,"starting post of %s to feed \"%s\", id=%d",
|
||||
evt->tempName().toUtf8().constData(),
|
||||
feed->keyName().toUtf8().constData(),
|
||||
evt->id());
|
||||
if((cast_id=feed->postFile(evt->tempName(),&feed_err))==0) {
|
||||
rda->syslog(LOG_WARNING,"post of %s to feed \"%s\" failed [%s], id=%d",
|
||||
evt->tempName().toUtf8().constData(),
|
||||
feed->keyName().toUtf8().constData(),
|
||||
RDFeed::errorString(feed_err).toUtf8().constData(),
|
||||
evt->id());
|
||||
catch_connect->setExitCode(evt->id(),RDRecording::ServerError,
|
||||
RDFeed::errorString(feed_err));
|
||||
delete feed;
|
||||
return;
|
||||
}
|
||||
rda->syslog(LOG_INFO,"post of %s to cast id %u successful, id=%d",
|
||||
evt->tempName().toUtf8().constData(),
|
||||
cast_id,
|
||||
evt->id());
|
||||
RDCart *cart=new RDCart(RDCut::cartNumber(evt->cutName()));
|
||||
RDPodcast *cast=new RDPodcast(rda->config(),cast_id);
|
||||
cast->setItemTitle(feed->channelTitle());
|
||||
// cast->setItemTitle(cart->title());
|
||||
catch_connect->setExitCode(evt->id(),RDRecording::Ok,tr("Ok"));
|
||||
delete cast;
|
||||
delete cart;
|
||||
delete feed;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
bool MainObject::Export(CatchEvent *evt)
|
||||
{
|
||||
bool ret=false;
|
||||
@ -590,7 +456,7 @@ bool MainObject::Import(CatchEvent *evt)
|
||||
if(!cut->exists()) {
|
||||
rda->syslog(LOG_WARNING,"cut not found: %s, id: %d",
|
||||
(const char *)evt->cutName().toUtf8(),evt->id());
|
||||
catch_connect->setExitCode(evt->id(),RDRecording::NoCut,tr("No such cut"));
|
||||
WriteExitCode(batch_event,RDRecording::NoCut,tr("No such cut"));
|
||||
qApp->processEvents();
|
||||
delete cut;
|
||||
return false;
|
||||
@ -599,8 +465,7 @@ bool MainObject::Import(CatchEvent *evt)
|
||||
if(!wave->openWave()) {
|
||||
rda->syslog(LOG_ERR,"unknown file format: %s, id: %d",
|
||||
(const char *)evt->cutName().toUtf8(),evt->id());
|
||||
catch_connect->setExitCode(evt->id(),RDRecording::UnknownFormat,
|
||||
tr("Unknown Format"));
|
||||
WriteExitCode(batch_event,RDRecording::UnknownFormat,tr("Unknown Format"));
|
||||
qApp->processEvents();
|
||||
delete wave;
|
||||
return false;
|
||||
@ -632,8 +497,8 @@ bool MainObject::Import(CatchEvent *evt)
|
||||
rda->syslog(LOG_WARNING,"import error: %s, id: %d",
|
||||
(const char *)RDAudioConvert::errorText(conv_err).toUtf8(),
|
||||
evt->id());
|
||||
catch_connect->setExitCode(evt->id(),RDRecording::UnknownFormat,
|
||||
RDAudioConvert::errorText(conv_err));
|
||||
WriteExitCode(batch_event,RDRecording::UnknownFormat,
|
||||
RDAudioConvert::errorText(conv_err));
|
||||
qApp->processEvents();
|
||||
ret=false;
|
||||
break;
|
||||
@ -642,8 +507,8 @@ bool MainObject::Import(CatchEvent *evt)
|
||||
rda->syslog(LOG_WARNING,"import error: %s, id: %d",
|
||||
(const char *)RDAudioConvert::errorText(conv_err).toUtf8(),
|
||||
evt->id());
|
||||
catch_connect->setExitCode(evt->id(),RDRecording::InternalError,
|
||||
RDAudioConvert::errorText(conv_err));
|
||||
WriteExitCode(batch_event,RDRecording::InternalError,
|
||||
RDAudioConvert::errorText(conv_err));
|
||||
qApp->processEvents();
|
||||
ret=false;
|
||||
break;
|
||||
|
@ -452,8 +452,8 @@ void MainObject::notificationReceivedData(RDNotification *notify)
|
||||
|
||||
void MainObject::catchEventReceivedData(RDCatchEvent *evt)
|
||||
{
|
||||
rda->syslog(LOG_NOTICE,"catchEventReceivedData(): %s",
|
||||
evt->dump().toUtf8().constData());
|
||||
// rda->syslog(LOG_NOTICE,"catchEventReceivedData(): %s",
|
||||
// evt->dump().toUtf8().constData());
|
||||
|
||||
RDCatchEvent *resp=NULL;
|
||||
|
||||
@ -526,40 +526,6 @@ void MainObject::catchEventReceivedData(RDCatchEvent *evt)
|
||||
case RDCatchEvent::LastOp:
|
||||
break;
|
||||
}
|
||||
/*
|
||||
chan=cmds.at(1).toInt(&ok);
|
||||
if(!ok) {
|
||||
EchoArgs(conn->id(),'-');
|
||||
return;
|
||||
}
|
||||
if(chan==0) {
|
||||
SendFullStatus(conn->id());
|
||||
return;
|
||||
}
|
||||
chan--;
|
||||
if(chan<MAX_DECKS) {
|
||||
if(catch_record_deck_status[chan]==RDDeck::Offline) {
|
||||
EchoArgs(conn->id(),'-');
|
||||
return;
|
||||
}
|
||||
EchoCommand(conn->id(),QString::asprintf("RE %u %d %d!",
|
||||
chan+1,
|
||||
catch_record_deck_status[chan],
|
||||
catch_record_id[chan]));
|
||||
EchoCommand(conn->id(),QString::asprintf("MN %u %d!",chan+1,
|
||||
catch_monitor_state[chan]));
|
||||
return;
|
||||
}
|
||||
if((chan>=128)&&(chan<(MAX_DECKS+128))) {
|
||||
if(catch_playout_deck_status[chan-128]==RDDeck::Offline) {
|
||||
EchoArgs(conn->id(),'-');
|
||||
return;
|
||||
}
|
||||
EchoCommand(conn->id(),
|
||||
QString::asprintf("RE %u %d %d!",
|
||||
chan+1,catch_playout_deck_status[chan-128],
|
||||
catch_playout_id[chan-128]));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -618,12 +584,6 @@ void MainObject::gpiStateChangedData(int matrix,int line,bool state)
|
||||
catch_events[i].gpiStartTimer()->stop();
|
||||
SendEventResponse(catch_events[i].channel(),RDDeck::Ready,
|
||||
catch_events[i].id(),"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE %d %d %d!",
|
||||
catch_events[i].channel(),
|
||||
RDDeck::Ready,
|
||||
catch_events[i].id()).toUtf8());
|
||||
*/
|
||||
}
|
||||
else {
|
||||
if(StartRecording(i)) {
|
||||
@ -668,15 +628,10 @@ void MainObject::startTimerData(int id)
|
||||
unsigned deck=catch_events[event].channel()-1;
|
||||
|
||||
catch_events[event].setStatus(RDDeck::Idle);
|
||||
WriteExitCodeById(id,RDRecording::Ok);
|
||||
WriteExitCode(event,RDRecording::Ok);
|
||||
catch_record_deck_status[deck]=RDDeck::Idle;
|
||||
catch_record_id[deck]=0;
|
||||
SendEventResponse(deck+1,catch_record_deck_status[deck],id,"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE %d %d %d!",
|
||||
deck+1,catch_record_deck_status[deck],
|
||||
id).toUtf8());
|
||||
*/
|
||||
rda->syslog(LOG_INFO,"gpi start window closes: event: %d, gpi: %d:%d",
|
||||
id,catch_events[event].startMatrix(),
|
||||
catch_events[event].startLine());
|
||||
@ -733,13 +688,6 @@ void MainObject::engineData(int id)
|
||||
WriteExitCode(event,RDRecording::DeviceBusy);
|
||||
SendEventResponse(0,RDDeck::Recording,catch_events[event].id(),
|
||||
catch_events[event].cutName());
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE 0 %d %d %s!",RDDeck::Recording,
|
||||
catch_events[event].id(),
|
||||
catch_events[event].cutName().
|
||||
toUtf8().constData()).toUtf8());
|
||||
*/
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -753,14 +701,6 @@ void MainObject::engineData(int id)
|
||||
SendEventResponse(catch_events[event].channel(),
|
||||
catch_record_deck_status[catch_events[event].channel()-1],
|
||||
catch_events[event].id(),"");
|
||||
/*
|
||||
BroadcastCommand(QString().
|
||||
sprintf("RE %d %d %d!",
|
||||
catch_events[event].channel(),
|
||||
catch_record_deck_status[catch_events[event].
|
||||
channel()-1],
|
||||
catch_events[event].id()).toUtf8());
|
||||
*/
|
||||
rda->syslog(LOG_WARNING,"record aborted: no such cut: %s, id: %d",
|
||||
catch_events[event].cutName().toUtf8().constData(),
|
||||
catch_events[event].id());
|
||||
@ -832,13 +772,6 @@ void MainObject::engineData(int id)
|
||||
SendEventResponse(catch_events[event].channel(),
|
||||
catch_record_deck_status[catch_events[event].channel()-1],
|
||||
catch_events[event].id(),"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE %d %d %d!",
|
||||
catch_events[event].channel(),
|
||||
catch_record_deck_status[catch_events[event].
|
||||
channel()-1],
|
||||
catch_events[event].id()).toUtf8());
|
||||
*/
|
||||
rda->syslog(LOG_INFO,"gpi start window opens: event: %d, gpi: %d:%d",
|
||||
id,catch_events[event].startMatrix(),
|
||||
catch_events[event].startLine());
|
||||
@ -852,14 +785,6 @@ void MainObject::engineData(int id)
|
||||
SendEventResponse(catch_events[event].channel(),
|
||||
catch_playout_deck_status[catch_events[event].channel()-129],
|
||||
catch_events[event].id(),"");
|
||||
/*
|
||||
BroadcastCommand(QString().
|
||||
sprintf("RE %d %d %d!",
|
||||
catch_events[event].channel(),
|
||||
catch_playout_deck_status[catch_events[event].
|
||||
channel()-129],
|
||||
catch_events[event].id()).toUtf8());
|
||||
*/
|
||||
rda->syslog(LOG_WARNING,"playout aborted: no such cut: %s, id: %d",
|
||||
(const char *)catch_events[event].cutName().toUtf8(),
|
||||
catch_events[event].id());
|
||||
@ -898,10 +823,6 @@ void MainObject::engineData(int id)
|
||||
if(!RDCart::exists(catch_events[event].macroCart())) {
|
||||
WriteExitCode(event,RDRecording::NoCut);
|
||||
SendEventResponse(0,RDDeck::Offline,catch_events[event].id(),"");
|
||||
/*
|
||||
BroadcastCommand(QString().
|
||||
sprintf("RE 0 0 %d!",catch_events[event].id()).toUtf8());
|
||||
*/
|
||||
rda->syslog(LOG_WARNING,"macro aborted: no such cart: %u, id: %d",
|
||||
catch_events[event].macroCart(),
|
||||
catch_events[event].id());
|
||||
@ -918,10 +839,6 @@ void MainObject::engineData(int id)
|
||||
if(!RDCut::exists(catch_events[event].cutName())) {
|
||||
WriteExitCode(event,RDRecording::NoCut);
|
||||
SendEventResponse(0,RDDeck::Offline,catch_events[event].id(),"");
|
||||
/*
|
||||
BroadcastCommand(QString().
|
||||
sprintf("RE 0 0 %d!",catch_events[event].id()).toUtf8());
|
||||
*/
|
||||
rda->syslog(LOG_WARNING,"download aborted: no such cut: %s, id: %d",
|
||||
(const char *)catch_events[event].cutName().toUtf8(),
|
||||
catch_events[event].id());
|
||||
@ -965,10 +882,6 @@ void MainObject::engineData(int id)
|
||||
if(!RDCut::exists(catch_events[event].cutName())) {
|
||||
WriteExitCode(event,RDRecording::NoCut);
|
||||
SendEventResponse(0,RDDeck::Offline,catch_events[event].id(),"");
|
||||
/*
|
||||
BroadcastCommand(QString().
|
||||
sprintf("RE 0 0 %d!",catch_events[event].id()).toUtf8());
|
||||
*/
|
||||
rda->syslog(LOG_WARNING,"upload aborted: no such cut: %s, id: %d",
|
||||
(const char *)catch_events[event].cutName().toUtf8(),
|
||||
catch_events[event].id());
|
||||
@ -1041,11 +954,6 @@ void MainObject::recordLoadedData(int card,int stream)
|
||||
catch_record_deck_status[deck-1]=RDDeck::Ready;
|
||||
SendEventResponse(deck,catch_record_deck_status[deck-1],
|
||||
catch_record_id[deck-1],"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE %d %d %d!",
|
||||
deck,catch_record_deck_status[deck-1],
|
||||
catch_record_id[deck-1]).toUtf8());
|
||||
*/
|
||||
rda->syslog(LOG_DEBUG,"Loaded - Card: %d Stream: %d\n",card,stream);
|
||||
}
|
||||
|
||||
@ -1054,20 +962,14 @@ void MainObject::recordingData(int card,int stream)
|
||||
{
|
||||
int deck=GetRecordDeck(card,stream);
|
||||
catch_record_deck_status[deck-1]=RDDeck::Recording;
|
||||
WriteExitCodeById(catch_record_id[deck-1],RDRecording::RecordActive);
|
||||
QString cutname;
|
||||
int event=GetEvent(catch_record_id[deck-1]);
|
||||
if(event>=0) {
|
||||
WriteExitCode(event,RDRecording::RecordActive);
|
||||
cutname=catch_events[event].cutName();
|
||||
}
|
||||
SendEventResponse(deck,catch_record_deck_status[deck-1],
|
||||
catch_record_id[deck-1],cutname);
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE %d %d %d %s!",
|
||||
deck,catch_record_deck_status[deck-1],
|
||||
catch_record_id[deck-1],
|
||||
cutname.toUtf8().constData()).toUtf8());
|
||||
*/
|
||||
catch_record_status[deck-1]=true;
|
||||
if(debug) {
|
||||
printf("Recording - Card: %d Stream: %d, Id: %d\n",card,stream,
|
||||
@ -1118,19 +1020,14 @@ void MainObject::recordUnloadedData(int card,int stream,unsigned msecs)
|
||||
if(catch_record_aborting[deck-1]) {
|
||||
rda->syslog(LOG_INFO,"record aborted: cut %s",
|
||||
(const char *)catch_record_name[deck-1].toUtf8());
|
||||
WriteExitCodeById(catch_record_id[deck-1],RDRecording::Interrupted);
|
||||
WriteExitCode(event,RDRecording::Interrupted);
|
||||
}
|
||||
else {
|
||||
rda->syslog(LOG_INFO,"record complete: cut %s",
|
||||
(const char *)catch_record_name[deck-1].toUtf8());
|
||||
WriteExitCodeById(catch_record_id[deck-1],RDRecording::Ok);
|
||||
WriteExitCode(event,RDRecording::Ok);
|
||||
}
|
||||
SendEventResponse(deck,RDDeck::Idle,catch_record_id[deck-1],"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE %d %d %d!",
|
||||
deck,RDDeck::Idle,
|
||||
catch_record_id[deck-1]).toUtf8());
|
||||
*/
|
||||
catch_record_id[deck-1]=0;
|
||||
if(debug) {
|
||||
printf("Unloaded - Card: %d Stream: %d\n",card,stream);
|
||||
@ -1167,11 +1064,6 @@ void MainObject::playLoadedData(int handle)
|
||||
catch_playout_deck_status[deck-129]=RDDeck::Ready;
|
||||
SendEventResponse(deck,catch_playout_deck_status[deck-129],
|
||||
catch_playout_id[deck-129],"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE %d %d %d!",
|
||||
deck,catch_playout_deck_status[deck-129],
|
||||
catch_playout_id[deck-129]).toUtf8());
|
||||
*/
|
||||
if(debug) {
|
||||
printf("Play Loaded - Card: %d Stream: %d\n",
|
||||
catch_playout_card[deck-129],
|
||||
@ -1183,16 +1075,11 @@ void MainObject::playLoadedData(int handle)
|
||||
void MainObject::playingData(int handle)
|
||||
{
|
||||
int deck=GetPlayoutDeck(handle);
|
||||
int event=GetEvent(catch_playout_id[deck-129]);
|
||||
catch_playout_deck_status[deck-129]=RDDeck::Recording;
|
||||
WriteExitCodeById(catch_playout_id[deck-129],
|
||||
RDRecording::PlayActive);
|
||||
WriteExitCode(event,RDRecording::PlayActive);
|
||||
SendEventResponse(deck,catch_playout_deck_status[deck-129],
|
||||
catch_playout_id[deck-129],"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE %d %d %d!",
|
||||
deck,catch_playout_deck_status[deck-129],
|
||||
catch_playout_id[deck-129]).toUtf8());
|
||||
*/
|
||||
catch_playout_status[GetPlayoutDeck(handle)]=true;
|
||||
if(debug) {
|
||||
printf("Playing - Card: %d Stream: %d\n",
|
||||
@ -1224,18 +1111,14 @@ void MainObject::playStoppedData(int handle)
|
||||
void MainObject::playUnloadedData(int handle)
|
||||
{
|
||||
int deck=GetPlayoutDeck(handle);
|
||||
int event=GetEvent(catch_playout_id[deck-129]);
|
||||
|
||||
rda->syslog(LOG_INFO,"play complete: cut %s",
|
||||
(const char *)catch_playout_name[deck-129].toUtf8());
|
||||
catch_playout_deck_status[deck-129]=RDDeck::Idle;
|
||||
WriteExitCodeById(catch_playout_id[deck-129],RDRecording::Ok);
|
||||
WriteExitCode(event,RDRecording::Ok);
|
||||
SendEventResponse(deck,catch_playout_deck_status[deck-129],
|
||||
catch_playout_id[deck-129],"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE %d %d %d!",deck,
|
||||
catch_playout_deck_status[deck-129],
|
||||
catch_playout_id[deck-129]).toUtf8());
|
||||
*/
|
||||
if(debug) {
|
||||
printf("Play unloaded - Card: %d Stream: %d\n",
|
||||
catch_playout_card[deck-129],catch_playout_stream[deck-129]);
|
||||
@ -1292,11 +1175,6 @@ void MainObject::eventFinishedData(int id)
|
||||
}
|
||||
catch_events[event].setStatus(RDDeck::Idle);
|
||||
SendEventResponse(0,RDDeck::Idle,catch_macro_event_id[id],"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE 0 %d %d!",
|
||||
RDDeck::Idle,
|
||||
catch_macro_event_id[id]).toUtf8());
|
||||
*/
|
||||
if(catch_events[event].oneShot()) {
|
||||
PurgeEvent(event);
|
||||
}
|
||||
@ -1329,12 +1207,6 @@ void MainObject::updateXloadsData()
|
||||
it=catch_active_xloads.begin()+i;
|
||||
SendEventResponse(0,RDDeck::Idle,
|
||||
catch_events[catch_active_xloads[i]].id(),"");
|
||||
/*
|
||||
BroadcastCommand(QString().
|
||||
sprintf("RE 0 %d %d!",RDDeck::Idle,
|
||||
catch_events[catch_active_xloads[i]].id()).
|
||||
toUtf8());
|
||||
*/
|
||||
catch_active_xloads.erase(it,it+1);
|
||||
break;
|
||||
|
||||
@ -1382,14 +1254,9 @@ bool MainObject::StartRecording(int event)
|
||||
unsigned deck=catch_events[event].channel();
|
||||
if((catch_record_card[deck-1]<0)||
|
||||
(catch_record_stream[deck-1]<0)) {
|
||||
WriteExitCodeById(catch_events[event].id(),RDRecording::InternalError);
|
||||
WriteExitCode(event,RDRecording::InternalError);
|
||||
SendEventResponse(deck,catch_record_deck_status[deck-1],
|
||||
catch_events[event].id(),"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE %d %d %d!",
|
||||
deck,catch_record_deck_status[deck-1],
|
||||
catch_events[event].id()).toUtf8());
|
||||
*/
|
||||
rda->syslog(LOG_WARNING,"invalid audio device for deck: %d, event: %d",
|
||||
deck,catch_events[event].id());
|
||||
return false;
|
||||
@ -1400,14 +1267,9 @@ bool MainObject::StartRecording(int event)
|
||||
//
|
||||
if((catch_record_deck_status[deck-1]!=RDDeck::Idle)&&
|
||||
(catch_record_deck_status[deck-1]!=RDDeck::Waiting)) {
|
||||
WriteExitCodeById(catch_events[event].id(),RDRecording::DeviceBusy);
|
||||
WriteExitCode(event,RDRecording::DeviceBusy);
|
||||
SendEventResponse(deck,catch_record_deck_status[deck-1],
|
||||
catch_events[event].id(),"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE %d %d %d!",
|
||||
deck,catch_record_deck_status[deck-1],
|
||||
catch_events[event].id()).toUtf8());
|
||||
*/
|
||||
rda->syslog(LOG_WARNING,
|
||||
"device busy for deck: %d, event: %d | in use by event: %d",
|
||||
deck,catch_events[event].id(),catch_record_id[deck-1]);
|
||||
@ -1663,11 +1525,6 @@ void MainObject::StartDownloadEvent(int event)
|
||||
catch_xload_timer->start(XLOAD_UPDATE_INTERVAL);
|
||||
}
|
||||
SendEventResponse(0,RDDeck::Recording,catch_events[event].id(),"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE 0 %d %d!",
|
||||
RDDeck::Recording,
|
||||
catch_events[event].id()).toUtf8());
|
||||
*/
|
||||
StartBatch(catch_events[event].id());
|
||||
}
|
||||
|
||||
@ -1679,8 +1536,7 @@ void MainObject::StartUploadEvent(int event)
|
||||
if(!catch_xload_timer->isActive()) {
|
||||
catch_xload_timer->start(XLOAD_UPDATE_INTERVAL);
|
||||
}
|
||||
BroadcastCommand(QString::asprintf("RE 0 %d %d!",RDDeck::Recording,
|
||||
catch_events[event].id()).toUtf8());
|
||||
SendEventResponse(0,RDDeck::Recording,catch_events[event].id(),"");
|
||||
StartBatch(catch_events[event].id());
|
||||
}
|
||||
|
||||
@ -1697,10 +1553,6 @@ bool MainObject::ExecuteMacroCart(RDCart *cart,int id,int event)
|
||||
}
|
||||
if(id!=-1) {
|
||||
SendEventResponse(0,RDDeck::Recording,id,"");
|
||||
/*
|
||||
BroadcastCommand(QString::asprintf("RE 0 %d %d!",RDDeck::Recording,id).
|
||||
toUtf8());
|
||||
*/
|
||||
}
|
||||
catch_macro_event_id[event_id]=id;
|
||||
catch_event_pool[event_id]=
|
||||
@ -1863,11 +1715,11 @@ void MainObject::ParseCommand(int ch)
|
||||
void MainObject::DispatchCommand(ServerConnection *conn)
|
||||
{
|
||||
// int chan;
|
||||
int id;
|
||||
int event;
|
||||
int code;
|
||||
// int id;
|
||||
// int event;
|
||||
// int code;
|
||||
QString str;
|
||||
bool ok=false;
|
||||
// bool ok=false;
|
||||
|
||||
QStringList cmds=conn->accum.split(" ");
|
||||
|
||||
@ -1915,7 +1767,7 @@ void MainObject::DispatchCommand(ServerConnection *conn)
|
||||
if((cmds.at(0)=="RM")&&(cmds.size()==2)) { // Enable/Disable Metering
|
||||
conn->setMeterEnabled(cmds.at(1).trimmed()!="0");
|
||||
}
|
||||
|
||||
/*
|
||||
if((cmds.at(0)=="SC")&&(cmds.size()>=4)) { // Set Exit Code
|
||||
id=cmds.at(1).toInt(&ok);
|
||||
if(!ok) {
|
||||
@ -1945,6 +1797,7 @@ void MainObject::DispatchCommand(ServerConnection *conn)
|
||||
// BroadcastCommand(QString::asprintf("RE 0 %d %d!",RDDeck::Offline,id));
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -2476,44 +2329,86 @@ RDRecording::ExitCode MainObject::ReadExitCode(int event)
|
||||
void MainObject::WriteExitCode(int event,RDRecording::ExitCode code,
|
||||
const QString &err_text)
|
||||
{
|
||||
RDDeck::Status status=RDDeck::Offline;
|
||||
QString sql=QString("update `RECORDINGS` set ")+
|
||||
QString::asprintf("`EXIT_CODE`=%d,",code)+
|
||||
"`EXIT_TEXT`='"+RDEscapeString(err_text)+"' where "+
|
||||
QString::asprintf("`ID`=%d",catch_events[event].id());
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
rda->syslog(LOG_NOTICE,"WriteExitCode SQL: %s",sql.toUtf8().constData());
|
||||
RDSqlQuery::apply(sql);
|
||||
switch(code) {
|
||||
case RDRecording::Ok:
|
||||
status=RDDeck::Idle;
|
||||
break;
|
||||
|
||||
case RDRecording::Downloading:
|
||||
case RDRecording::Uploading:
|
||||
case RDRecording::RecordActive:
|
||||
case RDRecording::PlayActive:
|
||||
status=RDDeck::Recording;
|
||||
break;
|
||||
|
||||
case RDRecording::Waiting:
|
||||
status=RDDeck::Waiting;
|
||||
break;
|
||||
|
||||
case RDRecording::ServerError:
|
||||
case RDRecording::InternalError:
|
||||
SendErrorMessage(&catch_events[event],
|
||||
ExecuteErrorRml(&catch_events[event],
|
||||
RDRecording::exitString(code)+": "+err_text,
|
||||
catch_conf->errorRml());
|
||||
status=RDDeck::Offline;
|
||||
break;
|
||||
|
||||
default:
|
||||
SendErrorMessage(&catch_events[event],RDRecording::exitString(code),
|
||||
ExecuteErrorRml(&catch_events[event],RDRecording::exitString(code),
|
||||
catch_conf->errorRml());
|
||||
status=RDDeck::Offline;
|
||||
break;
|
||||
}
|
||||
SendEventResponse(0,status,catch_events[event].id(),"");
|
||||
}
|
||||
|
||||
|
||||
void MainObject::WriteExitCodeById(int id,RDRecording::ExitCode code,
|
||||
void MainObject::WriteExitCode(CatchEvent *ce,RDRecording::ExitCode code,
|
||||
const QString &err_text)
|
||||
{
|
||||
RDDeck::Status status=RDDeck::Offline;
|
||||
QString sql=QString("update `RECORDINGS` set ")+
|
||||
QString::asprintf("`EXIT_CODE`=%d,",code)+
|
||||
"`EXIT_TEXT`='"+RDEscapeString(err_text)+"' where "+
|
||||
QString::asprintf("`ID`=%d",id);
|
||||
QString::asprintf("`ID`=%d",ce->id());
|
||||
rda->syslog(LOG_NOTICE,"WriteExitCode SQL: %s",sql.toUtf8().constData());
|
||||
RDSqlQuery::apply(sql);
|
||||
switch(code) {
|
||||
case RDRecording::Ok:
|
||||
status=RDDeck::Idle;
|
||||
break;
|
||||
|
||||
case RDRecording::Downloading:
|
||||
case RDRecording::Uploading:
|
||||
case RDRecording::RecordActive:
|
||||
case RDRecording::PlayActive:
|
||||
status=RDDeck::Recording;
|
||||
break;
|
||||
|
||||
case RDRecording::Waiting:
|
||||
status=RDDeck::Waiting;
|
||||
break;
|
||||
|
||||
case RDRecording::ServerError:
|
||||
case RDRecording::InternalError:
|
||||
ExecuteErrorRml(ce,RDRecording::exitString(code)+": "+err_text,
|
||||
catch_conf->errorRml());
|
||||
status=RDDeck::Offline;
|
||||
break;
|
||||
|
||||
default:
|
||||
ExecuteErrorRml(ce,RDRecording::exitString(code),catch_conf->errorRml());
|
||||
status=RDDeck::Offline;
|
||||
break;
|
||||
}
|
||||
SendEventResponse(0,status,ce->id(),"");
|
||||
}
|
||||
|
||||
|
||||
@ -2551,8 +2446,8 @@ void QApplication::saveState(QSessionManager &sm) {
|
||||
};
|
||||
*/
|
||||
|
||||
bool MainObject::SendErrorMessage(CatchEvent *event,const QString &err_desc,
|
||||
QString rml)
|
||||
bool MainObject::ExecuteErrorRml(CatchEvent *event,const QString &err_desc,
|
||||
QString rml)
|
||||
{
|
||||
if(rml.isEmpty()) {
|
||||
return false;
|
||||
|
@ -173,12 +173,12 @@ class MainObject : public QObject
|
||||
RDRecording::ExitCode ReadExitCode(int event);
|
||||
void WriteExitCode(int event,RDRecording::ExitCode code,
|
||||
const QString &err_text="");
|
||||
void WriteExitCodeById(int id,RDRecording::ExitCode code,
|
||||
const QString &err_text="");
|
||||
void WriteExitCode(CatchEvent *ce,RDRecording::ExitCode code,
|
||||
const QString &err_text="");
|
||||
QString BuildTempName(int event,QString str);
|
||||
QString BuildTempName(CatchEvent *evt,QString str);
|
||||
QString GetFileExtension(QString filename);
|
||||
bool SendErrorMessage(CatchEvent *event,const QString &err_desc,QString rml);
|
||||
bool ExecuteErrorRml(CatchEvent *event,const QString &err_desc,QString rml);
|
||||
void ResolveErrorWildcards(CatchEvent *event,const QString &err_desc,
|
||||
QString *rml);
|
||||
void RunLocalMacros(RDMacro *rml);
|
||||
|
Loading…
x
Reference in New Issue
Block a user