NextPVR recordings

Hi,

I’m looking into getting info of recordings from NextPVR into OpenHAB. Now, I’ve been playing with OpenHAB for about a week, so I’m still very new to it all, so I might be missing something obvious… Doing some research I’ve come up with the following options in order of preference:

  1. Access NextPVR SQLite database and query info directly from there. I’d prefer to do it this way so that the info is always up to date and as accurate as possible. Would it maybe be possible to use persistence to accomplish this?

  2. NextPVR has RSS feeds for the info. Tried using the Feed binding, but didn’t get it to work. Also the info isn’t as well formed and complete.

  3. There’s also a web interface which maybe could be scraped for the info or maybe even a similar query to the database could be done and output into a suitable format.

  4. As a last resort just show said page in a tile in HABPanel. Not very elegant, but as a last resort…

There’s a web service call which returns an xml file that would better suit you.

Http://(server):8866/services?method=recording.list&filter=Ready&sid=(clientid)

Much easier than scraping a page.

Thank you, I didn’t know that existed! I tried the URL, but I get an xml with “Invalid Session”, I assume it requires authorisation of some sort.

Shouldn’t do, the clientid does need to be unique though.

I just did this on my server: http://morgoth.andc.nz:8866/services?method=recording.list&filter=Ready&sid=abcd
And got a result

<rsp stat="ok">
<recordings>
<recording>
<id>27014</id>
<recurring_parent>246</recurring_parent>
<name>Kiwi Living</name>
<desc>
Find out how to inexpensively update your living space and create shelving for your favourite items! Plus, Mike goes all out to create a restaurant quality special occasion brunch.
</desc>
<subtitle/>
<start_time>22/04/2016 7:30:00 p.m.</start_time>
<start_time_ticks>1461310200</start_time_ticks>
<duration>01:00</duration>
<duration_seconds>3600</duration_seconds>
<status>Failed</status>
<reason>Recording service not running at recording time</reason>
<quality>QUALITY_DEFAULT</quality>
<pre_padding>5</pre_padding>
<post_padding>5</post_padding>
<red>False</red>
<blue>False</blue>
<green>False</green>
<yellow>False</yellow>
<channel>TV ONE</channel>
<channel_id>7224</channel_id>
<reason>Recording service not running at recording time</reason>
<recurring_parent>246</recurring_parent>
<recurring>true</recurring>
</recording>

BTW, that’s a local resolving address for me, not public. That’s just how I name my servers.

Do confirm that the pending recordings are shown properly when accessed via the local network. Thank you again for pointing me toward the right direction! Now on to learn xslt…

Mikael

There’s different filters - at the moment you’re just getting ready.

You’ll probably have to go over to nextpvr.com. And search the forums for the call. It should be there. =Pending should work though. But there are others.

Works perfectly!
Here’s an example what I’m using:

String RecordingName1 "Recording 1 Name"  {http="<[http://serverip:port/services?method=recording.list&filter=Pending&sid=ohab5:10000:XSLT(nextPVRName1.xsl)]"}

and the nextPVRName1.xsl:

<?xml version="1.0"?>
<xsl:stylesheet 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

        <xsl:output indent="yes" encoding="UTF-8" method="text" omit-xml-declaration="yes" />

    <xsl:template match="rsp/recordings">
			<xsl:value-of select="translate(recording[1]/name, '¤¶Ã', 'äö')" />
    </xsl:template>
</xsl:stylesheet>

There seems to be a problem with coding of the nordic characters in the http-binding as they appear as rubbish, therefore the translate.
Obviously as meny items are loaded from the same page, it would be beneficial to cache it, and that’s on the todo list. Also, giving the number of the recording the [1] as a parameter to the XSLT would be nice, but I don’t know if it’s possible.

Mikael