# NextPVR recordings

**URL:** <https://community.openhab.org/t/nextpvr-recordings/26251>\
**Category:** Other\
**Tags:** database, sqlite, nextpvr\
**Created:** [April 6, 2017, 6:20pm UTC](https://community.openhab.org/t/nextpvr-recordings/26251 "2017-04-06T18:20:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikaelgu](https://community.openhab.org/user_avatar/community.openhab.org/mikaelgu/32/37407_2.png) [@mikaelgu](https://community.openhab.org/u/mikaelgu)\
**Post date:** [April 6, 2017, 6:20pm UTC](https://community.openhab.org/t/nextpvr-recordings/26251/1 "2017-04-06T18:20:27Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![psyciknz](https://community.openhab.org/user_avatar/community.openhab.org/psyciknz/32/17347_2.png) [@psyciknz](https://community.openhab.org/u/psyciknz)\
**Post date:** [April 7, 2017, 4:15am UTC](https://community.openhab.org/t/nextpvr-recordings/26251/2 "2017-04-07T04:15:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mikaelgu](https://community.openhab.org/user_avatar/community.openhab.org/mikaelgu/32/37407_2.png) [@mikaelgu](https://community.openhab.org/u/mikaelgu)\
**Post date:** [April 7, 2017, 6:33am UTC](https://community.openhab.org/t/nextpvr-recordings/26251/3 "2017-04-07T06:33:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![psyciknz](https://community.openhab.org/user_avatar/community.openhab.org/psyciknz/32/17347_2.png) [@psyciknz](https://community.openhab.org/u/psyciknz)\
**Post date:** [April 7, 2017, 6:46am UTC](https://community.openhab.org/t/nextpvr-recordings/26251/4 "2017-04-07T06:46:22Z")

</div>

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](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>
> 
> ```

---

<div class="post-metadata">

**Author:** ![psyciknz](https://community.openhab.org/user_avatar/community.openhab.org/psyciknz/32/17347_2.png) [@psyciknz](https://community.openhab.org/u/psyciknz)\
**Post date:** [April 7, 2017, 7:05am UTC](https://community.openhab.org/t/nextpvr-recordings/26251/5 "2017-04-07T07:05:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mikaelgu](https://community.openhab.org/user_avatar/community.openhab.org/mikaelgu/32/37407_2.png) [@mikaelgu](https://community.openhab.org/u/mikaelgu)\
**Post date:** [April 7, 2017, 1:15pm UTC](https://community.openhab.org/t/nextpvr-recordings/26251/6 "2017-04-07T13:15:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![psyciknz](https://community.openhab.org/user_avatar/community.openhab.org/psyciknz/32/17347_2.png) [@psyciknz](https://community.openhab.org/u/psyciknz)\
**Post date:** [April 7, 2017, 8:23pm UTC](https://community.openhab.org/t/nextpvr-recordings/26251/7 "2017-04-07T20:23:57Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![mikaelgu](https://community.openhab.org/user_avatar/community.openhab.org/mikaelgu/32/37407_2.png) [@mikaelgu](https://community.openhab.org/u/mikaelgu)\
**Post date:** [April 8, 2017, 8:13am UTC](https://community.openhab.org/t/nextpvr-recordings/26251/8 "2017-04-08T08:13:20Z")

</div>

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

```csv
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:

```auto
<?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
