forked from MediaBrowser/plugin.video.emby
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathservice.py
More file actions
57 lines (43 loc) · 1.74 KB
/
service.py
File metadata and controls
57 lines (43 loc) · 1.74 KB
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
50
51
52
53
54
55
56
57
# -*- coding: utf-8 -*-
#################################################################################################
import logging
import os
import sys
import xbmc
import xbmcaddon
#################################################################################################
_ADDON = xbmcaddon.Addon(id='plugin.video.emby')
_CWD = _ADDON.getAddonInfo('path').decode('utf-8')
_BASE_LIB = xbmc.translatePath(os.path.join(_CWD, 'resources', 'lib')).decode('utf-8')
sys.path.append(_BASE_LIB)
#################################################################################################
import loghandler
from service_entry import Service
from utils import settings
#from ga_client import GoogleAnalytics
#################################################################################################
loghandler.config()
log = logging.getLogger("EMBY.service")
DELAY = int(settings('startupDelay') or 0)
#################################################################################################
if __name__ == "__main__":
log.warn("Delaying emby startup by: %s sec...", DELAY)
service = Service()
try:
abort = False
if DELAY and xbmc.Monitor().waitForAbort(DELAY):
log.info("Abort event while waiting to start Emby for kodi")
abort = True
# Start the service
if abort == False:
service.service_entry_point()
except Exception as error:
"""
if not (hasattr(error, 'quiet') and error.quiet):
ga = GoogleAnalytics()
errStrings = ga.formatException()
ga.sendEventData("Exception", errStrings[0], errStrings[1])
"""
log.exception(error)
log.info("Forcing shutdown")
service.shutdown()