Integrating NextPVR Recordings into Main Library

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
pkscout Offline
Posting Freak
Posts: 1,139
Joined: Jan 2011
Reputation: 23
Location: Honolulu, HI
Post: #1
I've been using ArgustTV for quite awhile (until the recording system imploded after a reboot and couldn't talk to the tuners anymore). I just switched to NextPVR, and one of the things I really wanted to have back was a way to integrate NextPVR recordings into the main library the way I did with ArgusTV.

It took little doing, but I found a solution that seems to work well, so I thought I'd share.

1- Adding Recording Directories to NextPVR/XBMC
I added a TV Shows directory and Movies directory to NPVR. I then added those two directories as sources in XBMC. Now when I schedule a recording, I tell it in which directory to place the recording.

2- Renaming Files
NextPVR files aren't named in a format XBMC understands. I found a utility called imageGrabLite that will rename those files during post processing:

http://www.gbpvr.com/nwiki/pmwiki.php?n=...geGrabLite

3- Triggering an XBMC Scan
This one ended up being the trickiest, as I could never get a curl call to work during post processing that would trigger a library update just on the directory in which the finished recording resided. So what one line of batch code couldn't do, 100 or so lines of python code did. Wink

https://github.com/pkscout/trigger.xbmcs...master.zip

There's a read me file with the script that will explain how to install it and use it. It does require python 2.7.x or later and the requests module. The script has some additional renaming options for some problematic files (mostly local and national news).

Lastly, here's my NPVR PostProcessing.bat file with the imageGrabLite commands that seem to generate the most success.
Code:
rem calls imageGrabLite, which renames file to XBMC standard
"C:\Program Files\NPVR\imageGrabLite.exe" --oid %3 --rename --zap2it
rem use python script to generate JSON call to have XBMC update the library from directory of the just converted file
"C:\Python27\python.exe" "C:\CustomApps\trigger.xbmcscan\default.py" %1

I hope someone else finds this useful.
find quote
emveepee Offline
Fan
Posts: 311
Joined: Jul 2012
Reputation: 0
Post: #2
I would suggest adding this rule to advancedsettings.xml

Code:
<tvshowmatching action="prepend">
      <regexp>[\\/\._ -](20[0-9]{6})_.+\.ts</regexp>  <!-- Match NextPVR date as a season -->
</tvshowmatching>
to allow general shows to be scanned without renaming.

Martin
(This post was last modified: 2014-05-18 20:15 by emveepee.)
find quote
pkscout Offline
Posting Freak
Posts: 1,139
Joined: Jan 2011
Reputation: 23
Location: Honolulu, HI
Post: #3
On the off chance anyone downloaded the script in the last few hours, you might want to download it again. The script will now take a json file (see readme.txt for format) that has a list of episodes and use the information to rename files using the show.SxxExx.title.ext format. I added this because it looks like imageGrabLite can't find shows on thetvdb.com if the episode doesn't have a title *and* the air date on thetvdb.com doesn't match the record date. In the Flesh on BBC America happens to fall into this category.
(This post was last modified: 2014-05-18 21:30 by pkscout.)
find quote
donbrew Offline
Junior Member
Posts: 33
Joined: Oct 2013
Reputation: 0
Post: #4
Why not just use the Watchdog add-on? Did I miss something?
find quote
pkscout Offline
Posting Freak
Posts: 1,139
Joined: Jan 2011
Reputation: 23
Location: Honolulu, HI
Post: #5
I started with that, but it appeared watchdog was doing a complete library update rather than just updating the directory where the new file was. Watchdog also seemed to trigger when a new recording file was created, and since the file never has the right name until after imageGrabLite runs, nothing got into the library.

Plus, I had to do some post work on certain files imageGrabLite couldn't handle, so I just built it into one script.
find quote
klausindc Offline
Junior Member
Posts: 11
Joined: Aug 2014
Reputation: 0
Post: #6
HI pkscout,

Three things.

First, thanks very much for your work and making it available.

I have two minor problems. I am still a newbie and it took me a long time to get it up and running and I am still trying a (last) few tweaks to make it look and work perfect.

When I record a new program (Friends e.g.) it is not integrated into the main library, I have to navigate to the NPVR folder within XBMC and do a scan for new content on the Folder containing Friends. After this it will be integrated to the main library and any new episode of Friends will automatically be added to the main library. Am I doing something wrong in the initial setup or is it supposed to be like this?

The main reason for using your setup is so my wife can watch her recorded Judge Judy episodes from the main library (I have it set so it keeps 7 days of recordings). It does not always work with --rename --zap2it so I use --nfo instead since that seems to work each time. However, that generates a lot of folders (seasons) and files in addition to the real recording. Is there any (easy) way to generate a simple list with only the real recordings?

If you can point me in the right direction(s) that would be great.

Thanks very much,
Klaus

I am using Comskip first, followed by your commands in a PostProcessing.bat file

@echo off
cd /d "C:\comskip"
hiderun comskip %1
rem calls imageGrabLite, which renames file to XBMC standard
"C:\Program Files (x86)\NPVR\imageGrabLite.exe" --oid %3 --rename --zap2it (or --nfo)
rem use python script to generate JSON call to have XBMC update the library from directory of the just converted file
"C:\Python27\python.exe" "C:\trigger.xbmcscan\default.py" %1
find quote
mzup Offline
Member
Posts: 84
Joined: Jul 2011
Reputation: 0
Post: #7
(2014-05-18 05:32)pkscout Wrote:  "C:\Python27\python.exe" "C:\CustomApps\trigger.xbmcscan\default.py" %1

What is the %1 passing in this line? Is it the video name or something else?

I do all my commercial cutting and library updating overnight and I move the finish product to the video location in Kodi. So I didn't know if running this in postprocess makes sense or do it in my own batch file that runs overnight.

thanks for the work though. This is something that has made my life a lot easier in terms of having videos show up correctly in the library.
find quote
pkscout Offline
Posting Freak
Posts: 1,139
Joined: Jan 2011
Reputation: 23
Location: Honolulu, HI
Post: #8
(2014-10-08 19:32)mzup Wrote:  
(2014-05-18 05:32)pkscout Wrote:  "C:\Python27\python.exe" "C:\CustomApps\trigger.xbmcscan\default.py" %1

What is the %1 passing in this line? Is it the video name or something else?

I do all my commercial cutting and library updating overnight and I move the finish product to the video location in Kodi. So I didn't know if running this in postprocess makes sense or do it in my own batch file that runs overnight.

thanks for the work though. This is something that has made my life a lot easier in terms of having videos show up correctly in the library.

%1 is the full path to the video file including it's name. The script assumes that the file path is the standard NPVR one, which means the name of the show is the directory just before the file name. As long as your commercial cutting software either leaves the new file in the same directory or uses a naming structure that matches that, my script should work just fine.
find quote