当前位置: 首页>>代码示例>>Python>>正文


Python FileAccess.exists方法代码示例

本文整理汇总了Python中resources.lib.FileAccess.FileAccess.exists方法的典型用法代码示例。如果您正苦于以下问题:Python FileAccess.exists方法的具体用法?Python FileAccess.exists怎么用?Python FileAccess.exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在resources.lib.FileAccess.FileAccess的用法示例。


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

示例1: determineLength

# 需要导入模块: from resources.lib.FileAccess import FileAccess [as 别名]
# 或者: from resources.lib.FileAccess.FileAccess import exists [as 别名]
    def determineLength(self, filename):
        self.log("determineLength " + filename)
        fleName, fleExt = os.path.splitext(filename)
        fleName += '.nfo'
        runtime = 0
        
        if FileAccess.exists(fleName):
            try:
                file = FileAccess.open(fleName, "r")
                dom = parse(file)
                xmlruntime = dom.getElementsByTagName('runtime')[0].toxml()
                runtime = xmlruntime.replace('<runtime>','').replace('</runtime>','')    
                runtime = int(runtime)
            except:
                self.log("Unable to open the file, defaulting to 3600")
                self.log(traceback.format_exc(), xbmc.LOGERROR)
                dur = 3600
                return dur

        if runtime == 0:
            self.log('Unable to find the runtime info, defaulting to 3600')
            dur = 3600
        else:
            dur = int(runtime) * 60

        self.log("Duration is " + str(dur))
        return dur
开发者ID:DrSpaceMonkey,项目名称:script.pseudotv.live,代码行数:29,代码来源:STRMParser.py

示例2: determineLength

# 需要导入模块: from resources.lib.FileAccess import FileAccess [as 别名]
# 或者: from resources.lib.FileAccess.FileAccess import exists [as 别名]
 def determineLength(self, filename):
     self.log("determineLength " + filename)
     fleName, fleExt = os.path.splitext(filename)
     fleName += '.nfo'
     duration = 0
     durationinseconds = 0
     
     if FileAccess.exists(fleName):
         file = FileAccess.open(fleName, "r")
         dom = parse(file)
         
         try:                    
             xmldurationinseconds = dom.getElementsByTagName('durationinseconds')[0].toxml()
             durationinseconds = xmldurationinseconds.replace('<durationinseconds>','').replace('</durationinseconds>','')    
             duration = int(durationinseconds)
         except Exception,e:
             duration = 0
             
         if duration == 0:
             try:
                 xmlruntime = dom.getElementsByTagName('runtime')[0].toxml()
                 runtime = xmlruntime.replace('<runtime>','').replace('</runtime>','').replace(' min.','')    
                 runtime = int(runtime)
                 duration = runtime * 60
             except Exception,e:
                 duration = 0
开发者ID:nantonakos,项目名称:PseudoTV_Live,代码行数:28,代码来源:STRMParser.py

示例3: deleteSkin

# 需要导入模块: from resources.lib.FileAccess import FileAccess [as 别名]
# 或者: from resources.lib.FileAccess.FileAccess import exists [as 别名]
 def deleteSkin(self, selSkin):
     if selSkin == 'Default' or FileAccess.exists(self.SkinPanel.getSelectedItem().getProperty('PTVL.SKINPATH')) == 'false':
         return
     try:
         if yesnoDialog('%s "%s" Skin' %('Delete', selSkin)) == True:
             shutil.rmtree(self.SkinPanel.getSelectedItem().getProperty('PTVL.SKINPATH'))
     except:
         pass
     REAL_SETTINGS.setSetting("SkinSelector",'Default')
     self.closeManager()
开发者ID:PseudoTV,项目名称:PseudoTV_Live,代码行数:12,代码来源:skin.py

示例4: makeXMLTV

# 需要导入模块: from resources.lib.FileAccess import FileAccess [as 别名]
# 或者: from resources.lib.FileAccess.FileAccess import exists [as 别名]
 def makeXMLTV(self, data, filepath):
     self.log('makeXMLTV')
     finished = False
     if not FileAccess.exists(os.path.dirname(filepath)):
         FileAccess.mkdir(os.path.dirname(filepath))
     if FileAccess.exists(filepath):
         FileAccess.delete(filepath)
     fle = open(filepath, "w")
     try:
         xml = data.toxml(encoding='UTF-8');
         log('writing item: %s' % (filepath))
         if FileAccess.exists(filepath):
             finished = True
     except Exception as e:
         xml  = '<?xml version="1.0" encoding="UTF-8"?>'
         xml += '<error>' + str(e) + '</error>';
     xmllst = xml.replace('><','>\n<')
     xmllst = self.cleanChanName(xmllst)
     fle.write("%s" % xmllst)
     fle.close()
     return finished
开发者ID:PseudoTV,项目名称:PseudoTV_Live,代码行数:23,代码来源:ustvnow.py

示例5: donorCHK

# 需要导入模块: from resources.lib.FileAccess import FileAccess [as 别名]
# 或者: from resources.lib.FileAccess.FileAccess import exists [as 别名]
def donorCHK():
    xbmc.log('script.pseudotv.live-service: donorCHK')
    
    DonorPath = (os.path.join(ADDON_PATH, 'resources', 'lib', 'Donor.pyo'))
    DL_DonorPath = (os.path.join(ADDON_PATH, 'resources', 'lib', 'Donor.py'))
    
    if FileAccess.exists(DonorPath):
        REAL_SETTINGS.setSetting("AT_Donor", "true")
        REAL_SETTINGS.setSetting("COM_Donor", "true")
        REAL_SETTINGS.setSetting("TRL_Donor", "true")
        REAL_SETTINGS.setSetting("CAT_Donor", "true")
    elif FileAccess.exists(DL_DonorPath):  
        REAL_SETTINGS.setSetting("AT_Donor", "true")
        REAL_SETTINGS.setSetting("COM_Donor", "true")
        REAL_SETTINGS.setSetting("TRL_Donor", "true")
        REAL_SETTINGS.setSetting("CAT_Donor", "true")
    else:
        REAL_SETTINGS.setSetting("AT_Donor", "false")
        REAL_SETTINGS.setSetting("COM_Donor", "false")
        REAL_SETTINGS.setSetting("TRL_Donor", "false")
        REAL_SETTINGS.setSetting("CAT_Donor", "false")
开发者ID:1c0n,项目名称:XBMC_Addons,代码行数:23,代码来源:service.py

示例6: DeleteSettings2

# 需要导入模块: from resources.lib.FileAccess import FileAccess [as 别名]
# 或者: from resources.lib.FileAccess.FileAccess import exists [as 别名]
def DeleteSettings2():
    log('utilities: DeleteSettings2')
    ClearChanFavorites(False)
    if FileAccess.exists(SETTINGS_FLE):
        if yesnoDialog("Delete Current Channel Configurations?"):
            try:
                REAL_SETTINGS.setSetting("Config","")
                REAL_SETTINGS.setSetting("CurrentChannel","1")
                FileAccess.delete(SETTINGS_FLE)
                infoDialog("Channel Configurations Cleared")
            except:
                pass           
    # Return to PTVL Settings
    REAL_SETTINGS.openSettings()
开发者ID:PseudoTV,项目名称:PseudoTV_Live,代码行数:16,代码来源:utilities.py

示例7: skinMeta

# 需要导入模块: from resources.lib.FileAccess import FileAccess [as 别名]
# 或者: from resources.lib.FileAccess.FileAccess import exists [as 别名]
    def skinMeta(self, skinname):
        skinBasePath = xbmc.translatePath(os.path.join(PTVL_SKIN_LOC,skinname))
        skinBaseURL = 'https://raw.githubusercontent.com/PseudoTV/PseudoTV_Skins/master/'+skinname
        cleanSkin = skinname
        
        #Skin local (already downloaded)
        if FileAccess.exists(os.path.join(skinBasePath,'skin.xml')):
            SkinLocal = 'true' 
            skinBase = skinBasePath
            LocalLogo = 'local.png'
        else:
            SkinLocal = 'false'
            LocalLogo = 'NA.png'
            skinBase = skinBaseURL

        try:
            #Fill Skin meta
            if SkinLocal == 'false':
                xml = open_url(os.path.join(skinBaseURL + '/skin.xml'))
            else:
                xml = open(os.path.join(skinBasePath,'skin.xml'), "r")
                
            dom = parse(xml)
            name = dom.getElementsByTagName('name')
            version = dom.getElementsByTagName('version')
            skinname = dom.getElementsByTagName('skinname') 
            resolutions = dom.getElementsByTagName('defaultresolution') 
            
            version = (version[0].childNodes[0].nodeValue).rstrip()     
            sknname = (skinname[0].childNodes[0].nodeValue).rstrip()  
            resolution = (resolutions[0].childNodes[0].nodeValue).rstrip()
            xml.close()         
        except:
            return
                
        #Skin currently inuse
        CurSkin = 'false'
        if self.CurrentSkin.lower() == sknname.lower():
            CurSkin = 'true'
            sknname = ' [ ' + sknname + ' ]'
        
        #Check PTVL.GUI version
        SkinOld = 'false'
        OutLogo = 'NA.png'
        if version != PTVL_SKINVER:
            SkinOld = 'true'
            OutLogo = os.path.join(IMAGES_LOC,'outdated.png')      
            # sknname += ' OUTDATED, please contact skin developer'
            
        self.SkinItems = xbmcgui.ListItem(label=sknname) 
        self.SkinItems.setProperty('PTVL.isSKINLOCAL',SkinLocal)                 
        self.SkinItems.setProperty('PTVL.SKINLOCAL',LocalLogo)                     
        self.SkinItems.setProperty('PTVL.isSKINSEL',CurSkin)              
        self.SkinItems.setProperty('PTVL.isSKINOUTDATED',SkinOld)       
        self.SkinItems.setProperty('PTVL.SKINOUTDATED',OutLogo)
        self.SkinItems.setProperty('PTVL.SKINNAME',sknname)
        self.SkinItems.setProperty('PTVL.SKIN',cleanSkin)
        self.SkinItems.setProperty('PTVL.SKINRESOLUTION',str(resolution))
        self.SkinItems.setProperty('PTVL.SKINLOGO',os.path.join(skinBase,'logo.png'))
        self.SkinItems.setProperty('PTVL.SKINVERSION','v.'+version)
        self.SkinItems.setProperty('PTVL.SKINAUTHOR','Designed by: ' + name[0].childNodes[0].nodeValue) 
        self.SkinItems.setProperty('PTVL.SKINSHOT1',os.path.join(skinBase,'screenshot01.png'))  
        self.SkinItems.setProperty('PTVL.SKINSHOT2',os.path.join(skinBase,'screenshot02.png')) 
        self.SkinItems.setProperty('PTVL.SKINSHOT3',os.path.join(skinBase,'screenshot03.png'))
        self.SkinItems.setProperty('PTVL.SKINSHOT4',os.path.join(skinBase,'screenshot04.png'))
        self.SkinItems.setProperty("PTVL.SKINPATH", str(skinBasePath)) 
        self.SkinItems.setProperty("PTVL.SKINBASE", str(skinBase))
        self.SkinItems.setProperty("PTVL.SKINURL", str(skinBaseURL))   
        self.SkinItems.setProperty("PTVL.SKINZIP", str(skinBaseURL + '/' + sknname +'.zip'))       
        self.SkinPanel.addItem(self.SkinItems)
        return
开发者ID:PseudoTV,项目名称:PseudoTV_Live,代码行数:73,代码来源:skin.py


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