Springen naar inhoud


Foto

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


  • Please log in to reply
Er zijn 6 reacties in dit onderwerp

#1 JasonM8

  • Senior Member
  • 55 berichten

0
Neutral

Geplaatst op 4 juli 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 berichten

0
Neutral

Geplaatst op 4 juli 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
  • 14045 berichten

+298
Excellent

Geplaatst op 6 juli 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
  • 2024 berichten

+146
Excellent

Geplaatst op 6 juli 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

Veranderd door samsamsam, 6 juli 2018 - 19:42


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

  • Senior Member
  • 1227 berichten

+82
Good

Geplaatst op 6 juli 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
  • 46957 berichten

+541
Excellent

Geplaatst op 7 juli 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 berichten

0
Neutral

Geplaatst op 7 juli 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
 



1 gebruiker(s) lezen dit onderwerp

0 leden, 1 bezoekers, 0 anonieme gebruikers