Example #1
0
def removeFanartFave(file, cmd):
    fave, index, nFaves = favourite.findFave(file, cmd)

    fave[2] = favourite.removeFanart(cmd)

    favourite.updateFave(file, fave)
    return True
Example #2
0
def removeFanartFave(file, cmd):
    fave, index, nFaves = favourite.findFave(file, cmd)

    fave[2] = favourite.removeFanart(cmd)

    favourite.updateFave(file, fave)
    return True
Example #3
0
def addToXBMC(name, thumb, cmd):
    cmd = '"%s"' % cmd

    folder = '&mode=%d' % _FOLDER
    search = '&mode=%d' % _SUPERSEARCH
    edit   = '&mode=%d' % _EDITTERM

    if (folder in cmd) or (search in cmd) or (edit in cmd):
        cmd = cmd.replace('+', '%20')
        cmd = 'ActivateWindow(%d,%s)' % (xbmcgui.getCurrentWindowId(), cmd)
    else:
        cmd = 'PlayMedia(%s)' % cmd

    fave = [name, thumb, cmd]

    file = os.path.join(xbmc.translatePath('special://profile'), FILENAME)

    #if it is already in there don't add again
    if favourite.findFave(file, cmd)[0]:
        return False

    faves = favourite.getFavourites(file)
    faves.append(fave)

    favourite.writeFavourites(file, faves)

    return True
Example #4
0
def verifySuperSearch():
    dst = os.path.join(xbmc.translatePath(ROOT), 'Search')
    src = os.path.join(HOME, 'resources', 'Search', FILENAME)

    try:
        os.makedirs(dst)
    except:
        pass

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

    if not os.path.exists(dst):
        try:
            import shutil
            shutil.copyfile(src, dst)
        except:
            pass
        return

    import favourite

    new = favourite.getFavourites(src, validate=False)
    line1 = GETTEXT(30123)
    line2 = GETTEXT(30124)

    for item in new:
        fave, index, nFaves = favourite.findFave(dst, item[2])
        if index < 0:
            line = line1 % item[0]
            if DialogYesNo(line1=line, line2=line2):
                favourite.addFave(dst, item)
Example #5
0
def addToXBMC(name, thumb, cmd):    
    cmd = '"%s"' % cmd   

    folder   = '&mode=%d' % _FOLDER
    search   = '&mode=%d' % _SUPERSEARCH
    edit     = '&mode=%d' % _EDITTERM
    #activate = '&mode=%d' % _ACTIVATEWINDOW   

    #if (folder in cmd) or (search in cmd) or (edit in cmd) or (activate in cmd):
    if (folder in cmd) or (search in cmd) or (edit in cmd):
        cmd = cmd.replace('+', '%20')
        cmd = 'ActivateWindow(%d,%s)' % (getCurrentWindowId(), cmd)
    else:
        cmd = 'PlayMedia(%s)' % cmd

    if (search in cmd) and ('keyword' not in cmd):
        replace = '%s&keyword=%s' % (search, ISEARCH_EMPTY)
        cmd = cmd.replace(search, replace)
        if not cmd.lower().endswith(',return)'):
            cmd = cmd[:-1] + ',return)'
   
    fave = [name, thumb, cmd]

    file = os.path.join(xbmc.translatePath('special://profile'), FILENAME)

    #if it is already in there don't add again
    if favourite.findFave(file, cmd)[0]:
        return False

    faves = favourite.getFavourites(file)
    faves.append(fave)

    favourite.writeFavourites(file, faves)

    return True
Example #6
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
Example #7
0
def verifySuperSearch():
    dst = os.path.join(xbmc.translatePath(ROOT), 'Search')
    src = os.path.join(HOME, 'resources', 'Search', FILENAME)

    try:    os.makedirs(dst)
    except: pass

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

    if not os.path.exists(dst):
        try:
            import shutil
            shutil.copyfile(src, dst)
        except:
            pass
        return


    import favourite

    new   = favourite.getFavourites(src, validate=False)
    line1 = GETTEXT(30123)
    line2 = GETTEXT(30124)

    for item in new:
        fave, index, nFaves = favourite.findFave(dst, item[2])
        if index < 0:
            line = line1 % item[0]
            if DialogYesNo(line1=line, line2=line2):
                favourite.addFave(dst, item)
Example #8
0
def pasteCopy(file, cmd, folder):
    copy, index, nFaves = favourite.findFave(file, cmd)
    if not copy:
        return False

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

    return favourite.copyFave(file, copy)
Example #9
0
def thumbFave(file, cmd):
    image = getImage()

    if not image:
        return False

    fave, index, nFaves = favourite.findFave(file, cmd)
    fave[1] = image

    return favourite.updateFave(file, fave)
Example #10
0
def removeThumbFave(file, cmd):
    fave, index, nFaves = favourite.findFave(file, cmd)

    if len(fave[1]) < 1:
        return False

    fave[1] = ''

    favourite.updateFave(file, fave)
    return True
Example #11
0
def removeThumbFave(file, cmd):
    fave, index, nFaves = favourite.findFave(file, cmd)

    if len(fave[1]) < 1:
        return False

    fave[1] = ''

    favourite.updateFave(file, fave)
    return True
Example #12
0
def thumbFave(file, cmd):
    image = getImage()

    if not image:
        return False

    fave, index, nFaves = favourite.findFave(file, cmd)
    fave[1] = image

    return favourite.updateFave(file, fave)
Example #13
0
def fanartFave(file, cmd):
    image = getImage()

    if not image:
        return False

    fave, index, nFaves = favourite.findFave(file, cmd)
    fave[2] = favourite.addFanart(fave[2], image)

    return favourite.updateFave(file, fave)
Example #14
0
def renameFave(file, cmd):
    fave, index, nFaves = favourite.findFave(file, cmd)
    if not fave:
        return False

    newName = getText(GETTEXT(30021), text=fave[0])

    if not newName:
        return False

    return favourite.renameFave(file, cmd, newName)
Example #15
0
def renameFave(file, cmd):
    fave, index, nFaves = favourite.findFave(file, cmd)
    if not fave:
        return False

    newName = getText(GETTEXT(30021), text=fave[0])

    if not newName:
        return False

    return favourite.renameFave(file, cmd, newName)
Example #16
0
def fanartFave(file, cmd):
    image = getImage()

    if not image:
        return False

    fave, index, nFaves = favourite.findFave(file, cmd)

    fave[2] = favourite.addFanart(fave[2], image)

    return favourite.updateFave(file, fave)
Example #17
0
def copyFave(file, cmd, move=False):
    copy, index, nFaves = favourite.findFave(file, cmd)
    if not copy:
        return False

    text = GETTEXT(30020) if move else GETTEXT(30019)

    folder = getFolder(text)
    if not folder:
        return False

    file = os.path.join(folder, FILENAME)
    return favourite.copyFave(file, copy)
Example #18
0
def copyFave(file, cmd, move=False):
    copy, index, nFaves = favourite.findFave(file, cmd)
    if not copy:
        return False

    text = GETTEXT(30020) if move else GETTEXT(30019)

    folder = getFolder(text)
    if not folder:
        return False
  
    file  = os.path.join(folder, FILENAME)
    return favourite.copyFave(file, copy)
Example #19
0
def verifySuperSearch():
    src = os.path.join(xbmc.translatePath(ROOT), 'Search')
    dst = os.path.join(xbmc.translatePath(ROOT), 'S')

    renameFolder(src, dst)

    dst = os.path.join(xbmc.translatePath(ROOT), 'S')
    src = os.path.join(HOME, 'resources', 'Search', FILENAME)

    try:    os.makedirs(dst)
    except: pass

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

    if not os.path.exists(dst):
        try:
            import shutil
            shutil.copyfile(src, dst)
        except:
            pass
        return

    try:
        #patch any changes
        ch1 = open(dst, 'r')
        xml = ch1.read()
        ch1.close()

        xml = xml.replace('1channel/?mode=7000', '1channel/?mode=Search')
        xml = xml.replace('plugin.video.genesis/?action=actors_movies', 'plugin.video.genesis/?action=people_movies')
        xml = xml.replace('plugin.video.genesis/?action=actors_shows',  'plugin.video.genesis/?action=people_shows')

        ch1 = open(dst, 'w')
        ch1.write(xml)            
        ch1.close()
    except:
        pass

    import favourite

    new   = favourite.getFavourites(src, validate=False)
    line1 = GETTEXT(30123)
    line2 = GETTEXT(30124)

    for item in new:
        fave, index, nFaves = favourite.findFave(dst, item[2])
        if index < 0:
            line = line1 % item[0]
            if DialogYesNo(line1=line, line2=line2):
                favourite.addFave(dst, item)
Example #20
0
def verifySuperSearch():
    old = os.path.join(ROOT, 'Search')
    dst = os.path.join(ROOT, 'S')

    sfile.rename(old, dst)

    try:
        sfile.makedirs(dst)
    except:
        pass

    src = os.path.join(HOME, 'resources', 'search', FILENAME)
    dst = os.path.join(dst, FILENAME)

    if not sfile.exists(dst):
        sfile.copy(src, dst)

    try:
        #patch any changes
        xml = sfile.read(dst)

        xml = xml.replace('is/?action=movies_search&',
                          'is/?action=movieSearch&')
        xml = xml.replace('is/?action=people_movies&',
                          'is/?action=moviePerson&')
        xml = xml.replace('is/?action=shows_search&', 'is/?action=tvSearch&')
        xml = xml.replace('is/?action=people_shows&', 'is/?action=tvPerson&')

        f = sfile.file(dst, 'w')
        f.write(xml)
        f.close()
    except:
        pass

    import favourite

    new = favourite.getFavourites(src, validate=False)

    #line1 = GETTEXT(30123)
    #line2 = GETTEXT(30124)

    for item in new:
        fave, index, nFaves = favourite.findFave(dst, item[2])
        if index < 0:
            #line = line1 % item[0]
            #if DialogYesNo(line1=line, line2=line2):
            favourite.addFave(dst, item)
Example #21
0
def verifySuperSearch():
    src = os.path.join(ROOT, 'Search')
    dst = os.path.join(ROOT, 'S')

    sfile.rename(src, dst)

    dst = os.path.join(ROOT, 'S')
    src = os.path.join(HOME, 'resources', 'Search', FILENAME)

    try:
        sfile.makedirs(dst)
    except:
        pass

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

    if not sfile.exists(dst):
        sfile.copy(src, dst)

    try:
        #patch any changes
        xml = sfile.read(dst)

        xml = xml.replace('1channel/?mode=7000', '1channel/?mode=Search')
        xml = xml.replace('plugin.video.genesis/?action=actors_movies',
                          'plugin.video.genesis/?action=people_movies')
        xml = xml.replace('plugin.video.genesis/?action=actors_shows',
                          'plugin.video.genesis/?action=people_shows')

        f = sfile.file(dst, 'w')
        f.write(xml)
        f.close()
    except:
        pass

    import favourite

    new = favourite.getFavourites(src, validate=False)
    line1 = GETTEXT(30123)
    line2 = GETTEXT(30124)

    for item in new:
        fave, index, nFaves = favourite.findFave(dst, item[2])
        if index < 0:
            line = line1 % item[0]
            if DialogYesNo(line1=line, line2=line2):
                favourite.addFave(dst, item)
Example #22
0
def addToXBMC(name, thumb, cmd):
    p = get_params(cmd.replace('?', '&'))
    try:
        mode = int(p['mode'])
        if mode == _FOLDER:
            label = urllib.unquote_plus(p['label'])
            path = urllib.unquote_plus(p['path'])
            path = favourite.convertToHome(path)
            cmd = '%s?label=%s&mode=%d&path=%s' % (sys.argv[0], label, _FOLDER,
                                                   urllib.quote_plus(path))
    except:
        pass

    cmd = '"%s"' % cmd

    folder = '&mode=%d' % _FOLDER
    search = '&mode=%d' % _SUPERSEARCH
    edit = '&mode=%d' % _EDITTERM

    if (folder in cmd) or (search in cmd) or (edit in cmd):
        cmd = cmd.replace('+', '%20')
        cmd = 'ActivateWindow(%d,%s,return)' % (getCurrentWindowId(), cmd)
    else:
        cmd = 'PlayMedia(%s)' % cmd

    if (search in cmd) and ('keyword' not in cmd):
        replace = '%s&keyword=%s' % (search, ISEARCH_EMPTY)
        cmd = cmd.replace(search, replace)
        if not cmd.lower().endswith(',return)'):
            cmd = cmd[:-1] + ',return)'

    fave = [name, thumb, cmd]

    file = os.path.join(xbmc.translatePath('special://profile'), FILENAME)

    #if it is already in there don't add again
    if favourite.findFave(file, cmd)[0]:
        return False

    faves = favourite.getFavourites(file, validate=False)

    faves.append(fave)

    favourite.writeFavourites(file, faves)

    return True
def verifySuperSearch():
    src = os.path.join(ROOT, "Search")
    dst = os.path.join(ROOT, "S")

    sfile.rename(src, dst)

    dst = os.path.join(ROOT, "S")
    src = os.path.join(HOME, "resources", "Search", FILENAME)

    try:
        sfile.makedirs(dst)
    except:
        pass

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

    if not sfile.exists(dst):
        sfile.copy(src, dst)

    try:
        # patch any changes
        xml = sfile.read(dst)

        xml = xml.replace("1channel/?mode=7000", "1channel/?mode=Search")
        xml = xml.replace("plugin.video.genesis/?action=actors_movies", "plugin.video.genesis/?action=people_movies")
        xml = xml.replace("plugin.video.genesis/?action=actors_shows", "plugin.video.genesis/?action=people_shows")

        f = sfile.file(dst, "w")
        f.write(xml)
        f.close()
    except:
        pass

    import favourite

    new = favourite.getFavourites(src, validate=False)
    line1 = GETTEXT(30123)
    line2 = GETTEXT(30124)

    for item in new:
        fave, index, nFaves = favourite.findFave(dst, item[2])
        if index < 0:
            line = line1 % item[0]
            if DialogYesNo(line1=line, line2=line2):
                favourite.addFave(dst, item)
Example #24
0
def addToXBMC(name, thumb, cmd):
    p = get_params(cmd.replace('?', '&'))
    try: 
        mode = int(p['mode'])
        if mode == _FOLDER:
            label = urllib.unquote_plus(p['label'])
            path  = urllib.unquote_plus(p['path'])
            path  = favourite.convertToHome(path)
            cmd   = '%s?label=%s&mode=%d&path=%s' % (sys.argv[0], label, _FOLDER, urllib.quote_plus(path))
    except:
        pass

    cmd = '"%s"' % cmd   
    
    folder   = '&mode=%d' % _FOLDER
    search   = '&mode=%d' % _SUPERSEARCH
    edit     = '&mode=%d' % _EDITTERM

    if (folder in cmd) or (search in cmd) or (edit in cmd):
        cmd = cmd.replace('+', '%20')
        cmd = 'ActivateWindow(%d,%s,return)' % (getCurrentWindowId(), cmd)
    else:
        cmd = 'PlayMedia(%s)' % cmd

    if (search in cmd) and ('keyword' not in cmd):
        replace = '%s&keyword=%s' % (search, ISEARCH_EMPTY)
        cmd = cmd.replace(search, replace)
        if not cmd.lower().endswith(',return)'):
            cmd = cmd[:-1] + ',return)'
   
    fave = [name, thumb, cmd]

    file = os.path.join(xbmc.translatePath('special://profile'), FILENAME)

    #if it is already in there don't add again
    if favourite.findFave(file, cmd)[0]:
        return False    

    faves = favourite.getFavourites(file, validate=False)

    faves.append(fave)

    favourite.writeFavourites(file, faves)

    return True
Example #25
0
def verifySuperSearch():
    old = os.path.join(ROOT, 'Search')
    dst = os.path.join(ROOT, 'S')

    sfile.rename(old, dst)

    try:    sfile.makedirs(dst)
    except: pass

    src = os.path.join(HOME, 'resources', 'search', FILENAME)
    dst = os.path.join(dst, FILENAME)

    if not sfile.exists(dst):
        sfile.copy(src, dst)

    try:
        #patch any changes
        xml = sfile.read(dst)

        xml = xml.replace('is/?action=movies_search&', 'is/?action=movieSearch&')
        xml = xml.replace('is/?action=people_movies&', 'is/?action=moviePerson&')
        xml = xml.replace('is/?action=shows_search&',  'is/?action=tvSearch&')
        xml = xml.replace('is/?action=people_shows&',  'is/?action=tvPerson&')


        f = sfile.file(dst, 'w')
        f.write(xml)            
        f.close()
    except:
        pass

    import favourite

    new = favourite.getFavourites(src, validate=False)

    #line1 = GETTEXT(30123)
    #line2 = GETTEXT(30124)

    for item in new:
        fave, index, nFaves = favourite.findFave(dst, item[2])
        if index < 0:
            #line = line1 % item[0]
            #if DialogYesNo(line1=line, line2=line2):
            favourite.addFave(dst, item)
Example #26
0
def cutCopy(file, cmd, cut=True):
    reset()
    xbmcgui.Window(10000).setProperty('SF_FILE',   file)
    xbmcgui.Window(10000).setProperty('SF_FOLDER', file.rsplit(os.sep, 1)[0])
    xbmcgui.Window(10000).setProperty('SF_CMD',    cmd)
    xbmcgui.Window(10000).setProperty('SF_TYPE',  'cut' if cut else 'copy')

    fave, index, nFaves = favourite.findFave(file, cmd)

    if index < 0:
        return

    thumb  = fave[1]
    fanart = favourite.getFanart(fave[2])
    desc   = favourite.getOption(fave[2], 'desc')
    meta   = favourite.getOption(fave[2], 'meta')
    meta   = utils.convertURLToDict(meta)

    _setPasteProperties(thumb, fanart, desc, meta=meta)

    return True