NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public NextPVR Support Legacy (v4.x and earlier) v
« Previous 1 … 11 12 13 14 15 … 433 Next »
Determine if recording is in progress/pending programatically

Determine if recording is in progress/pending programatically
selowan
Offline

Junior Member

Posts: 20
Threads: 7
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: 52,953
Threads: 956
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: 20
Threads: 7
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: 52,953
Threads: 956
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
  Recording movies / TV to XBMC directory stucture spinnaker 10 3,549 2024-06-03, 03:56 AM
Last Post: Rod Hutchinson
  Not recording errors vidwiz 4 998 2024-04-17, 05:39 PM
Last Post: mvallevand
  Add Series/Episode Info to Recording Metadata andrewj 2 1,076 2023-11-20, 03:42 PM
Last Post: sub
  Recording to a network drive woes. 2leftfeet 12 7,195 2022-04-05, 08:03 PM
Last Post: mvallevand
  device needed for recording David209 2 1,734 2021-04-04, 08:47 AM
Last Post: David209
  PC not going to sleep after recording LeoL 7 3,269 2021-04-01, 07:17 PM
Last Post: Handy.Man
  HDHomerun recording bizzarely not working Jean0987654321 3 2,038 2021-03-27, 03:23 PM
Last Post: Jean0987654321
Video Restrict Recording Space foucomm 1 1,327 2021-01-30, 09:25 PM
Last Post: mvallevand
  Directory dropdown on the recording edit dialog MicahMakenzie 1 1,500 2021-01-11, 04:37 PM
Last Post: Graham
  Recording service stopped or not running at scheduled time MattInetroit 3 1,887 2021-01-08, 12:03 AM
Last Post: mvallevand

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

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

Linear Mode
Threaded Mode