-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathaddon.py
35 lines (27 loc) · 986 Bytes
/
addon.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
from resources.lib import db, epg, web
from os import mkdir
from threading import Thread
import xbmc, xbmcvfs, xbmcaddon
__addon__ = xbmcaddon.Addon(id='script.service.easyepg-lite')
__addondir__ = xbmcvfs.translatePath(__addon__.getAddonInfo('profile'))
__addonpath__ = xbmcvfs.translatePath(__addon__.getAddonInfo('path'))
file_paths = {"included": __addonpath__, "storage": __addondir__}
# CREATE ADDON_DATA FOLDER
try:
mkdir(file_paths["storage"])
except FileExistsError:
pass
us = db.UserData(file_paths)
pr = db.ProviderManager(file_paths, us)
my_server = web.WebServer(epg.Grabber(file_paths, pr, us), file_paths)
# START SERVER (+ STOP SERVER BEFORE CLOSING KODI)
def check_for_quit_event():
monitor = xbmc.Monitor()
while not monitor.abortRequested():
if monitor.waitForAbort(1):
break
my_server.stop_kodi()
monitor_kodi = Thread(target=check_for_quit_event)
monitor_kodi.start()
my_server.start()
monitor_kodi.join()