def get_uri_by_timestamp(cls):
        """Generate an URI based on the timestamp."""
        program = cls._get_selection()
        if not program:
            return None

        # Get a list of addons that can play the selected channel
        # We do the lookup based on Channel Name, since that's all we have
        try:
            addons = cls._get_addons_for_channel(program.get('channel'))
        except IOError:
            if kodiutils.yesno_dialog(message=kodiutils.localize(
                    30713)):  # The EPG data is not up to date...
                from resources.lib.modules.addon import Addon
                Addon.refresh(True)
            return None

        if not addons:
            # Channel was not found.
            _LOGGER.debug('No Add-on was found to play %s',
                          program.get('channel'))
            kodiutils.notification(message=kodiutils.localize(
                30710,
                channel=program.get('channel')))  # Could not find an Add-on...
            return None

        if len(addons) == 1:
            # Channel has one Add-on. Play it directly.
            _LOGGER.debug('One Add-on was found to play %s: %s',
                          program.get('channel'), addons)
            return cls._format_uri(list(addons.values())[0], program)

        # Ask the user to pick an Add-on
        _LOGGER.debug('Multiple Add-on were found to play %s: %s',
                      program.get('channel'), addons)
        addons_list = list(addons)
        ret = kodiutils.select(heading=kodiutils.localize(30711),
                               options=addons_list)  # Select an Add-on...
        if ret == -1:
            _LOGGER.debug('The selection to play an item from %s was canceled',
                          program.get('channel'))
            return None

        return cls._format_uri(addons.get(addons_list[ret]), program)
Beispiel #2
0
    def run(self):
        """Background loop for maintenance tasks"""
        _LOGGER.debug('Service started')

        # Service loop
        while not self.abortRequested():
            # Check if we need to do an update
            if self._is_refresh_required():
                Addon.refresh()

            # Check if IPTV Simple needs to be restarted
            if IptvSimple.restart_required:
                IptvSimple.restart()

            # Stop when abort requested
            if self.waitForAbort(30):
                break

        _LOGGER.debug('Service stopped')
Beispiel #3
0
def refresh():
    """Refresh the channels and EPG"""
    Addon.refresh(True)

    # Open settings again
    kodiutils.open_settings()
Beispiel #4
0
def update():
    """Silently refresh the channels and EPG"""
    Addon.refresh(force=True)
Beispiel #5
0
def reload():
    """Refresh the channels and EPG without opening settings"""
    Addon.refresh(True, force=True)
def reload():
    """Silently refresh the channels and EPG"""
    Addon.refresh()