Menu

#88 Signal for announcement overtime? (Talking too long)

closed
None
5
2023-09-21
2018-04-26
Moonbase
No

Could we get a new signal (idjcmonitor.py) that fires when a preprogrammed announcement goes into overtime (i.e., talking is longer than the planned duration)?

Use case: I’d like to make the red lamp in my signal tower flash (instead of being "on" for "On Air") to show "Hey, you’re talking too long".

This is mainly used for shows with pretty strict timing requirements, and often used in professional studios.

Discussion

  • Stephen Fairchild

    Seems perfectly reasonable.

     
  • Stephen Fairchild

    Feature now ready for testing and also example usage code is in the docsrc directory.

     
  • Stephen Fairchild

    • status: open --> pending
    • assigned_to: Stephen Fairchild
     
  • Moonbase

    Moonbase - 2018-06-01

    Brilliant, thanks. Adapted my signal handler code and testing …

    I’d like to support both »old« and »new« IDJC versions with the same code. Is there a better way to check for availability of the new "announcement" signal than this?

    # Must try for announcement handler, it might not (yet) be available
    # on older IDJC versions
    try:
        monitor.connect("announcement", announcement_handler)
    except TypeError:
        # monitor.connect() raises TypeError: unknown signal name: announcement
        # if this signal isn’t available
        pass
    
     

    Last edit: Moonbase 2018-06-01
    • Stephen Fairchild

      Exceptions are considered Pythonic. Even more so if failure is the exceptional case.

       
  • Moonbase

    Moonbase - 2018-06-01

    Just compiled v0.8.18_development (Commit hash: a2b65ec81edfdbb00fac5a54818f1d45afa4fbc3) on Linux Mint 18.3 (Ubuntu 16.04-based) and it works just great. I didn’t (yet) test your AnnouncementOverrunMonitor() class but used my code for the SignalBox MQTT stuff:

    def announcement_handler(_, player, state, message):
        # Ignore announcements from interlude player.
        if player in ("left", "right"):
            if state == "active":
                logger.info("New announcement on player %s: %s" % (player, message))
            if state == "overtime":
                logger.info("DJ announcement time expired on player %s." % player)
                status_topic = config.get(mqtt_section, 'base_topic') + config.get(my_section, 'client_topic') + 'status/'
                mqttclient.publish(status_topic + "red", 'blink', retain=True)
            if state == "inactive":
                logger.info("Announcement closed on player %s." % player)
                # TODO: we MIGHT have to reset RED (not sure, testing required)
                #show_channelstate()
    

    Works exactly as intended: Song ends (red light starts flashing to show EOM), announcement starts (red light on=microphone(s) open) and as soon as the preset time has run out the red light starts blinking.

    Perfect, thanks a lot!

    I still wonder which is better, the "try/except" code above or checking for something like

    if "announcement" in monitor.__gsignals__:
    

    Which would you suggest?

     
    • Stephen Fairchild

      TODO: we MIGHT have to reset RED (not sure, testing required)

      The overrun class was written to handle the possibility that there is more than one announcement active. Closing one but not all should not alter RED.

      After all announcements are closed the right thing to do is reset the blinking state and hopefully the microphone closed signal will arrive after (otherwise that's a bug that needs fixing) and use mic closed to clear RED (which it already does, right?). There might be an unsightly brief flash if an LED is used.

       
  • Moonbase

    Moonbase - 2018-06-02

    Thanks for noticing, actually already tested … works just fine, even with many microphones :-)
    No bugs found, for this use case it was just a little too much overhead to use the overrun class.
    Just a few more days for me writing documentation and it’ll all be ready for GitHub …

     
  • Moonbase

    Moonbase - 2018-06-03

    FYI: I’ve had three other IDJC users test this in the meantime, and it has been accepted with quite some enthusiam :-)

     
  • Stephen Fairchild

    • status: pending --> closed
     

Log in to post a comment.