-
Notifications
You must be signed in to change notification settings - Fork 0
Configuring trigger.kodiscan
Start by creating a file called settings.py
in the trigger.kodiscan data
folder (if the folder doesn't exist, you should create it). All settings are in setting_name = value
(for numbers) or setting_name = 'value'
(for strings) format unless otherwise noted.
If you are running Kodi, the DVR, and the script all on the same machine, there are only a couple of things you should need to configure for the script to work correctly.
tv_dir (default TVShows
)
The name of the directory where all your TV shows live.
On NextPVR, if you set a PIN, you also need to add it.
dvr_auth (default 0000
)
Depending on your setup, there are other settings you might need to add to your settings file.
kodi_source_root (default ''
)
If you are using a shared Kodi database and storing your recordings on a NAS, you need to tell the script what your Kodi instances expect for a source URL (like smb://
or nfs://
). Here are some examples of how to figure out what to put in this setting.
Note: If you are using path substitutions on multiple Kodi instances this script probably won't trigger the scan properly. You can try using a local file path in this setting, but all Kodi instances must have the same local source path they are using for the substitution comparison. And honestly, it probably won't work if you have Windows clients using path substitution (Windows file system path delimiters aren't the same as what are used for URLs).
TV Show source defined as: nfs://172.16.1.5/dvr_media/NextPVR/TVShows/
Movie source defined as: nfs://172.16.1.5/dvr_media/NextPVR/Movies/
kodi_source_root = 'nfs://172.16.1.5/dvr_media/NextPVR/'
TV Show source defined as: smb://172.16.1.5/dvr_media/NextPVR/TVShows/
Movie source defined as: smb://172.16.1.5/dvr_media/NextPVR/Movies/
kodi_source_root = 'smb://172.16.1.5/dvr_media/NextPVR/'
narrow_time (default True
)
When generating thumbnails, by default the script only looks at a small part of the video file near the beginning to generate thumbnails (so they aren't too spoilery). If you turn this off the script will pick a random frame from the entire length of the video.
Note: This is a boolean value, so it needs to be either True
or False
. No quotes, and capitalization matters.
narrow_time_start (default 4
)
The beginning time (in minutes) of the window for generating a thumbnail.
narrow_time_end (default 9
)
The end time (in minutes of the window for generating a thumbnail.
custom_narrow (default {}
)
You can define custom narrowing windows for some (or all) of your shows separately. Helpful for having a different narrowing window for 30 minute and 60 minute shows.
Note: This is a Python dict. Please see example below. Also, the show name must match the FOLDER name created by the DVR, so if the show name has any illegal characters, the DVR would have created a folder with a slightly different name. For example, on Windows S.W.A.T.
isn't a legal folder name, so the folder is S.W.A.T
(note the lack of period at the end). You need to use the folder name in this dict for things to work right.
custom_narrow = { 'S.W.A.T':(9,12),
'Shadowhunters':(8,10) }
begin_pad_time and end_pad_time (default 0
)
If you pad your recordings you can add begin and end pad times so that the automatic thumb generation doesn't accidentally generate a thumb from a part of the video that isn't actually part of the show.
scan_delay (default 0
)
Sometimes Kodi doesn't load the thumbnail if the scan happens too soon after it was created, so if you need to you can delay the scan by this number of seconds to help with this.
double_tap (default False
)
Sometimes Kodi really doesn't want to load thumbnails the first time a show is scanned. Setting this option to True
will tell the script to do a library update twice. That seems to take care of the problem.
Note: This is a boolean value, so it needs to be either True
or False
. No quotes, and capitalization matters.
abort_time (default 30
)
The amount of time (in seconds) the script will wait for another instance of itself to finish before giving up.
remotekodilist (default=[]
)
If you have more than one Kodi installation around the house, you can have the script update them all. Even if you are using a shared Kodi database, the update will force update the home screen widgets.
Note: This is a Python list. Actually, it's a list of dicts, so it's even more complicated than that. Please see example below.
remotekodilist = [
{'kodiuri':'172.16.1.3'},
{'kodiuri':'172.16.1.10'}
]
gen_thumbs (default True
)
Turns the automatic thumbnail generation on and off.
Note: This is a boolean value, so it needs to be either True
or False
. No quotes, and capitalization matters.
comskip_check (default True
)
Turns the option to use Comskip data to miss commercials when generating the thumbnail on and off.
Note: This is a boolean value, so it needs to be either True
or False
. No quotes, and capitalization matters.
comskip_padding (default 10
)
If the selected frame for the thumbnail is in a commercial break, the script will forward to the end of the commercials and then forward this many sections into the next scene of the show.
video_exts (default {'.ts', '.mp4', '.wmv', '.m4v', '.mkv', '.mpg'}
)
A list of file extensions the script treats as video files.
Note: If you add this to the settings, you need to include the full default list in addition to the ones you add.
thumb_exts (default {'.png', '.jpg'}
)
A list of file extensions the script treats as thumbnail images.
Note: If you add this to the settings, you need to include the full default list in addition to the ones you add.
protected_files (default {'tvshow.nfo', 'poster.jpg', 'poster.png', 'banner.jpg', 'banner.png', 'fanart.jpg', 'fanart.png', 'folder.jpg', 'folder.png'}
)
A list of files the script knows not to delete during it's clean up routine.
Note: If you add this to the settings, you need to include the full default list in addition to the ones you add.
log_backups (default 7
)
The number of days of logs to hold onto until the script starts deleting them.
debug (default False
)
When enabled, the script will log a ton of information to the log. Useful if troubleshooting.