diff --git a/ChangeLog b/ChangeLog index ec7eafb4..d8c33d01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24692,3 +24692,5 @@ * Modified the Sound Panel classes to use native Qt JSON methods. 2024-04-03 Fred Gleason * Removed JSON generation methods. +2024-04-03 Fred Gleason + * Added an 'ExtendedNextPadEvents=' directive to rd.conf(5). diff --git a/conf/rd.conf-sample b/conf/rd.conf-sample index d2c9ef52..d108a7b1 100644 --- a/conf/rd.conf-sample +++ b/conf/rd.conf-sample @@ -188,6 +188,13 @@ TranscodingDelay=0 ; bootup. ;ServiceStartupDelay=5 +; Maximum number of extended next PAD events, available at TCP port 34290. +; Setting this to '-1' causes 'next' clauses for the entire runtime horizon +; of the log to be sent, while setting it to '0' disables the extended next +; PAD events feature entirely. +;ExtendedNextPadEvents=4 + + [Hacks] ; As implied by the name, directives in this section are generally for use ; in troubleshooting or maintenance situations. Do *NOT* change these on diff --git a/docs/manpages/rd.conf.xml b/docs/manpages/rd.conf.xml index d4959801..f4d5654f 100644 --- a/docs/manpages/rd.conf.xml +++ b/docs/manpages/rd.conf.xml @@ -715,6 +715,27 @@ aspects of Rivendell. + + + ExtendedNextPadEvents = num + + + + Instruct the PAD subsystem to provide an "extended" + interface at TCP port 34290, + appending num "next" + objects in addition to the standard "next" object. + + + Setting num to + -1 will cause "next" objects + for all upcoming events to be generated; + while setting num to + 0 will disable the extended PAD + interface entirely. + + + ServiceStartDelay = secs diff --git a/docs/opsguide/pad.xml b/docs/opsguide/pad.xml index 050ed9c6..ee497a3a 100644 --- a/docs/opsguide/pad.xml +++ b/docs/opsguide/pad.xml @@ -96,6 +96,16 @@ }]]> + + The Extended JSON Interface + + An "extended" version of the above PAD feed that contains + additional next objects is optionally available at + TCP port 34290. See the ExtendedNextPadEvents= + directive in the [Tuning] section of the + rd.conf5 man page. + + diff --git a/lib/rd.h b/lib/rd.h index 657ce0c2..22c4d838 100644 --- a/lib/rd.h +++ b/lib/rd.h @@ -633,6 +633,11 @@ */ #define RD_DEFAULT_SERVICE_TIMEOUT 30 +/* + * Default 'ExtendedNextPadEvents=' value is rd.conf(5) + */ +#define RD_DEFAULT_EXTENDED_NEXT_PAD_EVENTS 4 + /* * Default 'ServiceStartupDelay=' value in rd.conf(5) [seconds] */ diff --git a/lib/rdconfig.cpp b/lib/rdconfig.cpp index 4a4cc54f..9c7a8804 100644 --- a/lib/rdconfig.cpp +++ b/lib/rdconfig.cpp @@ -538,6 +538,12 @@ int RDConfig::serviceStartupDelay() const } +int RDConfig::extendedNextPadEvents() const +{ + return conf_extended_next_pad_events; +} + + QString RDConfig::sasStation() const { return conf_sas_station; @@ -729,6 +735,9 @@ bool RDConfig::load() conf_temp_directory=profile->stringValue("Tuning","TempDirectory",""); conf_service_startup_delay=profile->intValue("Tuning","ServiceStartupDelay", RD_DEFAULT_SERVICE_STARTUP_DELAY); + conf_extended_next_pad_events= + profile->intValue("Tuning","ExtendedNextPadEvents", + RD_DEFAULT_EXTENDED_NEXT_PAD_EVENTS); conf_sas_station=profile->stringValue("SASFilter","Station",""); conf_sas_matrix=profile->intValue("SASFilter","Matrix",0); conf_sas_base_cart=profile->intValue("SASFilter","BaseCart",0); diff --git a/lib/rdconfig.h b/lib/rdconfig.h index 2f1d1fc0..7e737262 100644 --- a/lib/rdconfig.h +++ b/lib/rdconfig.h @@ -126,6 +126,7 @@ class RDConfig int serviceTimeout() const; QString tempDirectory(); int serviceStartupDelay() const; + int extendedNextPadEvents() const; QString sasStation() const; int sasMatrix() const; unsigned sasBaseCart() const; @@ -214,6 +215,7 @@ class RDConfig int conf_service_timeout; QString conf_temp_directory; int conf_service_startup_delay; + int conf_extended_next_pad_events; QString conf_sas_station; int conf_sas_matrix; unsigned conf_sas_base_cart; diff --git a/lib/rdlogplay.cpp b/lib/rdlogplay.cpp index 1b0cee92..3c74a094 100644 --- a/lib/rdlogplay.cpp +++ b/lib/rdlogplay.cpp @@ -74,7 +74,11 @@ RDLogPlay::RDLogPlay(int id,RDEventPlayer *player,bool enable_cue,QObject *paren // // PAD Server Connection // - for(int i=0;i<2;i++) { + int extended_next=2; + if(rda->config()->extendedNextPadEvents()==0) { + extended_next=1; + } + for(int i=0;i connectToAbstract(QString::asprintf("%s-%d", @@ -3172,7 +3176,11 @@ void RDLogPlay::SendNowNext() } int next_num=1; - for(int i=0;i<2;i++) { + int extended_next=2; + if(rda->config()->extendedNextPadEvents()==0) { + extended_next=1; + } + for(int i=0;i=0) { - if((i>0)&&(nextLine()>=0)) { - for(int j=nextLine()+1;jtype()==RDLogLine::Cart)||(ll->type()==RDLogLine::Macro)) { - if((ll->status()==RDLogLine::Scheduled)&& - (!logLine(i)->asyncronous())) { - next_datetime=next_datetime.addSecs(ll->forcedLength()/1000); - jo0.insert(QString::asprintf("next%d",next_num), - GetPadJson(QString::asprintf("next%d",next_num),ll, - next_datetime,j)); - next_num++; + if(rda->config()->extendedNextPadEvents()!=0) { + int limit=lineCount(); + if(rda->config()->extendedNextPadEvents()>0) { + limit=nextLine()+1+rda->config()->extendedNextPadEvents(); + } + if(nextLine()>=0) { + if((i>0)&&(nextLine()>=0)) { + for(int j=nextLine()+1;jtype()==RDLogLine::Cart)||(ll->type()==RDLogLine::Macro)) { + if((ll->status()==RDLogLine::Scheduled)&& + (!logLine(i)->asyncronous())) { + next_datetime=next_datetime.addSecs(ll->forcedLength()/1000); + jo0.insert(QString::asprintf("next%d",next_num), + GetPadJson(QString::asprintf("next%d",next_num),ll, + next_datetime,j)); + next_num++; + } } } } diff --git a/rdpadd/rdpadd.cpp b/rdpadd/rdpadd.cpp index dcb513a7..298892d5 100644 --- a/rdpadd/rdpadd.cpp +++ b/rdpadd/rdpadd.cpp @@ -27,7 +27,14 @@ MainObject::MainObject() : QObject() { - for(int i=0;i<2;i++) { + d_config=new RDConfig(); + d_config->load(); + + int extended_next=2; + if(d_config->extendedNextPadEvents()==0) { + extended_next=1; + } + for(int i=0;i #include +#include + #include "repeater.h" #define RDPADD_USAGE "\n\n" @@ -36,6 +38,7 @@ class MainObject : public QObject private: QList d_repeaters; + RDConfig *d_config; };