2019-09-23, 02:54 AM
(This post was last modified: 2019-09-29, 07:00 PM by ChaosMageX.)
Well, after NextPVR's recording service crashed yet again last night, destroying almost all of Toonami without my knowledge until the following morning, I finally decided to bite the bullet and build an app to do something about it. I only regret not doing it sooner.
This app is designed to basically babysit NextPVR by monitoring the state of its recording service once per second. If it detects that the service has stopped for whatever reason, it will log the time at which this occurred, copy all of NextPVR's log files into a separate directory with this timestamp, and then attempt to restart the service. Once the service has been successfully restarted, it will log the time at which it restarted the service. From my own tests of manually stopping the service, it seems to restart it within 5 seconds of it stopping. The new folder full of the log file copies is in the same directory as the original log file folder, which is C:\Users\Public\NPVR\Log_yyyy-MM-DD_hh\hmm_ss, and it can then be perused at your leisure, or compressed and uploaded to this forum for the developers to peruse.
The application is completely open source and the code is available to download as part of the suite of tools that I have been developing to complement NextPVR. It can be found and downlaoded at my GitHub repository here:
https://github.com/ChaosMageX/NextPVR-Utilities
WARNING: USE THIS SOFTWARE AT YOUR OWN RISK. It is designed to directly mess with NextPVR's central recording service, but only to restart it if it has stopped. Still, Murphy's Law: What can go wrong, will go wrong. NextPVR itself has proven that to me time and time again. I've tried my best to fool proof it by ensuring that it can only run one instance at a time and always run with administrator privileges so it can successfully restart the recording service, but still, be wary.
If anything does go wrong, please let me know in a reply to this thread and I'll do my best to fix it in the code and upload a new version.
If you have any suggestions on how I can further improve this application and any new features I can add to it, please don't hesitate to let me know in a reply to this thread.
Installation is simple. Just extract the contents of the ZIP file to the directory of your choice, and begin running the application with administrator privileges. It should ask you for admin privileges from the start, but if it doesn't, it will simply refuse to run, and you'll have to right click it and choose Run As Administrator.
If you want, you can also right click the executable and choose Create Shortcut, and then move the created shortcut file into either
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
or
C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
in order to get it to start up at the time you start your computer so that it can monitor NextPVR's recording service right from the start.
EDIT 9/23/2019: Added SecsToStart to the configuration file that comes with the application so that the seconds it waits at startup before monitoring can be adjusted for when it's run from Startup on computers where NextPVR takes longer than usual to start its recording service itself.
EDIT 9/24/2019: Added a "Backup NextPVR Logs Now" button so that users can backup NextPVR's logs into a separate timestamped button at any time with just a single click, in case they need to backup the logs for another reason besides the recording service crashing.
Since this is a change to the GUI, I think it warrants a new version, Version 1.1, which can be downloaded below.
EDIT 9/29/2019: Improved the internal handling of the application, so that its GUI is no longer stuck frozen and unusable while waiting on initial startup. These improvements are in version 1.1 only, so I'm removing version 1 now.
This app is designed to basically babysit NextPVR by monitoring the state of its recording service once per second. If it detects that the service has stopped for whatever reason, it will log the time at which this occurred, copy all of NextPVR's log files into a separate directory with this timestamp, and then attempt to restart the service. Once the service has been successfully restarted, it will log the time at which it restarted the service. From my own tests of manually stopping the service, it seems to restart it within 5 seconds of it stopping. The new folder full of the log file copies is in the same directory as the original log file folder, which is C:\Users\Public\NPVR\Log_yyyy-MM-DD_hh\hmm_ss, and it can then be perused at your leisure, or compressed and uploaded to this forum for the developers to peruse.
The application is completely open source and the code is available to download as part of the suite of tools that I have been developing to complement NextPVR. It can be found and downlaoded at my GitHub repository here:
https://github.com/ChaosMageX/NextPVR-Utilities
WARNING: USE THIS SOFTWARE AT YOUR OWN RISK. It is designed to directly mess with NextPVR's central recording service, but only to restart it if it has stopped. Still, Murphy's Law: What can go wrong, will go wrong. NextPVR itself has proven that to me time and time again. I've tried my best to fool proof it by ensuring that it can only run one instance at a time and always run with administrator privileges so it can successfully restart the recording service, but still, be wary.
If anything does go wrong, please let me know in a reply to this thread and I'll do my best to fix it in the code and upload a new version.
If you have any suggestions on how I can further improve this application and any new features I can add to it, please don't hesitate to let me know in a reply to this thread.
Installation is simple. Just extract the contents of the ZIP file to the directory of your choice, and begin running the application with administrator privileges. It should ask you for admin privileges from the start, but if it doesn't, it will simply refuse to run, and you'll have to right click it and choose Run As Administrator.
If you want, you can also right click the executable and choose Create Shortcut, and then move the created shortcut file into either
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
or
C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
in order to get it to start up at the time you start your computer so that it can monitor NextPVR's recording service right from the start.
EDIT 9/23/2019: Added SecsToStart to the configuration file that comes with the application so that the seconds it waits at startup before monitoring can be adjusted for when it's run from Startup on computers where NextPVR takes longer than usual to start its recording service itself.
EDIT 9/24/2019: Added a "Backup NextPVR Logs Now" button so that users can backup NextPVR's logs into a separate timestamped button at any time with just a single click, in case they need to backup the logs for another reason besides the recording service crashing.
Since this is a change to the GUI, I think it warrants a new version, Version 1.1, which can be downloaded below.
EDIT 9/29/2019: Improved the internal handling of the application, so that its GUI is no longer stuck frozen and unusable while waiting on initial startup. These improvements are in version 1.1 only, so I'm removing version 1 now.