-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcontext.py
49 lines (39 loc) · 1.44 KB
/
context.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# -*- coding: utf-8 -*-
import xbmcaddon
import os, sys
import xbmc
import xbmcvfs
__addon__ = xbmcaddon.Addon('context.medusa.failed')
__cwd__ = xbmcvfs.translatePath(__addon__.getAddonInfo('path'))
__resource__ = xbmcvfs.translatePath(os.path.join(__cwd__, 'resources', 'lib'))
__settings__ = xbmcaddon.Addon('context.medusa.failed')
__language__ = __settings__.getLocalizedString
sys.path.append(os.path.join(__cwd__, 'resources', 'lib'))
xbmc.log('Addon dir: ' + __cwd__, xbmc.LOGINFO)
from resources.lib import context
class MySettings(object):
def __init__(self, url, username, password, debug):
self.url = url + '/' if not url[-1] == '/' else url
self.username = username
self.password = password
self.debug = debug
debug = bool(__settings__.getSetting('debug').lower() == 'true')
remote = False
if debug:
try:
import web_pdb; web_pdb.set_trace()
except Exception as error:
xbmc.log('Failed to import ptvsd, stopping debugging\n Error:' + str(error), xbmc.LOGWARNING)
if __name__ == '__main__':
# Keep this file to a minimum, as Kodi
# doesn't keep a compiled copy of this
ADDON = xbmcaddon.Addon()
context = context.MedusaFailed(
MySettings(
__settings__.getSetting('medusaurl'),
__settings__.getSetting('username'),
__settings__.getSetting('password'),
__settings__.getSetting('debug')
)
)
context.run()