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
|
|
|
#################################################################################################
|
|
|
|
|
2018-09-06 08:36:32 +00:00
|
|
|
__addon__ = xbmcaddon.Addon(id='plugin.video.emby').getAddonInfo('path').decode('utf-8')
|
|
|
|
__base__ = xbmc.translatePath(os.path.join(__addon__, 'resources', 'lib')).decode('utf-8')
|
|
|
|
sys.path.append(__base__)
|
2015-03-13 21:24:59 +00:00
|
|
|
|
2015-09-24 11:59:26 +00:00
|
|
|
#################################################################################################
|
|
|
|
|
2018-09-06 08:36:32 +00:00
|
|
|
from entrypoint import Service
|
|
|
|
from helper import settings
|
|
|
|
from emby import Emby
|
2016-07-24 08:59:48 +00:00
|
|
|
|
|
|
|
#################################################################################################
|
|
|
|
|
2018-09-06 08:36:32 +00:00
|
|
|
LOG = logging.getLogger("EMBY.service")
|
2016-10-07 04:15:23 +00:00
|
|
|
DELAY = int(settings('startupDelay') or 0)
|
2015-04-06 17:17:32 +00:00
|
|
|
|
2015-09-24 11:59:26 +00:00
|
|
|
#################################################################################################
|
|
|
|
|
2018-09-06 08:36:32 +00:00
|
|
|
|
2016-09-09 03:13:25 +00:00
|
|
|
if __name__ == "__main__":
|
2016-09-21 07:39:50 +00:00
|
|
|
|
2018-09-06 19:41:02 +00:00
|
|
|
LOG.warn("--->[ service ]")
|
2018-09-06 08:36:32 +00:00
|
|
|
LOG.warn("Delay startup by %s seconds.", DELAY)
|
|
|
|
|
|
|
|
session = Service()
|
2016-09-09 03:13:25 +00:00
|
|
|
|
2016-09-21 07:39:50 +00:00
|
|
|
try:
|
2016-10-07 04:15:23 +00:00
|
|
|
if DELAY and xbmc.Monitor().waitForAbort(DELAY):
|
2018-09-06 08:36:32 +00:00
|
|
|
raise Exception("Aborted during startup delay")
|
2017-01-14 23:46:38 +00:00
|
|
|
|
2018-09-06 08:36:32 +00:00
|
|
|
session.service()
|
2016-09-21 07:39:50 +00:00
|
|
|
except Exception as error:
|
2018-09-06 08:36:32 +00:00
|
|
|
|
|
|
|
LOG.exception(error)
|
|
|
|
session.shutdown()
|
|
|
|
|
2018-09-06 19:41:02 +00:00
|
|
|
LOG.warn("---<[ service ]")
|