示例#1
0
def first_run():
    if settings[SETTINGS.UUID] == '':
        settings[SETTINGS.UUID] = uuid.uuid4()
        DialogRenderer.ok(get_string(LANG.NEWS_TITLE),
                          get_string(LANG.NEWS_TEXT))
    if settings[SETTINGS.INSTALLATION_DATE] == '':
        set_settings(SETTINGS.INSTALLATION_DATE, get_current_datetime_str())
    if settings[SETTINGS.VERSION] == '':
        set_settings(SETTINGS.VERSION, get_info('version'))

    if settings[SETTINGS.PROVIDER_USERNAME] == '':
        settings[SETTINGS.PROVIDER_TOKEN] = ''

    # fix plain stored password on first run
    if settings[SETTINGS.PROVIDER_USERNAME] and len(
            settings[SETTINGS.PROVIDER_PASSWORD]) != 40:
        salt = provider.get_salt(settings[SETTINGS.PROVIDER_USERNAME])
        if salt is not None:
            settings[SETTINGS.PROVIDER_PASSWORD] = hash_password(
                settings[SETTINGS.PROVIDER_PASSWORD], salt)

    if get_plugin_route(
    ) != ROUTE.CHECK_PROVIDER_CREDENTIALS or not storage.get(
            STORAGE.IS_OLD_KODI_SESSION):
        settings.load_to_cache(SETTINGS.PROVIDER_USERNAME,
                               SETTINGS.PROVIDER_PASSWORD,
                               SETTINGS.PROVIDER_TOKEN)

    if not storage.get(STORAGE.IS_OLD_KODI_SESSION):
        storage[STORAGE.IS_OLD_KODI_SESSION] = True
示例#2
0
 def media_played(self):
     service_logger.debug('Sending API request to increment play count')
     media_id = storage.get(STORAGE.SELECTED_MEDIA_ID)
     if media_id:
         collection = storage.get(STORAGE.COLLECTION)
         uuid = settings[SETTINGS.UUID]
         self._api.media_played(collection, media_id, uuid)
示例#3
0
 def storage():
     return storage.get(STORAGE.SERVICE)
 def last_added():
     return storage.get(STORAGE.PLUGIN_LAST_URL_ADDED)
 def send_service_message(service_name, service_event):
     logger.debug('Sending service message {}: {}'.format(service_name, service_event))
     service_storage = storage.get(STORAGE.SERVICE)
     service_storage[service_name] = service_event
     storage[STORAGE.SERVICE] = service_storage
示例#6
0
def on_clear_cache_redirect():
    if storage.get(STORAGE.CLEARED_CACHE):
        logger.debug('Cache is empty. Redirecting to main menu')
        storage[STORAGE.CLEARED_CACHE] = False
        router.replace_route(ROUTE.ROOT)
示例#7
0
 def media_played(self):
     service_logger.debug('Sending API request to increment play count')
     media_id = storage.get(STORAGE.SELECTED_MEDIA_ID)
     collection = storage.get(STORAGE.COLLECTION)
     self._api.media_played(collection, media_id)