View Full Version : [ViX_Misc] How to detect if actively recording?
Stuck on old release, it's the latest stable version for GigaBlue QuadPlus, later versions get sick after hours or days resulting in PAT tuner timeouts.
So that's an aside.
Q: What I'd like to know is, from a shell script run by cron, how can I tell if a recording is currently active? poking around in /proc/ didn't turn up much.
I want to do intrusive actions like reboot etc. but delay/wait until no recordings are happening.
thanks
The information about any running recording is contained within the enigma2 image, so you'll need to query it.
A bit of a hack, but:
wget -qO - http://127.0.0.1/ajax/timers | grep -E '^[[:space:]]*running[[:space:]]*$'will produce output if there is a running timer.
Rob van der Does
11-07-16, 06:15
But even if no recording is in progress, one could start any second. So maybe it would be safer to extract the timers?
Building on the earlier suggestion, here's a bit of Python tested on OpenVix 4.1.013 which will look at all your timers and tell you if you are inside a timer window or 5 mins before a timer is due to start.
At the top you can change the self.recordWindow=300 to create a bigger window (in seconds) if you want one. As far as embedding into a shell script just call it and check for the exit code not being 1, something like:
./isrecording.py
if [ $? = 0 ]
then
echo good to go, nothing recording or due to start
fi
as long as the xml returned doesn't change you will be ok, I've include a debug line you can turn on in case it does, maybe turn it on and see what good output looks like so you can check later.
Hope that helps
Jumped the gun, you need this test as well
if _now>=_start and _now<_end:
_hit=True
New version attached
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.