|
SageTV v9 Customizations This forums is for discussing and sharing user-created modifications for the SageTV version 9 application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss plugins for SageTV version 9 and newer. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||||
|
||||
What plug-in or API can identify when SageTV is recording?
I have a scheduled task that performs a reboot of the SageTV server every day at 4:30am for stability and reliability. It is rare, but occasionally something records at that time, resulting in a gap or failure.
Is there any API or plug-in that I could call from the scheduled task CMD file to cancel the reboot if a recording is active?
__________________
HD300 extender with (2020 New Build) SageTV 64 bit V9.2.2.903 (service mode), Running on Windows 10 (64 bit), Intel Core i7-10700K CPU, 16G RAM, GIGABYTE Z490 UD motherboard. NVidia GTX1650 Super; Viewsonic LCD on one output and Mitsubishi WD57734 HDTV via DVI/HDMI on other output. HDHomeRun HDHR5-4US tuner, Hauppauge "Siena" 1512 HD-PVR2 connected to Cisco Cable modem from Spectrum, tuned with USB-UIRT. |
#2
|
|||
|
|||
If you have the web interface installed, you could check the XML files it produces to verify if there is anything currently recording.
http://YourIP/sage/Home?xml=currrecording This XML file will list any currently recording shows. If you don't want to actually process the XML, you could just check the file size (it will be much smaller if nothing is recording). http://YourIP/sage/Home?xml=nextrecordings This XML file will list the next scheduled recording(s). If you want to get fancy, you could also check this file to make sure there aren't any recordings scheduled within minutes of your planned reboot. |
#3
|
|||
|
|||
There is an additional API call that was created by Slugger that tested if anything was recording. Here wrote some useful addon extensions to the API that allowed you to do things like determine what type of extender you had, etc. Unfortunately I can't find them now.
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server |
#4
|
|||
|
|||
Quote:
Your post from 11/18: https://forums.sagetv.com/forums/sho...4&postcount=16 |
#5
|
||||
|
||||
I'm not sure - what is "the web interface"?
I have these plugins: Apache Mina Core by ShadeBlue log4j by stuckless sagex-api by by stuckless slf4j by stuckless JSON.org by Slugger And DarkSky and the "jacksons" for weather... Which of those should I explore? PS I tried "http://YourIP/sage/Home?xml=currrecording" (of course with my server's IP inserted) and got a timeout. Tried it with localhost, too, and also timeout.
__________________
HD300 extender with (2020 New Build) SageTV 64 bit V9.2.2.903 (service mode), Running on Windows 10 (64 bit), Intel Core i7-10700K CPU, 16G RAM, GIGABYTE Z490 UD motherboard. NVidia GTX1650 Super; Viewsonic LCD on one output and Mitsubishi WD57734 HDTV via DVI/HDMI on other output. HDHomeRun HDHR5-4US tuner, Hauppauge "Siena" 1512 HD-PVR2 connected to Cisco Cable modem from Spectrum, tuned with USB-UIRT. Last edited by timg11; 04-17-2020 at 11:30 AM. |
#6
|
|||
|
|||
Yes - that's it. These three calls would be helpful:
Code:
/** * Check if there is something currently recording * @return True if there is something currently recording or false otherwise */ static boolean isSomethingRecording() { return Global.GetCurrentlyRecordingMediaFiles().size() > 0 } /** * Check if media is being played somewhere on any connected device * @return True if media is being played on any connected device or false otherwise */ static boolean isMediaPlaying() { def connected = [] connected += Global.GetUIContextNames().toList() connected += Global.GetConnectedClients().toList() for(def c : connected) if(MediaPlayerAPI.GetCurrentMediaFile(new UIContext(c)) != null) return true return false } /** * Get the number of seconds until the start of the next scheduled recording * @return The number of seconds until the next scheduled recording; returns Long.MAX_VALUE if there are no scheduled recordings */ static long getSecondsUntilNextRecording() { def sched = Database.Sort(Global.GetScheduledRecordings(), false, "GetScheduleStartTime") def now = System.currentTimeMillis() if(sched.size() == 0) return Long.MAX_VALUE def start = 0 for(def i = 0; i < sched.size(); ++i) { def time = AiringAPI.GetScheduleStartTime(sched[i]) if(time > now) { start = time break } } if(start == 0) return Long.MAX_VALUE return (start - now) / 1000L }
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server |
#7
|
|||
|
|||
It's the plugin called "SageTV Web Interface". It gives you a webpage for managing SageTV recordings/schedule.
Install that and configure it (you'll need to give it a username, password, and port number). Then you will be able to use the XML URL's I provided. |
#8
|
||||
|
||||
@peternm22, thanks I'll try that first.
@wayner, I'm still curious about the code you posted containing: Code:
static boolean isSomethingRecording() I followed the link below and ended up at Slugger's Utility Helpers and Global Helpers https://searchcode.com/codesearch/view/1107144/ and https://searchcode.com/codesearch/view/1107145/ That code looks like it is on the SageTV side, but I need something that runs as a client to access the API? Ultimately, I would build a Windows console executable "IsSageRecording.exe" that would return 1 if yes and 0 if no.
__________________
HD300 extender with (2020 New Build) SageTV 64 bit V9.2.2.903 (service mode), Running on Windows 10 (64 bit), Intel Core i7-10700K CPU, 16G RAM, GIGABYTE Z490 UD motherboard. NVidia GTX1650 Super; Viewsonic LCD on one output and Mitsubishi WD57734 HDTV via DVI/HDMI on other output. HDHomeRun HDHR5-4US tuner, Hauppauge "Siena" 1512 HD-PVR2 connected to Cisco Cable modem from Spectrum, tuned with USB-UIRT. |
#9
|
||||
|
||||
@peternm22, I'm working on installing "SageTV Web Interface"
First I went to the SageTV GUI on the server machine, and found SageTV Web Interface among the list of all available plugins. I installed it without any issue. I tried accessing with http://192.168.1.110/sage/Home?xml=currrecording and http://localhost/sage/Home?xml=currrecording, but still get timeouts. "Unable to connect Firefox can’t establish a connection to the server at localhost." So I look deeper into the plugin for settings, etc. No Settings. Close, Details, Uninstall, and View Web Sites. Trying Web Site 1, it takes me to "http://tools.assembla.com/sageplugins/wiki/WebServer" which is 404. Trying Web Site 2, I I go to "http://www.geektonic.com/2008/03/sag...ol-sagetv.html" I follow "BASIC INSTALLATION INSTRUCTIONS" since the link to detailed instructions is also 404. It takes me to get files at SourceForge I download jetty-starter-jars-2.3.0.14.zip. Latest version from March 2011. First red flag- the geektonic page says "The download is just under 900K in size and is a java web server embedded into the SageTV process so IIS or Apache needed" The file I downloaded was 5215K in size. Second red flag - IIS or Apache needed? My SageTV server is a Win 7 Pro machine. I have a Windows 2008r2 server, but it is physically separated from the HDPVR2 and the HTPC setup - impractical for USB and HDMI. Finally the Geektonic page shows a Windows Installer dialog - However the downloaded zip file contains nothing but JAR files. There is no Windows installer of type exe or msi. So I'm not sure where to go next - any suggestions?
__________________
HD300 extender with (2020 New Build) SageTV 64 bit V9.2.2.903 (service mode), Running on Windows 10 (64 bit), Intel Core i7-10700K CPU, 16G RAM, GIGABYTE Z490 UD motherboard. NVidia GTX1650 Super; Viewsonic LCD on one output and Mitsubishi WD57734 HDTV via DVI/HDMI on other output. HDHomeRun HDHR5-4US tuner, Hauppauge "Siena" 1512 HD-PVR2 connected to Cisco Cable modem from Spectrum, tuned with USB-UIRT. |
#10
|
||||
|
||||
Still working on this.
Found the SageTV Web Interface V2 for Jetty thread. I was not looking there at first since the forum says "Use this forum to discuss customizations for SageTV version 6 and earlier" Quote:
Code:
http://localhost:8080/sage/Home However, the Plugin installer did not ask me to set the port 8080 or ask to set any credentials when installing... Off to the wayback machine to try and find answers...
__________________
HD300 extender with (2020 New Build) SageTV 64 bit V9.2.2.903 (service mode), Running on Windows 10 (64 bit), Intel Core i7-10700K CPU, 16G RAM, GIGABYTE Z490 UD motherboard. NVidia GTX1650 Super; Viewsonic LCD on one output and Mitsubishi WD57734 HDTV via DVI/HDMI on other output. HDHomeRun HDHR5-4US tuner, Hauppauge "Siena" 1512 HD-PVR2 connected to Cisco Cable modem from Spectrum, tuned with USB-UIRT. |
#11
|
||||
|
||||
The Jetty Server Basic Configuration page (from archive.org) says:
"The Jetty plugin is configured using the JettyStarter.properties file that is unzipped into the SageTV installdirectory" Unfortunately, there is no file with the name "JettyStarter.properties" in the SageTV installdirectory. It does not exist anywhere on the entire machine. As I poke around, it looks like I installed Jetty sometime in the past (or it was installed as a dependency for another plugin). There is a jetty folder in "C:\Program Files\SageTV\SageTV", dated 2018. the \jetty\etc folder is dated 2011, as are the files it contains. Edit - further searching brought me to this thread on the Jetty Password. I was able to locate the SageTV\jetty\etc\realm.properties file and reset the password. Now I can access the server and download the XML file from Code:
http://localhost:8080/sage/Home?xml=currrecording
__________________
HD300 extender with (2020 New Build) SageTV 64 bit V9.2.2.903 (service mode), Running on Windows 10 (64 bit), Intel Core i7-10700K CPU, 16G RAM, GIGABYTE Z490 UD motherboard. NVidia GTX1650 Super; Viewsonic LCD on one output and Mitsubishi WD57734 HDTV via DVI/HDMI on other output. HDHomeRun HDHR5-4US tuner, Hauppauge "Siena" 1512 HD-PVR2 connected to Cisco Cable modem from Spectrum, tuned with USB-UIRT. Last edited by timg11; 04-18-2020 at 10:04 AM. |
#12
|
|||
|
|||
Regarding the Web UI - assuming it is installed correctly there are configuration options in the SageTV UI, such as port number, username, password, etc.
I think some of those threads on password may now be deprecated - I don't think that you beed to edit a text file.
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server |
#13
|
|||
|
|||
Quote:
I haven't done much of this stuff in several years and I am not really a programmer but generally the way that you access the API is via Java or Groovy. Groovy is a language that is a superset of Java - so Java code works in Groovy but Groovy code may not work in Java. A SageTV user named Slugger developed a bunch of useful plugins, especially Sage Job Queue (SJQ). He also took over support of the Sage Web Server and made extensions so that you could easily write Groovy code to expand the functionality of the SageTV Jetty web server. I used this to write some code that shows me the status of all of my SageTV extenders. So you could write some code in Java or Groovy that could return you a 1 or 0 or other info. It might require groovy but it wouldn't be a big deal. You would run something like "groovy.exe getrecordingstatus.groovy" and it would execute. Slugger also created a Groovy Development Environment for SageTV But you might want to look into SJQ. It has this exact functionality. For example, in this document (https://sourceforge.net/p/sagetv-add...Sjq4UserGuide/) it says: Quote:
And I am pretty sure that somewhere on the internet there is a full tutorial on using SJQ to do reboots as Slugger did this and provide docs on this. The problem is that lots of things have disappeared over the years. The other issue is that many of these tools are VERY out of date. Like Jetty which is now known as Eclipse Jetty and Groovy is now Apache Groovy Hopefully I didn't confuse you too much.
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server |
#14
|
|||
|
|||
But if you want to do a quick and dirty check on whether something is recording then I would suggest just using the XML file. You could just use curl to hit the XML web page and send the ouptut to a web file. You would then parse the XML file to return a 0 or 1.
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server |
#15
|
||||
|
||||
Quote:
Here's windows CMD code for testing the recording status: Code:
curl -u jettyuser:jettypassword "http://localhost:8080/sage/Home?xml=currrecording" > SageRecStatus.xml grep channelId SageRecStatus.xml if errorlevel==1 goto NotRec echo Recording goto end :NotRec echo Not Recording :end I have tested this as a standalone CMD file, it works. I have also incorporated it into my daily reboot scheduled task. Edit: @Wayner, thank you for the additional information in your post 2 and 3. I didn't refresh the thread while I was replying to the first, and missed them. As you can see, I did your "quick and dirty" approach which seems to be working fine. I will definitely look into SJQv4 the next time I need to automate something. I saved the linked pages in case they are 404 next time I look.
__________________
HD300 extender with (2020 New Build) SageTV 64 bit V9.2.2.903 (service mode), Running on Windows 10 (64 bit), Intel Core i7-10700K CPU, 16G RAM, GIGABYTE Z490 UD motherboard. NVidia GTX1650 Super; Viewsonic LCD on one output and Mitsubishi WD57734 HDTV via DVI/HDMI on other output. HDHomeRun HDHR5-4US tuner, Hauppauge "Siena" 1512 HD-PVR2 connected to Cisco Cable modem from Spectrum, tuned with USB-UIRT. Last edited by timg11; 04-18-2020 at 11:22 AM. |
#16
|
|||
|
|||
Nice work getting that going. As a final precaution you should change your reboot time to something like 4:10 so you don’t stomp on a recording that was going to start right at 4:30.
|
#17
|
|||
|
|||
Quote:
Find the entry that says "Jetty Web Server", click on it and select "Configure Plugin". You can set the username, password and port there. |
#18
|
||||
|
||||
Yes, the time is set to 04:45. I have a backup task scheduled for 05:00, so I picked 04:45 to be sure the system was restarted and still awake then.
__________________
HD300 extender with (2020 New Build) SageTV 64 bit V9.2.2.903 (service mode), Running on Windows 10 (64 bit), Intel Core i7-10700K CPU, 16G RAM, GIGABYTE Z490 UD motherboard. NVidia GTX1650 Super; Viewsonic LCD on one output and Mitsubishi WD57734 HDTV via DVI/HDMI on other output. HDHomeRun HDHR5-4US tuner, Hauppauge "Siena" 1512 HD-PVR2 connected to Cisco Cable modem from Spectrum, tuned with USB-UIRT. |
#19
|
||||
|
||||
Quote:
There was an interesting transformation that occurred during this thread. When I started, I set out to install the "SageTV Web Interface" as recommended by you. There is indeed a plugin called the "SageTV Web Interface", and I installed it. It didn't work, and I started researching, which brought me to many dead links, but eventually connected to the jetty topic. My conclusion is that some time over the past 10 years, the "SageTV Web Interface" turned into or was replaced by Jetty. In my plugins, I still have "SageTV Web Interface" and I also have "jetty Web Server". Apparently the jetty is the one that counts, since it has configuration settings you mention above, that match what I'm seeing for the server authentication and port, while "SageTV Web Interface" has no settings. Is the "SageTV Web Interface" plugin doing anything or should I remove it as a plugin?
__________________
HD300 extender with (2020 New Build) SageTV 64 bit V9.2.2.903 (service mode), Running on Windows 10 (64 bit), Intel Core i7-10700K CPU, 16G RAM, GIGABYTE Z490 UD motherboard. NVidia GTX1650 Super; Viewsonic LCD on one output and Mitsubishi WD57734 HDTV via DVI/HDMI on other output. HDHomeRun HDHR5-4US tuner, Hauppauge "Siena" 1512 HD-PVR2 connected to Cisco Cable modem from Spectrum, tuned with USB-UIRT. |
#20
|
|||
|
|||
If I remember correctly the Jetty web server is a prerequisite to the SageTV Web UI. Jetty was required for other types of services - so you might need it even if you didn't actually use the web UI. There is/was also a mobile UI, SageAlert, BatchMetaDataTools, LivePVRData, etc that were web services and many (or all) of these required Jetty.
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Upgrade to 7 - Plug ins from 6 not showing in plug in list | personalt | SageTV v7 Customizations | 1 | 05-23-2010 11:29 AM |
Can anyone help me identify this icon? | ddikeht | SageTV Customizations | 4 | 08-15-2009 09:10 AM |
Nielm's Recording padding plug-in problem | henk99 | SageTV Customizations | 26 | 10-17-2006 01:00 AM |
pvr-250 driver identify and upd | jsturtevant | Hardware Support | 1 | 01-20-2005 06:53 PM |