Jump to content


Photo

How to programatically check if recording is active or almost active?


  • Please log in to reply
6 replies to this topic

#1 JasonM8

  • Senior Member
  • 55 posts

0
Neutral

Posted 4 July 2018 - 17:04

What methods can I use to check if recording is currently active, or if they are pending N minutes from now? Basically I want to do same check that enigma2 does when starting, to avoid restarting if recordings are active or pending.



Re: How to programatically check if recording is active or almost active? #2 JasonM8

  • Senior Member
  • 55 posts

0
Neutral

Posted 4 July 2018 - 17:10

What methods can I use to check if recording is currently active, or if they are pending N minutes from now? Basically I want to do same check that enigma2 does when starting, to avoid restarting if recordings are active or pending.

 

restarting.



Re: How to programatically check if recording is active or almost active? #3 MiLo

  • PLi® Core member
  • 14,045 posts

+298
Excellent

Posted 6 July 2018 - 19:23

How about just looking into the source code? Just search for the (English) message, should be easy enough to find.
Real musicians never die - they just decompose

Re: How to programatically check if recording is active or almost active? #4 samsamsam

  • Senior Member
  • 2,024 posts

+146
Excellent

Posted 6 July 2018 - 19:41

Hello @JasonM8,

 

Here you have example code which show how you should ask Enigma2 to restart:

 


def doRestartFailed(self, *args):
    self.session.open(MessageBox, _("Restart GUI failed. \nPlease restart STB manually."), type = MessageBox.TYPE_INFO, timeout=5 )
 
 
from Screens.Standby import TryQuitMainloop
self.session.openWithCallback(self.doRestartFailed, TryQuitMainloop, retvalue=3)
 
TryQuitMainloop will made such check for you.
 
Regards,
SSS

Edited by samsamsam, 6 July 2018 - 19:42.


Re: How to programatically check if recording is active or almost active? #5 mrvica

  • Senior Member
  • 1,224 posts

+81
Good

Posted 6 July 2018 - 20:02

with webinterface

 

echo "ongoing timers:"  $(wget -O- -q http://127.0.0.1/web/timerlist |grep "e2state" | grep -c ">2<")
ongoing timers: 0

 

as you see I have no active recordings



Re: How to programatically check if recording is active or almost active? #6 Erik Slagter

  • PLi® Core member
  • 46,951 posts

+541
Excellent

Posted 7 July 2018 - 08:33

Great tip!


* Wavefrontier T90 with 28E/23E/19E/13E via SCR switches 2 x 2 x 6 user bands
I don't read PM -> if you have something to ask or to report, do it in the forum so others can benefit. I don't take freelance jobs.
Ik lees geen PM -> als je iets te vragen of te melden hebt, doe het op het forum, zodat anderen er ook wat aan hebben.


Re: How to programatically check if recording is active or almost active? #7 JasonM8

  • Senior Member
  • 55 posts

0
Neutral

Posted 7 July 2018 - 09:38

Thanks all! The webinterface solution is perfect in this case as I was trying to write a standalone shutdown script (and such a script can't access current session object, AFAIK).
 
x=$(wget -O- -q http://127.0.0.1/web/timerlist |grep "e2state" | grep -c ">2<")
if [ "$x" == "0" ]; then
  echo "No timers running, restarting"
  shutdown -r 0
else
  echo "Can't restart, there are active timers:" $x
 



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users