Ejemplo n.º 1
0
 def onInit(self):
     self._winID = xbmcgui.getCurrentWindowId()
     BaseFunctions.lastWinID = self._winID
     if self.started:
         self.onReInit()
     else:
         self.started = True
         self.onFirstInit()
         self.finishedInit = True
Ejemplo n.º 2
0
def setview():
    skin = xbmc.getSkinDir().lower()
    win = xbmcgui.Window(xbmcgui.getCurrentWindowId())
    viewtype = str(win.getFocusId())
    addon.setSetting('setview', ';'.join([skin, viewtype]))
    addon.setSetting('customview', 'true')
    viewName = xbmc.getInfoLabel('Container.Viewmode')
    notify(i18n('dflt_view_set'), '{0} {1}'.format(i18n('dflt_set'), viewName))
    xbmc.executebuiltin('Container.Refresh')
Ejemplo n.º 3
0
    def setProperty(self, key, value):
        if self._closing:
            return

        if not self._winID:
            self._winID = xbmcgui.getCurrentWindowId()

        try:
            xbmcgui.Window(self._winID).setProperty(key, value)
            xbmcgui.WindowXMLDialog.setProperty(self, key, value)
        except RuntimeError:
            xbmc.log('kodigui.BaseDialog.setProperty: Missing window', xbmc.LOGDEBUG)
Ejemplo n.º 4
0
def focus(i):

    #TODO find way to check this has worked (clist.getSelectedPosition returns -1)
    xbmc.sleep(int(plugin.get_setting('scroll.ms', str) or "0"))
    #TODO deal with hidden ..
    win = xbmcgui.Window(xbmcgui.getCurrentWindowId())
    cid = win.getFocusId()
    if cid:
        clist = win.getControl(cid)
        if clist:
            try:
                clist.selectItem(i)
            except:
                pass
Ejemplo n.º 5
0
def generic_menu(plugin, item_id=None, **kwargs):
    """Build 'item_id' menu of the addon

    Args:
        plugin (codequick.script.Script)
        item_id (str): Menu to build (e.g. root)
    Returns:
        Iterator[codequick.listing.Listitem]: Kodi 'item_id' menu
    """

    if item_id is None:
        # Fix https://github.com/Catch-up-TV-and-More/plugin.video.catchuptvandmore/issues/304
        xbmc.executebuiltin("Action(Back,%s)" % xbmcgui.getCurrentWindowId())
        yield False

    else:
        menu_id = item_id

        # If 'menu_id' menu contains only one item, directly open this item
        plugin.redirect_single_item = True

        # Get ordered 'menu_id' menu
        # without disabled and hidden items
        menu = get_sorted_menu(plugin, menu_id)

        if not menu:
            # If the selected menu is empty just reload the current menu
            yield False

        for index, (item_order, item_id, item_infos) in enumerate(menu):

            item = Listitem()

            # Set item label
            item.label = get_item_label(item_id, item_infos)

            # Set item art
            if 'thumb' in item_infos:
                item.art["thumb"] = get_item_media_path(item_infos['thumb'])

            if 'fanart' in item_infos:
                item.art["fanart"] = get_item_media_path(
                    item_infos['fanart'])
Ejemplo n.º 6
0
    def list_items(self, focus=False, upd=False, epg=False):
        if self.video:
            xbmcplugin.setContent(self.plugin.addon_handle, self.plugin.content)
        xbmcplugin.endOfDirectory(self.plugin.addon_handle, cacheToDisc=self.cache, updateListing=upd)

        if self.plugin.force_view:
            view_id = self.plugin.view_id
            if self.video:
                view_id = self.plugin.view_id_videos
            if epg:
                view_id = self.plugin.view_id_epg
            xbmc.executebuiltin('Container.SetViewMode({0})'.format(view_id))

        if focus:
            try:
                wnd = xbmcgui.Window(xbmcgui.getCurrentWindowId())
                wnd.getControl(wnd.getFocusId()).selectItem(focus)
            except:
                pass
Ejemplo n.º 7
0
def main():
    addon = xbmcaddon.Addon()
    item_path = sys.listitem.getVideoInfoTag().getPath()
    if not item_path:
        return

    extras_dir = os.path.join(item_path, addon.getSetting('extras-folder'))
    xbmc.log("[%s] opening '%s'" % (addon.getAddonInfo('id'), extras_dir), xbmc.LOGDEBUG)

    params = {
        'path': extras_dir,
        'isroot': 'true',
        'title': sys.listitem.getLabel(),
        'fanart': sys.listitem.getProperty('fanart_image'),
    }
    plugin_url = "plugin://context.item.extras/?" + urlencode(params)

    if xbmcgui.getCurrentWindowId() == 10025:
        xbmc.executebuiltin('Container.Update(\"%s\")' % plugin_url)
    else:
        xbmc.executebuiltin('ActivateWindow(videos, \"%s\")' % plugin_url)
Ejemplo n.º 8
0
    def onInit(self):
        if not self.win:
            xbmc.executebuiltin(XBMC_DIALOG_BUSY_OPEN)
            self.win = xbmcgui.Window(xbmcgui.getCurrentWindowId())
            self.sidUpdate()

            self.base = self.xnewa.getURL()
            self.setOSDMode(True)
            self.image = self.getControl(100)
            self.debugBack = self.getControl(110)
            self.debug = self.getControl(120)
            if self.sdlmode != SDL.disabled and self.settings.XNEWA_LIVE_SKIN:
                self.win.setProperty('sdlmode', 'true')
            else:
                self.win.setProperty('sdlmode', 'false')

            #self.status = self.getControl(120)
            #self.status.setImage('NextPVR.png')
            self.getScreen(True)
            self.ready = True
            xbmc.executebuiltin(XBMC_DIALOG_BUSY_CLOSE)
            t = Thread(target=self.render)
            t.start()
Ejemplo n.º 9
0
    def onInit(self):
        if not self.win:
            xbmc.executebuiltin(XBMC_DIALOG_BUSY_OPEN)
            self.win = xbmcgui.Window(xbmcgui.getCurrentWindowId())
            self.sidUpdate()

            self.base = self.xnewa.getURL()
            self.setOSDMode(True)
            self.image = self.getControl(100)
            self.debugBack = self.getControl(110)
            self.debug = self.getControl(120)
            if self.sdlmode != SDL.disabled and self.settings.XNEWA_LIVE_SKIN:
                self.win.setProperty('sdlmode', 'true')
            else:
                self.win.setProperty('sdlmode', 'false')

            #self.status = self.getControl(120)
            #self.status.setImage('NextPVR.png')
            self.getScreen(True)
            self.ready = True
            xbmc.executebuiltin(XBMC_DIALOG_BUSY_CLOSE)
            t = Thread(target=self.render)
            t.start()
Ejemplo n.º 10
0
def getWindowId():
    return xbmcgui.getCurrentWindowId()
Ejemplo n.º 11
0
def getCurrentViewId():
    win = xbmcgui.Window(xbmcgui.getCurrentWindowId())
    return str(win.getFocusId())
Ejemplo n.º 12
0
dialog = xbmcgui.Dialog()

progressDialog = xbmcgui.DialogProgress()

progressDialogBG = xbmcgui.DialogProgressBG()

windowDialog = xbmcgui.WindowDialog()

button = xbmcgui.ControlButton

image = xbmcgui.ControlImage

getCurrentDialogId = xbmcgui.getCurrentWindowDialogId()

getCurrentWinId = xbmcgui.getCurrentWindowId()

keyboard = xbmc.Keyboard

monitor = xbmc.Monitor()

execute = xbmc.executebuiltin

skin = xbmc.getSkinDir()

player = xbmc.Player()

playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)

resolve = xbmcplugin.setResolvedUrl
def generic_menu(plugin, item_id=None, **kwargs):
    """Build 'item_id' menu of the addon

    Args:
        plugin (codequick.script.Script)
        item_id (str): Menu to build (e.g. root)
    Returns:
        Iterator[codequick.listing.Listitem]: Kodi 'item_id' menu
    """

    if item_id is None:
        # Fix https://github.com/Catch-up-TV-and-More/plugin.video.catchuptvandmore/issues/304
        xbmc.executebuiltin("Action(Back,%s)" % xbmcgui.getCurrentWindowId())
        yield False

    else:
        menu_id = item_id

        # If 'menu_id' menu contains only one item, directly open this item
        plugin.redirect_single_item = True

        # Get ordered 'menu_id' menu
        # without disabled and hidden items
        menu = get_sorted_menu(plugin, menu_id)

        if not menu:
            # If the selected menu is empty just reload the current menu
            yield False

        for index, (item_order, item_id, item_infos) in enumerate(menu):

            item = Listitem()

            # Set item label
            item.label = get_item_label(item_id, item_infos)

            # Set item art
            if 'thumb' in item_infos:
                item.art["thumb"] = get_item_media_path(item_infos['thumb'])

            if 'fanart' in item_infos:
                item.art["fanart"] = get_item_media_path(
                    item_infos['fanart'])

            # Set item additional params
            if 'xmltv_id' in item_infos:
                item.params['xmltv_id'] = item_infos['xmltv_id']

            item.params['item_id'] = item_id

            # Set callback function for this item
            if 'route' in item_infos:
                item.set_callback((Route.ref(item_infos['route'])))
            elif 'resolver' in item_infos:
                item.set_callback((Resolver.ref(item_infos['resolver'])))
            else:
                # This case should not happen
                # Ignore this item to prevent any error for this menu
                continue

            # Add needed context menus to this item
            add_context_menus_to_item(item,
                                      item_id,
                                      index,
                                      menu_id,
                                      len(menu),
                                      is_playable='resolver' in item_infos,
                                      item_infos=item_infos)

            yield item
Ejemplo n.º 14
0
def get_current_view():
    window = xbmcgui.Window(xbmcgui.getCurrentWindowId())
    return str(window.getFocusId())
Ejemplo n.º 15
0
        try:
            IAGL.delete_all_list_cache()
            success.append(True)
            xbmc.log(msg='IAGL:  List cache was cleared.', level=xbmc.LOGDEBUG)
        except Exception as exc2:
            success.append(False)
            xbmc.log(
                msg=
                'IAGL Error:  List cache could not be cleared, Exception %(exc)s'
                % {'exc': str(exc2)},
                level=xbmc.LOGERROR)
        if False not in success:
            current_dialog = xbmcgui.Dialog()
            ok_ret = current_dialog.ok('Completed', 'Addon cache was cleared')
        try:  #Clear mem cache if possible
            xbmcgui.Window(
                xbmcgui.getCurrentWindowId()).clearProperty('iagl_current_crc')
            xbmcgui.Window(
                xbmcgui.getCurrentWindowId()).clearProperty('iagl_game_list')
        except:
            pass
    except Exception as exc:
        xbmc.log(
            msg=
            'IAGL Error:  List cache could not be cleared, Exception %(exc)s' %
            {'exc': str(exc)},
            level=xbmc.LOGERROR)
    WIN.clearProperty('iagl.script_started')
    xbmc.log(msg='IAGL:  Clear cache script completed', level=xbmc.LOGDEBUG)
else:
    xbmc.log(msg='IAGL:  Script already running', level=xbmc.LOGDEBUG)
Ejemplo n.º 16
0
 def activate(self):
     if not self._winID:
         self._winID = xbmcgui.getCurrentWindowId()
     xbmc.executebuiltin('ReplaceWindow({0})'.format(self._winID))
Ejemplo n.º 17
0
def setViewCM(viewtype):
    window = xbmcgui.Window(xbmcgui.getCurrentWindowId())
    viewid = str(window.getFocusId())
    xbmcaddon.Addon().setSetting("%s_view" % (viewtype), viewid)
    kodi.notify(kodi.get_name(),
                "%s view has been set to (%s)." % (viewtype.title(), viewid))
Ejemplo n.º 18
0
def generic_menu(plugin, item_id=None, **kwargs):
    """Build 'item_id' menu of the addon

    Args:
        plugin (codequick.script.Script)
        item_id (str): Menu to build (e.g. root)
    Returns:
        Iterator[codequick.listing.Listitem]: Kodi 'item_id' menu
    """

    if item_id is None:
        # Fix https://github.com/Catch-up-TV-and-More/plugin.video.catchuptvandmore/issues/304
        xbmc.executebuiltin("Action(Back,%s)" % xbmcgui.getCurrentWindowId())
        yield False

    else:
        menu_id = item_id

        # If 'menu_id' menu contains only one item, directly open this item
        plugin.redirect_single_item = True

        # Get ordered 'menu_id' menu
        # without disabled and hidden items
        menu = get_sorted_menu(plugin, menu_id)

        if not menu:
            # If the selected menu is empty just reload the current menu
            yield False

        for index, (item_order, item_id, item_infos) in enumerate(menu):

            item = Listitem()

            # Set item label
            item.label = get_item_label(item_id, item_infos)

            # Set item art
            if 'thumb' in item_infos:
                item.art["thumb"] = get_item_media_path(item_infos['thumb'])

            if 'fanart' in item_infos:
                item.art["fanart"] = get_item_media_path(
                    item_infos['fanart'])

            # Set item params
            # If this item requires a module to work, get
            # the module path to be loaded
            if 'module' in item_infos:
                item.params['item_module'] = item_infos['module']

            if 'xmltv_id' in item_infos:
                item.params['xmltv_id'] = item_infos['xmltv_id']

            item.params['item_id'] = item_id

            # Get cllback function of this item
            item_callback = eval(item_infos['callback'])
            item.set_callback(item_callback)

            # Add needed context menus to this item
            add_context_menus_to_item(item,
                                      item_id,
                                      index,
                                      menu_id,
                                      len(menu),
                                      is_playable=(item_infos['callback'] == 'live_bridge'),
                                      item_infos=item_infos)

            yield item