NextPVR Forums
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public NextPVR v4 Support (legacy versions) v
« Previous 1 … 8 9 10 11 12 … 431 Next »
Determine if recording is in progress/pending programatically

Determine if recording is in progress/pending programatically
selowan
Offline

Junior Member

Posts: 5
Threads: 2
Joined: Dec 2019
#1
2019-12-27, 10:15 PM
I have been working at automating a backup of the database and config files.  Here's what I think I know, hopefully someone will be able to tell me how accurate this is:
  • The Nrecord.exe service must be stopped to copy the database file.
  • User must be an admin to stop/start the service.
  • NextPvr runs as a user that is not an admin. I base this on trying and failing to stop the service from PostUpdateEpg.bat 
I ended up with a scheduled Powershell task running as local admin that stops the service, performs the backup, and starts the service.

It works well, but I would like to be able to determine if a recording is in progress, or about to start in the next few minutes from within the script.  If so, I'd just bug out of the script and let it run the next day.  It's scheduled for the wee hours, so while it's possible something might be recording, it would be rare, and I'm OK with not backing it up every day.

This must be possible, since the System plug-in can do it.  Can anyone point me in the right direction?

Thanks,

Mike
.
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 36,791
Threads: 727
Joined: May 2006
#2
2019-12-27, 10:53 PM
There are api's to do but this is what you are looking for

https://forums.nextpvr.com/showthread.php?tid=53211

specifically -isinuse (which covers live tv too) because as JavaWiz posted -isRecording doesn't report accurately.

Note i doesn't look like either of these have been ported to v5.

For the questions

- NextPVR runs as a user, however the recording service can be run as either "local system" or a user, but I am pretty sure all windows services need admin to stop them.

- I personally don't stop the service to to copy the database even when recording.

Martin
selowan
Offline

Junior Member

Posts: 5
Threads: 2
Joined: Dec 2019
#3
2019-12-29, 10:38 PM
Thanks.  It turns out that while I can copy the database file manually using Windows Explorer, the ancient version of Pkzipc that I normally I use for my backups cannot add it to a .zip file unless the recorder service is stopped first.  When I get some time, I can update the PoSh script to create a compressed folder instead of using Pkzipc.

Is there any danger of making a corrupt copy of the database if it's copied while its being written to by the recording service?
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 36,791
Threads: 727
Joined: May 2006
#4
2019-12-29, 11:20 PM
If this was a critical I'd worry more but any activity on files in a multi-user environment will be potential "danger". Assuming you are using a proper approach to backup rotation instead of relying on one backup I don't see an issue especially as you are already willing to wait one day.

Also consider zip.exe

Martin
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
Video Restrict Recording Space foucomm 1 88 2021-01-30, 09:25 PM
Last Post: mvallevand
  Directory dropdown on the recording edit dialog MicahMakenzie 1 146 2021-01-11, 04:37 PM
Last Post: Graham
  Recording service stopped or not running at scheduled time MattInetroit 3 200 2021-01-08, 12:03 AM
Last Post: mvallevand
  Recording to NAS? Reddwarf 27 2,877 2020-12-02, 04:54 PM
Last Post: LL88
  unable to delete recording manic_biker 9 286 2020-12-01, 09:41 PM
Last Post: mvallevand
  Problem setting up recording for some programmes LeoL 5 213 2020-10-21, 09:34 PM
Last Post: LeoL
  black play and zero recording sebjoan 5 384 2020-10-13, 05:16 PM
Last Post: sebjoan
  Replayed recording problem Tj.2 25 2,343 2020-09-22, 04:51 PM
Last Post: baj1
  Recurring recording problem Dave48167 18 696 2020-09-10, 08:26 PM
Last Post: Dave48167
  NextPVR Recording Service doesn't install from Services SamM 4 476 2020-08-02, 01:11 AM
Last Post: SamM

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode