Exemplo n.º 1
0
def pasteFolderLink(src, dst, folderName, addonid):
    import urllib
    thumbnail, fanart = utils.getFolderThumb(src)

    folderConfig = os.path.join(src, FOLDERCFG)
    colour       = parameters.getParam('COLOUR', folderConfig)

    if colour:
        folderName = '[COLOR %s]%s[/COLOR]' % (colour, folderName)

    path = utils.convertToHome(src)
    path = path.replace(PROFILE, '')
    path = path.replace('\\', '/')
    if path.startswith('/'):
        path = path[1:]

    cmd = '%s?label=%s&mode=%d&folder=%s' % (addonid, folderName, utils._FOLDER, urllib.quote_plus(path))
    cmd = '"%s"' % cmd  
    cmd = cmd.replace('+', '%20')
    cmd = 'ActivateWindow(%d,%s)' % (utils.getCurrentWindowId(), cmd) 
    cmd = favourite.addFanart(cmd, fanart)

    file = os.path.join(dst, FILENAME)

    if favourite.findFave(file, cmd)[0]:
        return True

    faves = favourite.getFavourites(file, validate=False)
    fave  = [folderName, thumbnail, cmd]

    faves.append(fave)

    favourite.writeFavourites(file, faves)

    return True
Exemplo n.º 2
0
def _select(index):
    import utils
    #utils.DialogOK(str(index))
    if index < 0:
        return

    import xbmc
    import utils

    view = 0
    count = 10
    while view < 1 and count > 0:
        count -= 1
        view = utils.getViewType()
        xbmc.sleep(50)

    if view < 1:
        return

    import xbmcgui

    win = None
    count = 10
    while not win and count > 0:
        count -= 1
        try:
            win = xbmcgui.Window(utils.getCurrentWindowId())
        except:
            xbmc.sleep(50)

    if not win:
        return

    list = None
    count = 10
    while not list and count > 0:
        try:
            list = win.getControl(view)
        except:
            xbmc.sleep(50)

    if not list:
        return

    xbmc.sleep(50)

    try:
        nItem = int(xbmcgui.Window(10000).getProperty('SF_NMR_ITEMS'))
        if index >= nItem:
            index = nItem - 1
    except:
        pass

    list.selectItem(index)
Exemplo n.º 3
0
def _select(index):
    import utils
    if index < 0:
        return

    import xbmc
    import utils 

    view  = 0
    count = 50
    while view < 1 and count > 0:
        count -= 1
        view   = utils.getViewType()
        xbmc.sleep(50)

    if view < 1:
        return

    import xbmcgui

    win   = None
    count = 10
    while not win and count > 0:
        count -= 1
        try:    win = xbmcgui.Window(utils.getCurrentWindowId())
        except: xbmc.sleep(50)

    if not win:
        return

    list  = None
    count = 10
    while not list and count > 0:
        try:    list = win.getControl(view)
        except: xbmc.sleep(50)

    if not list:
        return

    xbmc.sleep(50)

    try:    
        nItem = int(xbmcgui.Window(10000).getProperty('SF_NMR_ITEMS'))
        if index >= nItem:           
            index = nItem-1
    except:
        pass

    list.selectItem(index)
Exemplo n.º 4
0
def _select(index):
    if index < 0:
        return

    import xbmc
    import utils

    view = 0
    count = 10
    while view < 1 and count > 0:
        count -= 1
        view = utils.getViewType()
        xbmc.sleep(50)

    if view < 1:
        return

    import xbmcgui

    win = None
    count = 10
    while not win and count > 0:
        count -= 1
        try:
            win = xbmcgui.Window(utils.getCurrentWindowId())
        except:
            xbmc.sleep(50)

    if not win:
        return

    list = None
    count = 10
    while not list and count > 0:
        try:
            list = win.getControl(view)
        except:
            xbmc.sleep(50)

    if not list:
        return

    xbmc.sleep(50)
    list.selectItem(index)
Exemplo n.º 5
0
def _select(index):
    if index < 0:
        return

    import xbmc
    import utils 

    view  = 0
    count = 10
    while view < 1 and count > 0:
        count -= 1
        view   = utils.getViewType()
        xbmc.sleep(50)

    if view < 1:
        return

    import xbmcgui

    win   = None
    count = 10
    while not win and count > 0:
        count -= 1
        try:    win = xbmcgui.Window(utils.getCurrentWindowId())
        except: xbmc.sleep(50)

    if not win:
        return

    list  = None
    count = 10
    while not list and count > 0:
        try:    list = win.getControl(view)
        except: xbmc.sleep(50)

    if not list:
        return

    xbmc.sleep(50)
    list.selectItem(index)