Commit 6d2717d 1 parent 1ade03d commit 6d2717d Copy full SHA for 6d2717d
File tree 5 files changed +46
-3
lines changed
5 files changed +46
-3
lines changed Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" UTF-8" ?>
2
- <addon id =" plugin.video.flix" name =" Flix" provider-name =" i96751414" version =" 0.0.10 " >
2
+ <addon id =" plugin.video.flix" name =" Flix" provider-name =" i96751414" version =" 0.0.11 " >
3
3
<requires >
4
- <import addon =" xbmc.python" version =" 2.24 .0" />
4
+ <!-- < import addon="xbmc.python" version="3.0 .0"/> -- >
5
5
<import addon =" script.module.routing" version =" 0.2.3" />
6
6
<import addon =" script.module.requests" version =" 2.22.0" />
7
7
<import addon =" script.module.cached" version =" 0.0.1" />
8
8
<import addon =" script.module.tmdbsimple" version =" 2.2.0" />
9
- <import addon =" script.module.futures" version =" 2.2.0" />
10
9
<import addon =" script.module.defusedxml" version =" 0.6.0" />
10
+ <!-- futures must be optional so we have py2/3 compatibility -->
11
+ <import addon =" script.module.futures" version =" 2.2.0" optional =" true" />
11
12
</requires >
12
13
<extension point =" xbmc.python.pluginsource" library =" navigation.py" >
13
14
<provides >video</provides >
Original file line number Diff line number Diff line change
1
+ from lib .api .compatibility import register_module
2
+
3
+ register_module ("concurrent.futures" , "script.module.futures" )
Original file line number Diff line number Diff line change
1
+ import importlib
2
+ import os
3
+ import sys
4
+
5
+ import xbmc
6
+ import xbmcaddon
7
+ from defusedxml import ElementTree
8
+
9
+ PY3 = sys .version_info .major >= 3
10
+
11
+
12
+ class UndefinedModuleError (ImportError ):
13
+ pass
14
+
15
+
16
+ def register_module (name , py2_module = None , py3_module = None ):
17
+ try :
18
+ importlib .import_module (name )
19
+ xbmc .log ("{} module is already installed" .format (name ), xbmc .LOGDEBUG )
20
+ except ImportError :
21
+ xbmc .log ("Failed to import module. Going to register it." , xbmc .LOGDEBUG )
22
+ module = py3_module if PY3 else py2_module
23
+ if module is None :
24
+ raise UndefinedModuleError ("No module was defined" )
25
+ install_and_register_module (name , module )
26
+
27
+
28
+ def install_and_register_module (name , module ):
29
+ xbmc .log ("Installing and registering module {}:{}" .format (name , module ), xbmc .LOGINFO )
30
+ xbmc .executebuiltin ("InstallAddon(" + module + ")" , wait = True )
31
+ path = xbmcaddon .Addon (module ).getAddonInfo ("path" )
32
+ if not PY3 :
33
+ # noinspection PyUnresolvedReferences
34
+ path = path .decode ("utf-8" )
35
+ tree = ElementTree .parse (os .path .join (path , "addon.xml" ))
36
+ library_path = tree .find ("./extension[@point='xbmc.python.module']" ).attrib ["library" ]
37
+ sys .path .append (os .path .join (path , library_path ))
Original file line number Diff line number Diff line change 1
1
import os
2
2
3
+ import dependencies # noqa
3
4
from lib .api .flix .kodi import ADDON_DATA
4
5
from lib .navigation import run
5
6
Original file line number Diff line number Diff line change
1
+ import dependencies # noqa
1
2
from lib .service import run
2
3
3
4
run ()
You can’t perform that action at this time.
0 commit comments