from resources.lib.kodi_utils import HomeWindow from resources.lib.widgets import checkForNewContent, set_background_image, set_random_movies from resources.lib.websocket_client import WebSocketClient from resources.lib.menu_functions import set_library_window_values from resources.lib.context_monitor import ContextMonitor from resources.lib.server_detect import checkServer settings = xbmcaddon.Addon() # clear user and token when logging in home_window = HomeWindow() home_window.clearProperty("userid") home_window.clearProperty("AccessToken") home_window.clearProperty("Params") log = SimpleLogging('service') monitor = xbmc.Monitor() # wait for 10 seconds for the Kodi splash screen to close i = 0 while not monitor.abortRequested(): if i == 100 or not xbmc.getCondVisibility("Window.IsVisible(startup)"): break i += 1 xbmc.sleep(100) checkServer() download_utils = DownloadUtils() # auth the service
from resources.lib.downloadutils import DownloadUtils from resources.lib.simple_logging import SimpleLogging from resources.lib.play_utils import Service, PlaybackService, sendProgress from resources.lib.kodi_utils import HomeWindow from resources.lib.widgets import checkForNewContent, set_background_image from resources.lib.websocket_client import WebSocketClient from resources.lib.menu_functions import set_library_window_values # clear user and token when logging in home_window = HomeWindow() home_window.clearProperty("userid") home_window.clearProperty("AccessToken") home_window.clearProperty("Params") log = SimpleLogging('service') download_utils = DownloadUtils() # 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()
import xbmc import xbmcgui import xbmcplugin import sys import json from resources.lib.simple_logging import SimpleLogging log = SimpleLogging(__name__) class HomeWindow(): """ xbmcgui.Window(10000) with add-on id prefixed to keys """ def __init__(self): self.id_string = 'script.viewmaster-%s' self.window = xbmcgui.Window(10000) def getProperty(self, key): key = self.id_string % key value = self.window.getProperty(key) # log.debug('HomeWindow: getProperty |%s| -> |%s|' % (key, value)) return value def setProperty(self, key, value): key = self.id_string % key # log.debug('HomeWindow: setProperty |%s| -> |%s|' % (key, value)) self.window.setProperty(key, value)
# -*- coding: utf-8 -*- ################################################################################################# import logging import os import sys import xbmc import xbmcaddon from resources.lib.functions import show_menu from resources.lib.simple_logging import SimpleLogging log = SimpleLogging('contextmenu') item_id = sys.listitem.getProperty("id") log.debug("Context Menu Item ID: {0}", item_id) params = {} params["item_id"] = item_id show_menu(params)
# Gnu General Public License - see LICENSE.TXT from resources.lib.simple_logging import SimpleLogging from resources.lib.functions import mainEntryPoint log = SimpleLogging('default') log.debug("About to enter mainEntryPoint()") mainEntryPoint() # clear done and exit. # sys.modules.clear()
# -*- coding: utf-8 -*- ################################################################################################# import logging import os import sys import xbmc import xbmcaddon from resources.lib.functions import showMenu from resources.lib.simple_logging import SimpleLogging log = SimpleLogging('contextmenu') item_id = sys.listitem.getProperty("id") log.debug("Context Menu Item ID: {0}", item_id) params = {} params["item_id"] = item_id showMenu(params)