2015-07-22 13:16:08 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2015-06-05 06:05:40 +00:00
|
|
|
|
2015-09-24 11:59:26 +00:00
|
|
|
#################################################################################################
|
|
|
|
|
2016-07-24 08:59:48 +00:00
|
|
|
import logging
|
2015-06-05 06:05:40 +00:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
2015-03-13 21:24:59 +00:00
|
|
|
import xbmc
|
2015-12-24 19:51:47 +00:00
|
|
|
import xbmcaddon
|
2015-03-13 21:24:59 +00:00
|
|
|
|
2015-09-24 11:59:26 +00:00
|
|
|
#################################################################################################
|
|
|
|
|
2016-09-07 03:07:14 +00:00
|
|
|
_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)
|
2015-03-13 21:24:59 +00:00
|
|
|
|
2015-09-24 11:59:26 +00:00
|
|
|
#################################################################################################
|
|
|
|
|
2016-09-09 03:13:25 +00:00
|
|
|
import loghandler
|
2016-09-21 07:39:50 +00:00
|
|
|
from service_entry import Service
|
|
|
|
from utils import settings
|
2016-07-24 08:59:48 +00:00
|
|
|
|
|
|
|
#################################################################################################
|
|
|
|
|
|
|
|
loghandler.config()
|
|
|
|
log = logging.getLogger("EMBY.service")
|
2016-09-21 08:12:31 +00:00
|
|
|
DELAY = settings('startupDelay') or 0
|
2015-04-06 17:17:32 +00:00
|
|
|
|
2015-09-24 11:59:26 +00:00
|
|
|
#################################################################################################
|
|
|
|
|
2016-09-09 03:13:25 +00:00
|
|
|
if __name__ == "__main__":
|
2016-09-21 07:39:50 +00:00
|
|
|
|
2016-09-09 03:13:25 +00:00
|
|
|
log.warn("Delaying emby startup by: %s sec...", DELAY)
|
|
|
|
|
2016-09-21 07:39:50 +00:00
|
|
|
try:
|
2016-09-22 16:40:57 +00:00
|
|
|
if int(DELAY) and xbmc.Monitor().waitForAbort(int(DELAY)):
|
2016-09-21 07:39:50 +00:00
|
|
|
raise RuntimeError("Abort event while waiting to start Emby for kodi")
|
2016-09-09 03:13:25 +00:00
|
|
|
# Start the service
|
|
|
|
Service().service_entry_point()
|
2016-09-21 07:39:50 +00:00
|
|
|
except Exception as error:
|
|
|
|
log.exception(error)
|