# auth the service try: download_utils.authenticate() download_utils.getUserId() except Exception as error: log.error("Error with initial service auth: {0}", error) # set up all the services monitor = Service() playback_service = PlaybackService(monitor) home_window = HomeWindow() last_progress_update = time.time() last_content_check = time.time() last_background_update = 0 websocket_client = WebSocketClient() # session id # TODO: this is used to append to the end of PLAY urls, this is to stop mark watched from overriding the Emby ones home_window.setProperty("session_id", str(time.time())) # start the WebSocket Client running settings = xbmcaddon.Addon() remote_control = settings.getSetting('remoteControl') == "true" if remote_control: websocket_client.start() # monitor.abortRequested() is causes issues, it currently triggers for all addon cancelations which causes # the service to exit when a user cancels an addon load action. This is a bug in Kodi. # I am switching back to xbmc.abortRequested approach until kodi is fixed or I find a work arround prev_user_id = home_window.getProperty("userid")
try: download_utils.authenticate() download_utils.getUserId() except Exception as error: log.error("Error with initial service auth: {0}", error) # set up all the services monitor = Service() playback_service = PlaybackService(monitor) home_window = HomeWindow() last_progress_update = time.time() last_content_check = time.time() last_background_update = 0 last_random_movie_update = 0 websocket_client = WebSocketClient() # session id # TODO: this is used to append to the end of PLAY urls, this is to stop mark watched from overriding the Emby ones home_window.setProperty("session_id", str(time.time())) # start the WebSocket Client running remote_control = settings.getSetting('remoteControl') == "true" if remote_control: websocket_client.start() # Start the context menu monitor context_monitor = None
monitor = Service() playback_service = PlaybackService(monitor) home_window = HomeWindow() last_progress_update = time.time() last_content_check = time.time() last_background_update = 0 last_random_movie_update = 0 # start the library update monitor library_change_monitor = LibraryChangeMonitor() library_change_monitor.start() # start the WebSocket Client running remote_control = settings.getSetting('websocket_enabled') == "true" websocket_client = WebSocketClient(library_change_monitor) if remote_control: websocket_client.start() play_next_service = None play_next_trigger_time = int(settings.getSetting('play_next_trigger_time')) if play_next_trigger_time > 0: play_next_service = PlayNextService(monitor) play_next_service.start() # Start the context menu monitor context_monitor = None context_menu = settings.getSetting('override_contextmenu') == "true" if context_menu: context_monitor = ContextMonitor() context_monitor.start()