diff --git a/ChangeLog b/ChangeLog index 8ee780b6..3d5c30df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19312,3 +19312,6 @@ 2019-12-09 Fred Gleason * Fixed a bug in the rdxport service that could cause MODIFY notifications to fail to be sent by the 'SaveLog' WebAPI call. +2019-12-09 Fred Gleason + * Fixed a bug in rdcatchd(8) that failed to send a MODIFY + notification at the end of a Record or Download event. diff --git a/rdcatchd/batch.cpp b/rdcatchd/batch.cpp index 235d7d2e..309e4acf 100644 --- a/rdcatchd/batch.cpp +++ b/rdcatchd/batch.cpp @@ -66,16 +66,28 @@ void MainObject::catchConnectedData(int serial,bool state) exit(256); } + connect(rda,SIGNAL(userChanged()),this,SLOT(userChangedData())); + rda->ripc()-> + connectHost("localhost",RIPCD_TCP_PORT,rda->config()->password()); +} + + +void MainObject::userChangedData() +{ // // Dispatch Handler // switch(batch_event->type()) { case RDRecording::Recording: RunImport(batch_event); + SendNotification(RDNotification::CartType,RDNotification::ModifyAction, + RDCut::cartNumber(batch_event->cutName())); break; case RDRecording::Download: RunDownload(batch_event); + SendNotification(RDNotification::CartType,RDNotification::ModifyAction, + RDCut::cartNumber(batch_event->cutName())); break; case RDRecording::Upload: @@ -87,6 +99,15 @@ void MainObject::catchConnectedData(int serial,bool state) exit(256); } + QTimer *timer=new QTimer(this); + timer->setSingleShot(true); + connect(timer,SIGNAL(timeout()),this,SLOT(exitData())); + timer->start(5000); // So notifications have a chance to propagate +} + + +void MainObject::exitData() +{ exit(0); } @@ -95,7 +116,6 @@ void MainObject::RunBatch(RDCmdSwitch *cmd) { bool ok=false; int id=-1; - // unsigned schema=0; // // Set Process Priority @@ -240,6 +260,7 @@ void MainObject::RunDownload(CatchEvent *evt) catch_connect->setExitCode(evt->id(),RDRecording::Ok,"OK"); } + void MainObject::RunUpload(CatchEvent *evt) { RDUpload::ErrorCode conv_err; diff --git a/rdcatchd/rdcatchd.cpp b/rdcatchd/rdcatchd.cpp index fd6c0e31..3c92c4e4 100644 --- a/rdcatchd/rdcatchd.cpp +++ b/rdcatchd/rdcatchd.cpp @@ -978,6 +978,9 @@ void MainObject::recordUnloadedData(int card,int stream,unsigned msecs) if(debug) { printf("Unloaded - Card: %d Stream: %d\n",card,stream); } + SendNotification(RDNotification::CartType, + RDNotification::ModifyAction, + RDCut::cartNumber(catch_events[event].cutName())); if(catch_events[event].oneShot()) { PurgeEvent(event); } @@ -2652,6 +2655,16 @@ void MainObject::StartBatch(int id) } +void MainObject::SendNotification(RDNotification::Type type, + RDNotification::Action action, + const QVariant &id) +{ + RDNotification *notify=new RDNotification(type,action,id); + rda->ripc()->sendNotification(*notify); + delete notify; +} + + QString MainObject::GetTempRecordingName(int id) const { return QString().sprintf("%s/rdcatchd-record-%d.%s", diff --git a/rdcatchd/rdcatchd.h b/rdcatchd/rdcatchd.h index d0e50d21..8df34ecd 100644 --- a/rdcatchd/rdcatchd.h +++ b/rdcatchd/rdcatchd.h @@ -128,6 +128,8 @@ class MainObject : public QObject // batch.cpp // void catchConnectedData(int serial,bool state); + void userChangedData(); + void exitData(); private: // @@ -193,6 +195,8 @@ class MainObject : public QObject void RunRmlRecordingCache(int chan); void StartRmlRecording(int chan,int cartnum,int cutnum,int maxlen); void StartBatch(int id); + void SendNotification(RDNotification::Type type,RDNotification::Action, + const QVariant &id); QString GetTempRecordingName(int id) const; QString catch_default_user; QString catch_host;