def _update_metadata(self):
        """ Update the metadata for the listings """
        from resources.lib.modules.metadata import Metadata

        # Clear outdated metadata
        kodiutils.invalidate_cache(self.cache_expiry)

        def update_status(_i, _total):
            """ Allow to cancel the background job """
            return self.abortRequested() or not kodiutils.get_setting_bool('metadata_update')

        try:
            success = Metadata().fetch_metadata(callback=update_status)
        except NoLoginException:
            # We have no login yet, but that's okay, we will retry later
            _LOGGER.debug('Skipping background updating since we have no credentials.')
            return

        except Exception as exc:  # pylint: disable=broad-except
            _LOGGER.debug('Skipping background updating since we got an error')
            _LOGGER.exception(exc)
            return

        # Update metadata_last_updated
        if success:
            kodiutils.set_setting('metadata_last_updated', str(int(time())))
    def _update_metadata(self):
        """ Update the metadata for the listings """
        from resources.lib.modules.metadata import Metadata

        # Clear outdated metadata
        kodiutils.invalidate_cache(self.cache_expiry)

        def update_status(_i, _total):
            """ Allow to cancel the background job """
            return self.abortRequested() or not kodiutils.get_setting_bool('metadata_update')

        success = Metadata().fetch_metadata(callback=update_status)

        # Update metadata_last_updated
        if success:
            kodiutils.set_setting('metadata_last_updated', str(int(time())))
Beispiel #3
0
    def _update_metadata(self):
        """ Update the metadata for the listings """
        from resources.lib.modules.metadata import Metadata

        # Clear outdated metadata
        kodiutils.invalidate_cache(self.cache_expiry)

        def update_status(_i, _total):
            """ Allow to cancel the background job """
            return self.abortRequested() or not kodiutils.get_setting_bool('metadata_update')

        try:
            success = Metadata().fetch_metadata(callback=update_status)
        except NoLoginException:
            # We have no login yet, but that's okay, we will retry later
            success = True

        # Update metadata_last_updated
        if success:
            kodiutils.set_setting('metadata_last_updated', str(int(time())))
 def clean():
     """ Clear metadata (called from settings) """
     kodiutils.invalidate_cache()
     kodiutils.set_setting('metadata_last_updated', '0')
     kodiutils.ok_dialog(
         message=kodiutils.localize(30714))  # Local metadata is cleared