Пример #1
0
def purgeCache():
    files   = sfile.glob(CacheDir)
    nFiles = len(files)

    try:
        while nFiles > gCacheSize:            
            oldestFile = getOldestFile(files)
 
            while sfile.exists(oldestFile):
                try:    sfile.remove(oldestFile)
                except: pass

            files  = sfile.glob(CacheDir)
            nFiles = len(files)
    except:
        pass
Пример #2
0
def main():
    for station in STATIONS.values():
        stationID = str(station[0])
        thumbnail = os.path.join(IMAGES, '%s_icon.png'   % stationID)
        fanart    = os.path.join(IMAGES, '%s_fanart.png' % stationID)

        menu = []

        if station[2] != 0 and ADDON.getSetting(stationID).split(':')[0]:
            menu.append((GETTEXT(30041), 'XBMC.RunPlugin(%s?mode=%d&url=%s)' % (sys.argv[0], _RESET, stationID)))

        addDirectoryItem(getStationName(stationID), url=stationID, mode=_RADIOROOT, thumbnail=thumbnail, fanart=fanart, isFolder=True, isPlayable=False, menu=menu)

    downloadFolder = ADDON.getSetting('DOWNLOAD_FOLDER')
    if downloadFolder:
        import sfile
        if len(sfile.glob(downloadFolder)) > 0:
            addDirectoryItem(GETTEXT(30012), url='', mode=_SHOW_DOWNLOAD, thumbnail=ICON, fanart=FANART, isFolder=True, isPlayable=False)
def getPlugins():
    if not MENU_PLUGINS:
        return []

    import os

    path = xbmc.translatePath(os.path.join(ROOT, 'Plugins'))
    sys.path.insert(0, path)

    plugin = []

    import sfile
    files = sfile.glob(path)

    for name in files:
        name = name.rsplit(os.sep, 1)[1]
        if name.rsplit('.', 1)[-1] == 'py':
            plugin.append(name.rsplit('.', 1)[0])

    plugins = map(__import__, plugin)

    return plugins
Пример #4
0
def getPlugins():
    if not MENU_PLUGINS:
        return []

    import os

    path = xbmc.translatePath(os.path.join(ROOT, 'Plugins'))
    sys.path.insert(0, path)

    plugin  = []

    import sfile
    files = sfile.glob(path)

    for name in files:
        name = name.rsplit(os.sep, 1)[1]
        if name.rsplit('.', 1)[-1] == 'py':
            plugin.append(name .rsplit('.', 1)[0])

    plugins = map(__import__, plugin)

    return plugins