if (time.time() - last_progress_update) > 10: last_progress_update = time.time() sendProgress(monitor) else: if newcontent_interval != 0 and ( time.time() - last_content_check) > newcontent_interval: last_content_check = time.time() checkForNewContent() if background_interval != 0 and ( time.time() - last_background_update) > background_interval: last_background_update = time.time() set_library_window_values() set_background_image() if remote_control and prev_user_id != home_window.getProperty( "userid"): prev_user_id = home_window.getProperty("userid") websocket_client.stop_client() websocket_client = WebSocketClient() websocket_client.start() except Exception as error: log.error("Exception in Playback Monitor: {0}", error) log.error("{0}", traceback.format_exc()) xbmc.sleep(1000) # call stop on the context menu monitor
log.debug("user_change_detected") prev_user_id = home_window.getProperty("userid") user_changed = True if random_movie_list_interval != 0 and (user_changed or (time.time() - last_random_movie_update) > random_movie_list_interval): last_random_movie_update = time.time() set_random_movies() if newcontent_interval != 0 and (user_changed or (time.time() - last_content_check) > newcontent_interval): last_content_check = time.time() checkForNewContent() if background_interval != 0 and (user_changed or (time.time() - last_background_update) > background_interval): last_background_update = time.time() set_library_window_values(user_changed) set_background_image(user_changed) if remote_control and user_changed: websocket_client.stop_client() websocket_client = WebSocketClient() websocket_client.start() elif screen_saver_active: if background_interval != 0 and ((time.time() - last_background_update) > background_interval): last_background_update = time.time() set_background_image(False) except Exception as error: log.error("Exception in Playback Monitor: {0}", error) log.error("{0}", traceback.format_exc())
while not xbmc.abortRequested: try: if xbmc.Player().isPlaying(): # if playing every 10 seconds updated the server with progress if (time.time() - last_progress_update) > 10: last_progress_update = time.time() sendProgress(monitor) else: if (time.time() - last_content_check) > 60: last_content_check = time.time() checkForNewContent() if (time.time() - last_background_update) > 30: last_background_update = time.time() set_library_window_values() set_background_image() if remote_control and prev_user_id != home_window.getProperty("userid"): prev_user_id = home_window.getProperty("userid") websocket_client.stop_client() websocket_client = WebSocketClient() websocket_client.start() except Exception as error: log.error("Exception in Playback Monitor: {0}", error) log.error("{0}", traceback.format_exc()) xbmc.sleep(1000) # stop the WebSocket Client