Пример #1
0
def run():
    first_run()
    setup_root_logger()
    on_clear_cache_redirect()
    set_settings(SETTINGS.VERSION, get_info('version'))
    logger.debug('Entry point ------- ' + str(sys.argv))
    try:
        stream_cinema.vip_remains()
        # settings.load_to_cache(SETTINGS.PROVIDER_USERNAME, SETTINGS.PROVIDER_PASSWORD, SETTINGS.PROVIDER_TOKEN)
        check_version()
        plugin_url_history.add(get_plugin_url())
        return router.run()
    except requests.exceptions.ConnectionError as e:
        logger.error(e)
        if _can_connect_google():
            Dialog().ok(get_string(LANG.CONNECTION_ERROR),
                        get_string(LANG.SERVER_ERROR_HELP))
        else:
            Dialog().ok(get_string(LANG.CONNECTION_ERROR),
                        get_string(LANG.NO_CONNECTION_HELP))
"""
    Stream cinema service.
"""

import logging

import xbmc

from resources.lib.defaults import Defaults
from resources.lib.kodilogging import setup_root_logger
from resources.lib.kodilogging import service_logger
from resources.lib.players.stream_cinema_player import StreamCinemaPlayer
from resources.lib.services.player_service import PlayerService

setup_root_logger()

service_logger.debug('Service started')
player_service = PlayerService(Defaults.api())
stream_cinema_player = StreamCinemaPlayer(service=player_service)

xbmc_monitor = xbmc.Monitor()
while not xbmc_monitor.abortRequested():
    # Do some stuff periodically. Since we have nothing to do for now, just block indefinitely.
    # Anyway we have to keep this blocked otherwise Player will get discarded.
    xbmc_monitor.waitForAbort()

# TODO: Fix warnings about some classes left in a memory:
# https://forum.kodi.tv/showthread.php?tid=307508&pid=2531105#pid2531105
service_logger.debug('Service stopped')
def run():
    first_run()
    setup_root_logger()
    logger.debug('Entry point ------- ' + str(sys.argv))
    plugin_url_history.add(get_plugin_url())
    return router.run()