<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 8/14/24 18:07, George Bingham wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAA2WpHNcZtjh946-8k7m1u=oZtgmaSQFvH+SM9+U7wbNFh_cyg@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hey all,
        <div><br>
        </div>
        <div>I have a system event script that runs when playback has
          stopped on a particular front end. The script makes an
          announcement on the machine in my room, and also sends a
          notification to my phone in case I'm not there.</div>
        <div><br>
        </div>
        <div>The reason is that the person using that frontend can't see
          well enough to work the remote and so I have to switch to
          another program or whatnot.</div>
        <div><br>
        </div>
        <div>I often will setup a few hours of programming to play in a
          playlist and then go about  house or yard work, and when I get
          the notification that playback has stopped, I can go in and
          turn another channel on or whatnot.  </div>
        <div><br>
        </div>
        <div>I am looking for a way to add intelligence to my 'playback
          stopped' system event script such that it doesn't bother
          notifying me if it's just immediately going to play the next
          show in the playlist. </div>
        <div><br>
        </div>
        <div>I figured since there is a playback started event, I may be
          able to have that system event set some flag that the playback
          stopped script can check, but before I work on that, does
          someone know whether or not system events are asynchronous?
          For example, will the "playback stopped" system event have to
          finish before the "Playback started" system event kicks off
          when it's in the middle of a playlist????</div>
        <div><br>
        </div>
        <div>If I have my "playback stopped" script wait for a few
          seconds to see if a "playback started" event is kicked off, I
          can avoid the useless announcement and sms.   How would the
          experienced among you implement this??</div>
      </div>
    </blockquote>
    You can create a directory (e.g. /var/opt/mythtv/) where you create
    small files to save your status and check it in the next script. So
    your playback stopped script can sleep for a time (eg 15 seconds)
    then check if there is a file called "playback_start" in the
    directory. You need to make sure to delete the file at an
    appropriate time, probably right after you checked it. You can also
    store the actual event time in the file for extra checking.<br>
    <blockquote type="cite"
cite="mid:CAA2WpHNcZtjh946-8k7m1u=oZtgmaSQFvH+SM9+U7wbNFh_cyg@mail.gmail.com">
      <div dir="ltr">
        <div><br>
        </div>
        <div>Thanks,</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>
          <div>
            <div dir="ltr" class="gmail_signature"
              data-smartmail="gmail_signature">-- George</div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre wrap="" class="moz-quote-pre">_______________________________________________
mythtv-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mythtv-users@mythtv.org">mythtv-users@mythtv.org</a>
<a class="moz-txt-link-freetext" href="http://lists.mythtv.org/mailman/listinfo/mythtv-users">http://lists.mythtv.org/mailman/listinfo/mythtv-users</a>
<a class="moz-txt-link-freetext" href="http://wiki.mythtv.org/Mailing_List_etiquette">http://wiki.mythtv.org/Mailing_List_etiquette</a>
MythTV Forums: <a class="moz-txt-link-freetext" href="https://forum.mythtv.org">https://forum.mythtv.org</a>
</pre>
    </blockquote>
  </body>
</html>