-
Notifications
You must be signed in to change notification settings - Fork 9
frontend
Below you see the Dutch/Flemish frontend and you can almost completely copy that. You only have to adapt a few things:
- At line 25/26 you have to adapt for the backend version you are writing the frontend for.
- Al line 30 and further in the Configure class you adapt the values to match your frontend. Most is self explaining.
- First a description as returned by the
--descriptionoption and your frontend version. - self.opt_dict['output_tz'] Follows the naming and directory structure used in Linux, probably at
/usr/share/zoneinfo - self.source_url is the location where your grabber_datafile can be downloaded. If the sourcefiles themselves are somewhere else, that can be set in that file.
- self.datafile is the name of your grabber_datafile with .json appended to it.
- self.update_url is where a user can find updates. It will be mentioned in the log if there are any.
- self.compat_text is the text that will be appended to the xmltvIDs if the user sets the compat flag. It is also settable in your grabber datafile through the compat_text keyword
Next you continue to create a grabber_datafile.
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Python 3 compatibility
from __future__ import unicode_literals
# Modules we need
import sys, locale, tvgrabpyAPI
try:
unichr(42)
except NameError:
unichr = chr # Python 3
# check Python version
if sys.version_info[:3] < (2,7,9):
sys.stderr.write("tv_grab_py_API requires Pyton 2.7.9 or higher\n")
sys.exit(2)
if sys.version_info[:2] >= (3,0):
sys.stderr.write("tv_grab_py_API does not yet support Pyton 3 or higher.\nExpect errors while we proceed\n")
locale.setlocale(locale.LC_ALL, '')
if tvgrabpyAPI.version()[1:4] < (1,0,0):
sys.stderr.write("tv_grab_nl3_py requires tv_grab_py_API 1.0.0 or higher\n")
sys.exit(2)
class Configure(tvgrabpyAPI.Configure):
def __init__(self):
# We need these in __init__ to determin log names etc. If not set here prior to running __init__ we use defaults
tvgrabpyAPI.Configure.__init__(self, name = 'tv_grab_nl3_py', datafile = 'tv_grab_nl')
# Version info and description from the frontend as returned by the version function
self.country = 'The Netherlands'
self.description = 'Dutch/Flemish grabber combining multiple sources.'
self.major = 3
self.minor = 0
self.patch = 1
self.patchdate = u'20160802'
self.alfa = False
self.beta = True
# The default timezone to use in the xmltv output file. Can be overruled in the users configuration.
self.opt_dict['output_tz'] = 'Europe/Amsterdam'
# Where to get the json datafile and updates (if different from the API location)
self.source_url = 'https://raw.githubusercontent.com/tvgrabbers/sourcematching/master'
self.update_url = 'https://github.com/tvgrabbers/tvgrabpyAPI/releases/latest'
self.compat_text = '.tvgids.nl'
# end Configure()
# allow this to be a module
if __name__ == '__main__':
config = Configure()
x = tvgrabpyAPI.grabber_main(config)
config.close()
sys.exit(x)
The Options
add_hd_id
add-ttvdb-title
always_use_json
cache
capabilities
cattrans
clean_cache
clear_cache
clear_ttvdb
compat
config_file
configure
days
desc_length
description
disable_detail_source
disable_source
disable_ttvdb
fast
global_timeout
group_active_channels
help
legacy_xmltvids
language
log_level
logos
long_descr
mark_HD
mail_log
mail_log_address
mailport
mailserver
match_log_level
max_overlap
max_simultaneous_fetches
nocattrans
nologos
offset
output_file
output_tz
output-windows-codeset
overlap_strategy
prefered_description
preferredmethod
prime_source
quiet
ratingstyle
save_options
show-detail-sources
show-logo-sources
show-sources
slow
slowdays
ttvdb_lookup_level as of 1.0.5
use-only-cache
utc
use_split_episodes
verbose
version
xmltvid_alias