55c918cb240216a3cacf67e36edd5764ded57711
[plugin.video.netflix.git] / addon.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 # Module: default
4 # Created on: 13.01.2017
5
6 # import local classes
7
8 import sys
9 from resources.lib.NetflixSession import NetflixSession
10 from resources.lib.KodiHelper import KodiHelper
11 from resources.lib.Navigation import Navigation
12 from resources.lib.Library import Library
13
14 # Setup plugin
15 plugin_handle = int(sys.argv[1])
16 base_url = sys.argv[0]
17
18 # init plugin libs
19 kodi_helper = KodiHelper(
20     plugin_handle=plugin_handle,
21     base_url=base_url
22 )
23 netflix_session = NetflixSession(
24     cookie_path=kodi_helper.cookie_path,
25     data_path=kodi_helper.data_path,
26     verify_ssl=kodi_helper.get_ssl_verification_setting(),
27     log_fn=kodi_helper.log
28 )
29 library = Library(
30     root_folder=kodi_helper.base_data_path,
31     library_settings=kodi_helper.get_custom_library_settings(),
32     log_fn=kodi_helper.log
33 )
34 navigation = Navigation(
35     netflix_session=netflix_session,
36     kodi_helper=kodi_helper,
37     library=library,
38     base_url=base_url,
39     log_fn=kodi_helper.log
40 )
41 kodi_helper.set_library(library=library)
42
43 if __name__ == '__main__':
44     # Call the router function and pass the plugin call parameters to it.
45     # We use string slicing to trim the leading '?' from the plugin call paramstring
46     kodi_helper.log('started')
47     navigation.router(paramstring=sys.argv[2][1:])