mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-23 21:39:54 +00:00
56 lines
1.8 KiB
Python
56 lines
1.8 KiB
Python
# -*- 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
|
|
import internal_exceptions
|
|
|
|
#################################################################################################
|
|
|
|
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:
|
|
if DELAY and xbmc.Monitor().waitForAbort(DELAY):
|
|
raise RuntimeError("Abort event while waiting to start Emby for kodi")
|
|
# Start the service
|
|
service.service_entry_point()
|
|
except internal_exceptions.ExceptionWrapper as error:
|
|
log.exception(error)
|
|
log.info("Forcing shutdown")
|
|
service.shutdown()
|
|
except Exception as error:
|
|
ga = GoogleAnalytics()
|
|
errStrings = ga.formatException()
|
|
ga.sendEventData("Exception", errStrings[0], errStrings[1])
|
|
log.exception(error)
|
|
log.info("Forcing shutdown")
|
|
service.shutdown()
|