• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python sfile.walk函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sfile.walk函数的典型用法代码示例。如果您正苦于以下问题:Python walk函数的具体用法?Python walk怎么用?Python walk使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了walk函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: getAllChannels

def getAllChannels(alphaSort = False):
    channels = []

    try:
        current, dirs, files = sfile.walk(TVP_CHANNELS)
    except Exception, e:
        return channels
开发者ID:noobsandnerds,项目名称:noobsandnerds,代码行数:7,代码来源:default.py


示例2: isPlayable

def isPlayable(path, ignore, maxAge=-1):
    if not sfile.exists(path):
        return False

    if sfile.isfile(path):
        playable = isFilePlayable(path, maxAge)
        return playable

    try:
        if sfile.getfilename(path)[0] in ignore:
            return False
    except:
        pass
         
    current, dirs, files = sfile.walk(path)

    for file in files:
        if isPlayable(os.path.join(current, file), ignore, maxAge):
            return True

    for dir in dirs:
        try: 
            if isPlayable(os.path.join(current, dir), ignore, maxAge):
                return True
        except:
            pass

    return False
开发者ID:TheLivebox,项目名称:TheLiveBox,代码行数:28,代码来源:utils.py


示例3: newChannel

def newChannel():
    title = ''

    while True:
        title = getText('Please enter channel name', title)
        if not title :
            return False

        id = createID(title)

        try:
            current, dirs, files = sfile.walk(TVP_CHANNELS)
        except Exception, e:
            return False

        duplicate = False
    
        for file in files:
            if id.lower() == file.lower():
                duplicate = True
                break

        if not duplicate:
            break

        utils.DialogOK('%s clashes with an existing channel.' % title, 'Please enter a different name.')
开发者ID:noobsandnerds,项目名称:noobsandnerds,代码行数:26,代码来源:default.py


示例4: _locateSuperFavourites

    def _locateSuperFavourites(self, title, folder, items):    
        import sfile  
        import settings
        import urllib
        current, dirs, files = sfile.walk(folder)

        for dir in dirs:    
            folder = os.path.join(current, dir)    
            if dir.lower() == title:
                cfg      = os.path.join(folder, 'folder.cfg')
                autoplay = settings.get('AUTOPLAY', cfg)

                if autoplay:
                    uTitle  = urllib.quote_plus(title)
                    mode    = 5400
                    uFolder = urllib.quote_plus(folder)
                    toAdd   = 'plugin://plugin.program.super.favourites/?label=%s&mode=%d&path=%s' % (uTitle, mode, uFolder)
                else:               
                    uTitle  = urllib.quote_plus(title)
                    mode    = 400
                    uFolder = urllib.quote_plus(folder)
                    toAdd   = 'plugin://plugin.program.super.favourites/?label=%s&mode=%d&path=%s' % (uTitle, mode, uFolder)
                    toAdd   = '__SF__ActivateWindow(10025,"%s",return)' % toAdd
                    
                items.append(['SF_'+folder, toAdd])

            self._locateSuperFavourites(title, folder, items)
开发者ID:abauerx,项目名称:Dixie-Deans-XBMC-Repo,代码行数:27,代码来源:streaming.py


示例5: _locateSuperFavourites

    def _locateSuperFavourites(self, title, folder, items):    
        import sfile  
        import settings
        import urllib
        current, dirs, files = sfile.walk(folder)
         
        for dir in dirs:    
            folder = os.path.join(current, dir)

# check against SF list, if it exists then match up
            if dir.upper() == title:
#                cfg      = os.path.join(folder, 'folder.cfg')
#                autoplay = settings.get('AUTOPLAY', cfg)

                if autoplay == 'true':
                    uTitle  = urllib.quote_plus(title)
                    mode    = 5400
                    uFolder = urllib.quote_plus(folder)
                    toAdd   = 'plugin://plugin.program.super.favourites/?label=%s&mode=%d&path=%s' % (uTitle, mode, uFolder)
                else:               
                    uTitle  = urllib.quote_plus(title)
                    mode    = 400
                    uFolder = urllib.quote_plus(folder)
                    toAdd   = 'plugin://plugin.program.super.favourites/?label=%s&mode=%d&path=%s' % (uTitle, mode, uFolder)
                    toAdd   = '__SF__ActivateWindow(10025,"%s",return)' % toAdd
                xbmc.log('##### FOLDER: %s' % folder)
                if os.path.exists(xbmc.translatePath(os.path.join(folder,'favourites.xml'))):
                    items.append(['SF_'+folder, toAdd])

            self._locateSuperFavourites(title, folder, items)
开发者ID:Quihico,项目名称:repository.spartacus,代码行数:30,代码来源:streaming.py


示例6: populateChannels

    def populateChannels(self, alphaSort = False):
        channels = []

        try:
            current, dirs, files = sfile.walk(OTT_CHANNELS)
        except Exception, e:
            return channels
开发者ID:abauerx,项目名称:Dixie-Deans-XBMC-Repo,代码行数:7,代码来源:osd.py


示例7: _parseFolder

def _parseFolder(folder, root, subfolders, ignore, maxAge=-1):
    items = []

    if not folder:
        folder = getExternalDrive()
        if isPlayable(folder, ignore, maxAge):
            items.append([root, folder, False, True])
        return items

    current, dirs, files = sfile.walk(folder)

    if subfolders:
        for dir in dirs:        
            path = os.path.join(current, dir)
            if dir.endswith('_PLAYALL'):
                items.append([dir.rsplit('_PLAYALL', 1)[0], path, True, True])
            elif isPlayable(path, ignore, maxAge):
                items.append([dir, path, False, True])

    for file in files:
        path = os.path.join(current, file)
        if isPlayable(path, ignore, maxAge):
            items.append([removeExtension(file), path, True, False])

    return items
开发者ID:TheLivebox,项目名称:TheLiveBox,代码行数:25,代码来源:utils.py


示例8: getAllChannels

    def getAllChannels(self):
        channels = []

        try:
            current, dirs, files = sfile.walk(channelPath)
        except Exception, e:
            dixie.log('Error in getAllChannels' % str(e))
            return channels
开发者ID:jaffa222,项目名称:Dixie-Deans-XBMC-Repo,代码行数:8,代码来源:source.py


示例9: sf_check

def sf_check(channels,weight):
    sfchans     = []
    newchans    = []
# Grab a list of all the SF folders with a favourites.xml
    dixie.log('Checking for new SF folders')
    try:
        current, dirs, files = sfile.walk(SF_CHANNELS)
    except Exception, e:
        dixie.log('Error in getAllChannels - SF List: %s' % str(e))
开发者ID:noobsandnerds,项目名称:noobsandnerds,代码行数:9,代码来源:launch.py


示例10: populateChannels

 def populateChannels(self, alphaSort = False):
     channels = []
     channelarray = []
     SFchannelarray = []
     try:
         current, dirs, files = sfile.walk(OTT_CHANNELS)
     except Exception, e:
         dixie.log('### Failed to scan master channel list: %s' % str(e))
         return channelarray
开发者ID:noobsandnerds,项目名称:Dixie-Deans-XBMC-Repo,代码行数:9,代码来源:osd.py


示例11: SF_Folder_Count

def SF_Folder_Count(foldermode):
    channelFolder  =  GetChannelFolder()
    channelPath    =  os.path.join(channelFolder,'channels')
    channels       = []
    channelarray   = []
    SFchannelarray = []

    try:
        current, dirs, files = sfile.walk(channelPath)
    except Exception, e:
        log('Error in getAllChannels - Master List: %s' % str(e))
        return channels
开发者ID:Quihico,项目名称:repository.spartacus,代码行数:12,代码来源:dixie.py


示例12: CheckForChannels

def CheckForChannels():
    dir    = dixie.GetChannelFolder()
    folder = os.path.join(dir, 'channels')
    files  = []
    try:    current, dirs, files = sfile.walk(folder)
    except: pass
    if len(files) == 0:
        dixie.SetSetting('updated.channels', -1) # force refresh of channels
    
    backup = os.path.join(dir, 'channels-backup')
    if not sfile.exists(backup):
        dixie.BackupChannels()
开发者ID:abauerx,项目名称:Dixie-Deans-XBMC-Repo,代码行数:12,代码来源:launch.py


示例13: _getAllPlayableFiles

def _getAllPlayableFiles(folder, theFiles):
    current, dirs, files = sfile.walk(folder)

    for dir in dirs:        
        path = os.path.join(current, dir)
        _getAllPlayableFiles(path, theFiles)

    for file in files:
        path = os.path.join(current, file)
        if isPlayable(path, ignore=[]):
            size = sfile.size(path)
            theFiles[path] = [path, size]
开发者ID:TheLivebox,项目名称:TheLiveBox,代码行数:12,代码来源:utils.py


示例14: patchSkins

def patchSkins():
    skinPath = os.path.join(extras, 'skins')

    srcImage = os.path.join(RESOURCES, 'changer.png')
    srcFile  = os.path.join(RESOURCES, 'script-tvguide-changer.xml')

    current, dirs, files = sfile.walk(skinPath)

    for dir in dirs:
        dstImage = os.path.join(current, dir, 'resources', 'skins', 'Default', 'media', 'changer.png')
        dstFile  = os.path.join(current, dir, 'resources', 'skins', 'Default', '720p', 'script-tvguide-changer.xml')

        sfile.copy(srcImage, dstImage, overWrite=False)
        sfile.copy(srcFile,  dstFile,  overWrite=False)
开发者ID:Quihico,项目名称:repository.spartacus,代码行数:14,代码来源:dixie.py


示例15: restoreChannels

def restoreChannels():
    src = os.path.join(datapath, 'channels-backup')
    dst = os.path.join(datapath, 'channels')

    if not sfile.exists(src):
        return False
    
    try:
        current, dirs, files = sfile.walk(src)
        for file in files:
            full = os.path.join(current, file)
            sfile.copy(full,  dst)
    except Exception, e:
        print str(e)
        return False
开发者ID:abauerx,项目名称:Dixie-Deans-XBMC-Repo,代码行数:15,代码来源:restoreChannels.py


示例16: _removePartFiles

def _removePartFiles(folder, recurse=True):
    current, dirs, files = sfile.walk(folder)

    for file in files:
        if file.endswith('.part'):
            file = os.path.join(current, file)
            tidyUp(file.rsplit('.part', 1)[0])
            #sfile.remove(file)
            #sfile.remove(file.rsplit('.part', 1)[0])

    if not recurse:
        return

    for dir in dirs:        
        folder = os.path.join(current, dir)
        _removePartFiles(folder, recurse)
开发者ID:TheLivebox,项目名称:TheLiveBox,代码行数:16,代码来源:utils.py


示例17: extract

def extract(src, dp):
    success = False
    try:
        src = xbmc.translatePath(src)
        import zipfile

        update = os.path.join(PROFILE, 'update')
        update = xbmc.translatePath(update)
        sfile.makedirs(update)

        zin   = zipfile.ZipFile(src, 'r')
        nItem = float(len(zin.infolist()))

        index = 0
        for item in zin.infolist():
            index += 1

            percent  = int(index / nItem *100)
            #filename = item.filename

            zin.extract(item, update)
  
            if dp:
                dp.update(percent, utils.GETTEXT(30118), utils.GETTEXT(30080))

        addons = os.path.join('special://home', 'addons')
        current, folders, files = sfile.walk(update)

        for folder in folders:
            ori = os.path.join(addons, folder)
            src = os.path.join(current, folder)
            dst = os.path.join(addons, folder + '.temp')
            sfile.copytree(src, dst)
            sfile.rmtree(ori)
            while not sfile.exists(dst):
                xbmc.sleep(100)
            while sfile.exists(ori):
                xbmc.sleep(100)
            sfile.rename(dst, ori)   

        success = True
    except:
        success = False

    sfile.delete(update)
    return success
开发者ID:TheLivebox,项目名称:TheLiveBox,代码行数:46,代码来源:checkUpdates.py


示例18: parseFolder

def parseFolder(folder, subfolders=True):
    items = []

    current, dirs, files = sfile.walk(folder)

    if subfolders:
        for dir in dirs:        
            path = os.path.join(current, dir)
            if isPlayable(path):
                items.append([dir, path, False])

    for file in files:
        path = os.path.join(current, file)
        if isPlayable(path):
            items.append([file, path, True])

    return items
开发者ID:XvBMC,项目名称:spoyser-repo,代码行数:17,代码来源:utils.py


示例19: getFaves

    def getFaves(self):
        file  = os.path.join(self.FULLPATH, FILENAME).decode('utf-8')        
        faves = []        

        index = 0

        label_numeric = LABEL_NUMERIC 
        if self.MODE == 'folder':    
            folderCfg = os.path.join(self.FULLPATH, FOLDERCFG)
            numeric = parameters.getParam('NUMERICAL', folderCfg)
            if numeric:
                label_numeric = numeric.lower() == 'true'

        if label_numeric:
            label_numeric = LABEL_NUMERIC_QL

        if self.MODE != 'xbmc':        
            try:    
                current, dirs, files = sfile.walk(self.FULLPATH)

                dirs = sorted(dirs, key=str.lower)

                for dir in dirs:
                    path = os.path.join(self.FULLPATH, dir)
                                   
                    folderCfg = os.path.join(path, FOLDERCFG)
                    folderCfg = parameters.getParams(folderCfg)
                    lock      = parameters.getParam('LOCK',   folderCfg)
                    if lock:
                        continue
                    colour    = parameters.getParam('COLOUR', folderCfg)
                    thumb     = getFolderThumb(path)               

                    label = dir
                
                    if colour and colour.lower() <> 'none':
                        label = '[COLOR %s]%s[/COLOR]' % (colour, label)
              
                    label, index = utils.addPrefixToLabel(index, label, label_numeric)
                
                    fave = [label, thumb, os.path.join(self.PATH, dir),  True]
                    faves.append(fave)
                
            except Exception, e:
                pass
开发者ID:daviddicken,项目名称:spoyser-repo,代码行数:45,代码来源:chooser.py


示例20: parseFolder

def parseFolder(folder):
    try:    current, dirs, files = sfile.walk(folder)
    except: return []

    items = []

    for file in files:
        try:
            path = os.path.join(current, file)
            file = file.rsplit('.', 1)
            ext  = file[-1]
            file = file[0]            
            if ext in PLAYLIST_EXT:
                items.append([path, file])
        except:
            pass

    return items
开发者ID:AMOboxTV,项目名称:AMOBox.LegoBuild,代码行数:18,代码来源:playlist.py



注:本文中的sfile.walk函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sflib.SpiderFoot类代码示例发布时间:2022-05-27
下一篇:
Python sfile.remove函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap