NextTool - sub3/NextPVR GitHub Wiki
NextTool is a command line utility designed to allow a user to:
- migrate their recordings from one version of NextPVR to another
- export recording and metadata information
- import external recordings and/or metadata into NextPVR.
- clean up media/shows art folder
- queue processing of recordings
The current version of NextTool is 2.2.1
Older versions can be downloaded in Change History
Extract all the contents of the zip file to the NextPVR Program Folder :
- Windows: C:\Program Files\nextpvr\
- Linux: /opt/nextpvr/system/
- Mac: tba
- Docker: /apps
On Windows
Delete NextTool.runtimeconfig.json and NextTool.deps.json before running NextTool for the first time
On non Windows platforms
- delete NextTool.exe (optional)
- create soft links from the program folder to the database compiled library (.so) files. To do this you need the reference the correct .so files, these are:
For x86_64
ln -s runtimes/linux-x64/native/libe_sqlite3.so
ln -s runtimes/linux-x64/native/libSkiaSharp.so
For RaspberryPi OS (64bit)
ln -s runtimes/linux-arm64/native/libe_sqlite3.so
ln -s runtimes/linux-arm64/native/libSkiaSharp.so
For RaspberryPi OS (32bit)
ln -s runtimes/linux-arm/native/libe_sqlite3.so
ln -s runtimes/linux-arm/native/libSkiaSharp.so
NextTool supports filenames based on formats that NextPVR (and formerly GBPVR) create. Without a supported filename format the recording file won't be imported. These are typically:
- ShowName_YYMMDD
- ShowName_YY-MM-DD
- Showname.S##E##
- Showname.S##E##.Episodename
- Moviename(yyyy)
Supported recording file types are ts, mkv, mp4, avi, mpg and wtv
It may be possible to use other variations of filename/type with NextTool, please raise a Forum post if you have another filename/type you wish to process with NextTool.
Metadata files provide extra information to NextTool / NextPVR such as:
- Filename (including the path of the recording file)
- Channel
- Status
- Start Time
- End Time
- Original Air Date
- Genre(s)
- Cast
... and many more
Metadata may be stored as an XML, NFO or ADS (Alternate Data Stream on Windows) file, usually (but not always) in the same folder as the recording file and have the same file name eg:
Recording File: A.Fistful.of.Dollars.(1964).ts
Metadata File: A.Fistful.of.Dollars.(1964).xml
Examples of NextPVR provided XML files can be found in the individual recordings folders. These XML files will only contain details available at the time of recording.
Examples of NFO files (for Kodi) can be found here: Kodi Templates
Alternatively, go to the Settings / General /Export Recordings page in the NextPVR web application. Using this option will export an XML file containing details of all your current recordings held in the NextPVR database.
A good Media Manager utility can help you to name your media collection with supported file names, as well as providing additional metadata in XML and/or NFO formats. You might want to consider these free tools:
Many other Media Managers are also available.
NextTool is NOT integrated with any of these tools but users can use them to clean and edit filenames and populate XML/NFO files that NextTool can use.
BACKUP - Make sure you have a good backup copy of npvr.db3
This can normally be found in the User Data Folder:
- Windows: C:\Users\Public\NPVR-data
- Linux: /var/opt/nextpvr
- Mac: tba
- Docker /config
From the command line, via Windows Terminal or Command Prompt, execute
NextTool {command} {filespec} {update}
From a command line, execute
sudo -u nextpvr /opt/dotnet/dotnet /opt/nextpvr/system/NextTool.dll {command} {filespec} {update}
Change to the NextPVR program folder where you unzipped NextTool, execute
dotnet NextTool.dll {command} {filespec} {update}
In the command lines above, the options are generally as shown below. Any specific variations are detailed with the individual command options:
{command} Choose the required NextTool option for the list below (eg --importxml)
{filespec} Enter your required file path and filename(s), see NextTool Filespec below
(update) This optional parameter is only valid for use with the --media command options. If used the changes identified by the selected --media option will be applied to the selected media files. A further confirmation prompt will be displayed before any update action is actually committed.
Many NextTool options allow an optional filespec. The filespec can be as deep as you want i.e.
C:\Users\Public\Recordings
"C:\Users\Public\Recordings\Films\Flight of the Navigator (1986)"
/home/pi/nas_recordings/Films/
"/home/pi/nas_recordings/Films/The Titfield Thunderbolt (1953)/"
Note Where the {filespec} contains spaces it may be necessary to enclose {filespec} in double quotes ("filespec")
If you don't provide the filespec option you will be prompted to scan the whole filesystem but this is not recommended
Running NextTool without specifying a command option or a filespec will result in a list of command options being displayed:
Option must be: import, mosaic, emby, export, copy, search, file, debug, merge, vod, resetvod, loadxml, writexml, importxml, media, sagetv, tvheadend, hddvr, resize
NextTool is under development so other options may be shown from time to time.
--import {filespec} Uses the {filespec} to find all recording files as the import source and adds any extra information from matching metadata files if available. If there are no matching metadata files, the import process will try to use external metadata sources to provide the metadata for the imported recordings. Only recording files where entries are missing from the database will be imported.
This option directly updates the NextPVR database, make sure you have a good database backup before using this option
--file {filespec} Use with CAUTION This option can be used to import any single file, where the {filespec} includes the full path and name of the file.
This can allow the filename in the database to be replaced with a filename having a different extension, even if and XML/NFO files do not exist.
The file to be imported can be used to update an existing recording description and other metadata from XML/NFO formatted data. If the filename to be imported is not in a supported NextPVR filename format then an accompanying XML or NFO metadata file will also be needed to provide the information need to process the recording file.
If the file exists but the file has a different extention, ie .wtv to .mp4, the filename will be replaced.
This option directly updates the NextPVR database, make sure you have a good database backup before using this option
--importxml {XML filename} Will run the same API as the NextPVR WebApp uses to import an individual XML file.
This option directly updates the NextPVR database, make sure you have a good database backup before using this option
--merge {old database filespec} Copies the metadata from the {old database filespec} to the current NextPVR database.
It can used for moving between operating system platforms or to a new PC. Matches are based on the recording filename without a path. So, for example, if you have a recording "oldpath/Cruella (2021).ts" in the {old database filespec} all the metadata for this recording in the old database will be added to "newpath/Cruella (2021).ts" entry in the current version database. There is no need for the XML files or other metadata files to be present.
--copy Specifically used to help WINDOWS users only migrate from NextPVR v4 to v5/v6 and will copy all file rows with metadata from the v4 database to the new v5/v6 database as is. This provided to help users upgrading from v4. The following database locations are hardcoded into this option so {filespec} is NOT needed.
Old v4 database resides in: C:/Users/Public/NPVR/npvr.db3
New v5/v6 database resides in: C:/Users/Public/NPVR-data/npvr.db3
An optional database name can be provided as the filespec.
Linux users: whilst this options is specifically for Windows users, a similar result could be obtained by using the merge command above.
--beyondtv {xml filespcedatabase} Copies recording and metadata, where possible, from the provided location to the current NextPVR database. Information on creating this file can be found at BeyondTV Export. The Negotiator can be downloaded from Snapstream Download The tool may have been updated, so you might need to export from the "Recording jobs" tab.
--emby {Emby library database} Copies recording and metadata, where possible, from the provided {Emby library database} location to the current NextPVR database
--hddvr {filespec} Use this option to import metadata from HDHomerun DVR mpeg recording files. In this case, {filespec} is the path to the HDHomerun DVR recording source.
--mosaic {filespec} This will create an XML file for all recordings pointed to by {filespec}. The XML file can then be imported to NextPVR using the NextTool import command (see above)
--sagetv {filespec} Use this option to import metadata from the SageTV database.
Use this page to create an XML file of recordings data from the SageTV web server which can then be used in the command above:
/sage/Search?SearchString=&searchType=TVFiles&Video=on&search_fields=title&TimeRange> =-1&Categories=**Any**&Channels=**Any**&watched=any&dontlike=any&favorite=any&firstr> uns=any&hdtv=any&archived=any&manrec=any&autodelete=any&partials=both&sort1=none&sor> t2=none&grouping=None&pagelen=inf&xml=yes
--tvheadend {filename} Use this option to import metadata from tvHeadEnd recording files.
{filename} can be created anywhere but the recording names from TVHeadend need to be in a valid NextPVR filename format (see above).
To get the TVHeadend recording JSON file use:
curl http://user:password@tvh:9981/api/dvr/entry/grid_finished?limit=10000 -o filename
--wmc There is no specific option for Windows Media Centre but importing files will read .wtv files with embedded meta data
--media Use the following options to manage artwork in the media/shows folder.
In the following --media suboptions you can use the optional {update} operation. If used, the update operator must be in lower case and, as this operator actually carries out the changes specified, you will be prompted:
Enter Yes to continue to update
You must specifically enter the word 'Yes' (without quotes and in mixed case) to continue with the update, any other response (even 'yes') will abort the operation.
--media check {update} Create a detailed log of what could happen. Create a Forum posting, including the log file, if there is anything unexpected in the log file.
--media sdempty {update} Remove all empty ScheduleDirect catalogs if art wasn't available originally
--media active {update} Remove all catalogs and art for shows not in the EPG, or recordings and recurring
--media purge {update} Remove all catalogs and art not in recordings and recurring
--media covers {update} Create posters and import existing art not in a catalog. If you create the folder /media/dryrun, then when using the update suboption you can see the new artworks and catalogs that will be created when the command is run without the update sub-option.
Exception: empty ScheduleDirect catalogs will be deleted.
--media uncover {update} Remove all generic art created using the --media covers option.
NextPVR can be easily customized to provide both parallel processing and post processing of recording to meet individual needs. More information on script usage can be found here Script files
One issue with this is these processes can be CPU intensive and could interfere with other operations when usage is heavy. This function allows you to defer these process to a different time, typically after an EPG update.
--queue {recording_id} The recording_id from NextPVR
--process run QueuedProcessing.bat or QueuedProcessing.sh from the NextPVR Data/scripts folder. The parameters passed are the same as Parallel and Post Processing with an additional 6th parameter for the folder of the recording.
Example usage would be
-
rename your ParallelProcessing script to QueuedProcessing
-
create a new ParallelProcessing script with one line entry to call NextTool
Windows
"C:\Program Files\NextPVR\NextTool" -queue %3
Linux (deb installer)
#!/bin/bash /opt/dotnet/dotnet /opt/nextpvr/system/NextTool.dll --queue $3
-
create or update you PostUpdateEPG script to call the Queued Processing script
Windows
"C:\Program Files\NextPVR\NextTool" -queue process
Linux (deb installer)
#!/bin/bash /opt/dotnet/dotnet /opt/nextpvr/system/NextTool.dll --queue process
--makeunique Add unique id to recordings from EPG data. After importing recordings may have season/episode information or movie years but not a unique id. If the EPG is Schedules Direct based the unique id will be moved to the recording. This can be run on-demand but it should be run daily prior to scheduling recordings in the PostLoadEPG script
--export {filespec} Uses the {filespec} to create a NextTool.xml file in the data directory which allows the metadata to be edited if necessary before importing via the WebApp Import XML feature.
--vod Renames VOD files to use a standard NextPVR filename format. Typical usage would be via the PostVODProcessing script with:
--vod %1 or --vod $1
--resize Adds the filesize to the NextPVR recording database, this is a new field added to recent versions of NextPVR v5. Kodi (Matrix and above) should show the recording size in the Information panel however it might be necessary to enable the feature in the pvr.nextpvr display settings. The Size setting is disabled by default in Kodi is as without using th e--resize option all old recordings in the database will have default size of zero which will require Kodi to try to get the size from the filesystem.
--debug {filespec} This option creates a file called NextTool.txt in the User Data Folder. It will create a list of all the media files it finds in {filespec} that aren't in the NextPVR database.
This is generally a support function, if recording files are not processed as expected create a NextPVR Forum post and attach the NextTool.txt file for analysis. Any recording files which have the comment 'Not parsed' in the NextTool.txt file will not be valid for any other NextTool action.
Details of each run of NextTool can be found in its log files (NextTool.log), these can be found as detailed here
The three latest versions of the processing log files are kept. Please Note: as these logfiles are stored in the same location as the NextPVR system log files they will be included in any zipped logfiles sent to NextPVR for analysis and so may make the exported zipped logfiles archive larger than expected.ol.log), these can be found as detailed here
The three latest versions of the processing log files are kept. Please Note: as these logfiles are stored in the same location as the NextPVR system log files they will be included in any zipped logfiles sent to NextPVR for analysis and so may make the exported zipped logfiles archive larger than expected.
Page Status
Authors: Martin Vallevand, Chris Metcalfe
Publication Date: 5 May 2022
v.2.3.0 2023-06-25 Download
- Added queued processing
- Added BeyondTV importing
- Miscellaneous changes
v.2.2.1 2022-11-22 Download
- Fixed --copy function
- Added optional filespec to -c-opy
v.2.1.8 2022-09-01 Download
- NextPVR v6 compatible
- New function makeunique
- Import from records-backup format (if used in error)
- Changes in unique id importing
- Use UTC for import times
v.1.10 2022-05-14 Download
- Remove dependency on Mediainfo.DotNet.Wrapper.dll
v1.1.8 Released 2022-06-05