Re: [RDD] Possible feature - Play cut in a cart based on a variable value, set variable from a shell script
I am running a time check macro on WNTK (New London, NH). There are a zillion audio cuts, all of them exactly 3 seconds long, containing time checks: "The time is eight fifteen", "The time is eight sixteen", etc. These are all in /var/snd/timecheck, where they are named 0815.wav, 0816.wav, etc. The macro determines what time it is, and creates a symbolic link from the corresponding audio file to /var/snd/005100_001.wav. Then it triggers a sound panel button programmed for cart 5100, waits three seconds for the cut to play, and quits. It works like a charm. Rob -- Сквозь грозы сияло нам солнце свободы И Linus великий нам путь озарил; Нас вырастил Stallman на верность народу, На труд и на подвиги нас вдохновил. On Sat, 26 Dec 2020, Fred Gleason wrote: On Dec 24, 2020, at 21:47, Lorne Tyndale wrote: I think it would be useful to have the ability to play a cut based on a variable's value and have the ability to set a variable's value from a macro. We already have the ability to define a variable and its value in Rivendell. If the 2 additional features were added then in the case of something like automating a temperature announcement you could define a variable (perhaps call it something like %CURRENT_TEMP%) and set up a cart with different cuts that play depending on the value of %CURRENT_TEMP%. The you'd simply need a shell script to grab the current temperature, pass it the defined variable, and the cart/cut would play the appropriate audio for that variable's value. I could see this being used beyond things like temperature announcements. We currently have the ability to set a ‘Schedule Cuts’ attribute for each cart, with the two possible values being ‘By Weight’ and ‘By Specified Order’. This would add a third value, perhaps called ‘By Program’. Activating that mode would completely bypass cut day-parting. Then, we add a command-line program called ‘rdsetcut’, which for example could be called like this: rdsetcut --cart-number=123456 --cut-number=27 This would cause cart 123456 to play cut 27 TFN. I suppose we could also support associating the cart with a host variable —e.g. %CURRENT_TEMP% — but that would require an additional ability change the value of such variables dynamically (currently, they can only be set statically within rdadmin(1)). I think it would be cleaner to have the external system —e.g. whatever is providing the temperature data — keep track of such things. If the specified cart doesn’t exist, or is a macro cart, we return an error. What should happen if the specified cut doesn’t exist? Keep the prior cut setting, or make the cart unplayable TFN? Any other edge cases we need to consider? I like this idea. Clean, simple, and lots of potential uses. Cheers! |-| | Frederick F. Gleason, Jr. | Chief Developer | | | Paravel Systems | |-| | A room without books is like a body without a soul. | | | | -- Cicero | |-| ___ Rivendell-dev mailing list Rivendell-dev@lists.rivendellaudio.org http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev
Re: [RDD] Possible feature - Play cut in a cart based on a variable value, set variable from a shell script
On Dec 26, 2020, at 16:49, Lorne Tyndale wrote: > The one thing I would add to the discussion is that rdsetcut should also > exist as a macro command so you can set the cut value through a macro. > One of things that I find truly powerful with Rivendell is the extensive > macro language, the ability to do pretty much everything via macros. ++ > One question though - why would it be necessary to bypass dayparting in > this mode? In a word: orthogonality. What makes this approach so elegant is that it allows cut-selection logic to be completely delegated to an external system; Rivendell becomes merely the executive agent. Keeping the day-parting around in that scenario significantly mucks up the logic; not only in the code, but more importantly in the heads of the people who have to deal with it, both the implementors and the end users. If you *want* day-parting in that mode, you are perfectly free to implement it in your external system, free of any vestigial policy constraints from Rivendell. > If a cut doesn't exist, could there be a "default cut" field / option in > the cart settings to deal with this? We already have something like this: the ‘Evergreen’ cut. So the logic when a non-existent cut is specified would become: 1) If an Evergreen cut exists, play that. 2) Otherwise, the cart become unplayable (shows RED in the log, and gets skipped over when attempted to be played). In fact, I can see the ability to make the cart unplayable could actually be a useful feature in many scenarios. So, in rdsetcut(1), specifying '--cut-number=0' would do just that: make the cart unplayable TFN. (Although, we may want to present this state in logs differently; RED strongly implies “error, problem”, whereas this would be an intentional condition). Cheers! |-| | Frederick F. Gleason, Jr. | Chief Developer | | | Paravel Systems | |-| | When you feel the urge to design a complex binary file format,| | it's generally wise to lie down until the feeling passes. | | | | -- Eric Raymond | | "The Art of UNIX Programming" | |-| ___ Rivendell-dev mailing list Rivendell-dev@lists.rivendellaudio.org http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev
Re: [RDD] Possible feature - Play cut in a cart based on a variable value, set variable from a shell script
Fred, > We currently have the ability to set a ‘Schedule Cuts’ attribute for each > cart, with the two possible values being ‘By Weight’ and ‘By Specified > Order’. This would add a third value, perhaps called ‘By Program’. Activating > that mode would completely bypass cut day-parting. Then, we add a > command-line program called ‘rdsetcut’, which for example could be called > like this: > > rdsetcut --cart-number=123456 --cut-number=27 > > This would cause cart 123456 to play cut 27 TFN. Thinking about it, I think I like your approach better thenb using variables. Have something like an rdsetcut to allow you to specify what cut to play along with a third option for scheduling cuts. I agree this would be a lot cleaner then using variables. The one thing I would add to the discussion is that rdsetcut should also exist as a macro command so you can set the cut value through a macro. One of things that I find truly powerful with Rivendell is the extensive macro language, the ability to do pretty much everything via macros. One question though - why would it be necessary to bypass dayparting in this mode? Right now if you play (for example) cart 12345, cut 1 (if it only has 1 cut in the cart) and Cut 1 has dayparting set so that it'll only play on Fridays from 1 to 2 pm, then it'll just skip over that cart/cut and go on to the next thing in the log unless the time / day meets the dayparting rules. Under the above scenario with "by program", you could say "play Cart 12345, cut 27". If Cut 27 is set to only play on Fridays from 1 to 2 pm, then why couldn't the daypart rules also apply? Just have it skip over that cart in the log like you would if there was only 1 cut in the cart. > If the specified cart doesn’t exist, or is a macro cart, we return an error. > > What should happen if the specified cut doesn’t exist? Keep the prior cut > setting, or make the cart unplayable TFN? If a cut doesn't exist, could there be a "default cut" field / option in the cart settings to deal with this? When selecting the "by program" mode of cut playback the "default cut" field would be played if the requested cut does not exist. Then the logic could be like this: -If the requested cut exists and dayparting allows it to play, then play that cut -If the requested cut exists but is prevented from playing due to dayparting, then skip over that cart/cut -If the requested cut does not exist but a default cut that does exist and is allowed to play due to dayparting rules, then play the default cut. -If a requested cut does not exist and the "default cut" does not exist or is prevented from playing due to dayparting rules, then skip over that cart/cut entirely. I think this would cover most of the situations. Thoughts? Lorne Tyndale ___ Rivendell-dev mailing list Rivendell-dev@lists.rivendellaudio.org http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev
Re: [RDD] Possible feature - Play cut in a cart based on a variable value, set variable from a shell script
On Dec 24, 2020, at 21:47, Lorne Tyndale wrote: > I think it would be useful to have the ability to play a cut based on a > variable's value and have the ability to set a variable's value from a > macro. > > We already have the ability to define a variable and its value in > Rivendell. > > If the 2 additional features were added then in the case of something > like automating a temperature announcement you could define a variable > (perhaps call it something like %CURRENT_TEMP%) and set up a cart with > different cuts that play depending on the value of %CURRENT_TEMP%. The > you'd simply need a shell script to grab the current temperature, pass > it the defined variable, and the cart/cut would play the appropriate > audio for that variable's value. > > I could see this being used beyond things like temperature > announcements. We currently have the ability to set a ‘Schedule Cuts’ attribute for each cart, with the two possible values being ‘By Weight’ and ‘By Specified Order’. This would add a third value, perhaps called ‘By Program’. Activating that mode would completely bypass cut day-parting. Then, we add a command-line program called ‘rdsetcut’, which for example could be called like this: rdsetcut --cart-number=123456 --cut-number=27 This would cause cart 123456 to play cut 27 TFN. I suppose we could also support associating the cart with a host variable —e.g. %CURRENT_TEMP% — but that would require an additional ability change the value of such variables dynamically (currently, they can only be set statically within rdadmin(1)). I think it would be cleaner to have the external system —e.g. whatever is providing the temperature data — keep track of such things. If the specified cart doesn’t exist, or is a macro cart, we return an error. What should happen if the specified cut doesn’t exist? Keep the prior cut setting, or make the cart unplayable TFN? Any other edge cases we need to consider? I like this idea. Clean, simple, and lots of potential uses. Cheers! |-| | Frederick F. Gleason, Jr. | Chief Developer | | | Paravel Systems | |-| | A room without books is like a body without a soul. | | | | -- Cicero | |-| ___ Rivendell-dev mailing list Rivendell-dev@lists.rivendellaudio.org http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev
[RDD] Possible feature - Play cut in a cart based on a variable value, set variable from a shell script
Hi, I was just thinking about Michael's request regarding automatic temperature announcements, and it brought to mind a potential for a new (and I think it would be powerful) feature. I think it would be useful to have the ability to play a cut based on a variable's value and have the ability to set a variable's value from a macro. We already have the ability to define a variable and its value in Rivendell. If the 2 additional features were added then in the case of something like automating a temperature announcement you could define a variable (perhaps call it something like %CURRENT_TEMP%) and set up a cart with different cuts that play depending on the value of %CURRENT_TEMP%. The you'd simply need a shell script to grab the current temperature, pass it the defined variable, and the cart/cut would play the appropriate audio for that variable's value. I could see this being used beyond things like temperature announcements. Thoughts? Lorne Tyndale ___ Rivendell-dev mailing list Rivendell-dev@lists.rivendellaudio.org http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev