Exemple #1
0
def route(pathitems):
    """Route to the appropriate handler"""
    common.debug('Routing navigation request')
    root_handler = pathitems[0] if pathitems else g.MODE_DIRECTORY
    if root_handler == g.MODE_PLAY:
        player.play(pathitems=pathitems[1:])
    elif root_handler == 'extrafanart':
        common.debug('Ignoring extrafanart invocation')
        xbmcplugin.endOfDirectory(handle=g.PLUGIN_HANDLE, succeeded=False)
    elif root_handler not in NAV_HANDLERS:
        raise nav.InvalidPathError('No root handler for path {}'.format(
            '/'.join(pathitems)))
    else:
        nav.execute(NAV_HANDLERS[root_handler], pathitems[1:],
                    g.REQUEST_PARAMS)
def route(pathitems):
    """Route to the appropriate handler"""
    debug('Routing navigation request')
    root_handler = pathitems[0] if pathitems else g.MODE_DIRECTORY
    if root_handler == g.MODE_PLAY:
        from resources.lib.navigation.player import play
        play(videoid=pathitems[1:])
        return
    if root_handler == 'extrafanart':
        warn('Route: ignoring extrafanart invocation')
        _handle_endofdirectory()
        return
    nav_handler = _get_nav_handler(root_handler)
    if not nav_handler:
        from resources.lib.navigation import InvalidPathError
        raise InvalidPathError('No root handler for path {}'.format('/'.join(pathitems)))
    from resources.lib.navigation import execute
    execute(_get_nav_handler(root_handler), pathitems[1:], g.REQUEST_PARAMS)