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


Python FileAccess.open方法代码示例

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


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

示例1: CEDownloader

# 需要导入模块: from resources.lib.FileAccess import FileAccess [as 别名]
# 或者: from resources.lib.FileAccess.FileAccess import open [as 别名]
def CEDownloader():
    xbmc.log('script.pseudotv.live-donordownload: CEDownloader')

    CEURL = (BaseURL + 'CEURL.txt')
    CEDEST = xbmc.translatePath(os.path.join(SETTINGS_LOC, 'PTVL_Cinema_Experience_Pack.zip'))
    CEPath = xbmc.translatePath(os.path.join(SETTINGS_LOC))

    if dlg.yesno("PseudoTV Live", "Download Cinema Experience Pack", ""):
        
        try:
            os.remove(xbmc.translatePath(LinkPath))
        except:
            pass
            
        try:
            urllib.urlretrieve(LinkURLPath, (xbmc.translatePath(LinkPath)))
            f = FileAccess.open((xbmc.translatePath(LinkPath)), "r")
            linesLST = f.readlines()
            CEURLPath = linesLST[3]
            
            download(CEURLPath, CEDEST)
            all(CEDEST, CEPath)
            
            if xbmcvfs.exists(CE_LOC):
                REAL_SETTINGS.setSetting("CinemaPack", "true")
            else:
                REAL_SETTINGS.setSetting("CinemaPack", "false")

            os.remove(CEDEST)
        except:
            pass  
            
            REAL_SETTINGS.openSettings()
    else:
        REAL_SETTINGS.openSettings()
开发者ID:TulsaTV,项目名称:script.pseudotv.live,代码行数:37,代码来源:donordownload.py

示例2: getSmartPlaylistName

# 需要导入模块: from resources.lib.FileAccess import FileAccess [as 别名]
# 或者: from resources.lib.FileAccess.FileAccess import open [as 别名]
    def getSmartPlaylistName(self, fle):
        self.log("getSmartPlaylistName " + fle)
        fle = xbmc.translatePath(fle)

        try:
            xml = FileAccess.open(fle, "r")
        except:
            self.log('Unable to open smart playlist')
            return ''

        try:
            dom = parse(xml)
        except:
            xml.close()
            self.log("getSmartPlaylistName return unable to parse")
            return ''

        xml.close()

        try:
            plname = dom.getElementsByTagName('name')
            self.log("getSmartPlaylistName return " + plname[0].childNodes[0].nodeValue)
            return plname[0].childNodes[0].nodeValue
        except:
            self.playlisy('Unable to find element name')

        self.log("getSmartPlaylistName return")
开发者ID:070499,项目名称:XBMC-PseudoTV,代码行数:29,代码来源:config.py

示例3: determineLength

# 需要导入模块: from resources.lib.FileAccess import FileAccess [as 别名]
# 或者: from resources.lib.FileAccess.FileAccess import open [as 别名]
    def determineLength(self, filename):
        self.log("determineLength " + filename)
        self.pid = -1

        try:
            self.File = FileAccess.open(filename, "rb", None)
        except:
            self.log("Unable to open the file")
            return

        self.filesize = self.getFileSize()
        self.packetLength = self.findPacketLength()

        if self.packetLength <= 0:
            return 0

        start = self.getStartTime()
        self.log('Start - ' + str(start))
        end = self.getEndTime()
        self.log('End - ' + str(end))

        if end > start:
            dur = int((end - start) / 90000)
        else:
            dur = 0

        self.File.close()
        self.log("Duration: " + str(dur))
        return dur
开发者ID:1c0n,项目名称:XBMC_Addons,代码行数:31,代码来源:TSParser.py

示例4: LogoDownloader

# 需要导入模块: from resources.lib.FileAccess import FileAccess [as 别名]
# 或者: from resources.lib.FileAccess.FileAccess import open [as 别名]
def LogoDownloader():
    xbmc.log('script.pseudotv.live-donordownload: LogoDownloader')
    
    LogoPath = xbmc.translatePath(os.path.join(SETTINGS_LOC))
    
    if dlg.yesno("PseudoTV Live", "Download Color Logos or No, Download Mono Logos", ""):
        LogoDEST = LogoPath + '/PTVL_Color.zip'
        i = 1
    else:
        LogoDEST = LogoPath + '/PTVL_Mono.zip'
        i = 2

    if not DEFAULT_LOGO_LOC:
        os.makedirs(DEFAULT_LOGO_LOC)
        
    try:
        os.remove(xbmc.translatePath(LinkPath))
    except:
        pass
         
    try:
        urllib.urlretrieve(LinkURLPath, (xbmc.translatePath(LinkPath)))
        f = FileAccess.open((xbmc.translatePath(LinkPath)), "r")
        linesLST = f.readlines()
        LogoURLPath = linesLST[i] 
        download(LogoURLPath, LogoDEST)
        all(LogoDEST, LogoPath)
        REAL_SETTINGS.setSetting("ChannelLogoFolder", DEFAULT_LOGO_LOC)
        os.remove(LogoDEST)
    except:
        pass
        
    REAL_SETTINGS.openSettings()
开发者ID:TulsaTV,项目名称:script.pseudotv.live,代码行数:35,代码来源:donordownload.py

示例5: determineLength

# 需要导入模块: from resources.lib.FileAccess import FileAccess [as 别名]
# 或者: from resources.lib.FileAccess.FileAccess import open [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

示例6: determineLength

# 需要导入模块: from resources.lib.FileAccess import FileAccess [as 别名]
# 或者: from resources.lib.FileAccess.FileAccess import open [as 别名]
    def determineLength(self, filename):
        self.log("determineLength " + filename)

        try:
            self.File = FileAccess.open(filename, "rb")
        except:
            self.log("Unable to open the file")
            return

        if self.verifyFLV() == False:
            self.log("Not a valid FLV")
            self.File.close()
            return 0

        tagheader = self.findLastVideoTag()

        if tagheader is None:
            self.log("Unable to find a video tag")
            self.File.close()
            return 0

        dur = self.getDurFromTag(tagheader)
        self.File.close()
        self.log("Duration: " + str(dur))
        return dur
开发者ID:070499,项目名称:XBMC-PseudoTV,代码行数:27,代码来源:FLVParser.py

示例7: determineLength

# 需要导入模块: from resources.lib.FileAccess import FileAccess [as 别名]
# 或者: from resources.lib.FileAccess.FileAccess import open [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

示例8: determineLength

# 需要导入模块: from resources.lib.FileAccess import FileAccess [as 别名]
# 或者: from resources.lib.FileAccess.FileAccess import open [as 别名]
    def determineLength(self, filename):
        self.log("determineLength " + filename)

        try:
            self.File = FileAccess.open(filename, "rb", None)
        except:
            self.log("Unable to open the file")
            return

        dur = self.readHeader()
        self.File.close()
        self.log("Duration: " + str(dur))
        return dur
开发者ID:PseudoTV,项目名称:PseudoTV_Live,代码行数:15,代码来源:MP4Parser.py

示例9: determineLength

# 需要导入模块: from resources.lib.FileAccess import FileAccess [as 别名]
# 或者: from resources.lib.FileAccess.FileAccess import open [as 别名]
    def determineLength(self, filename):
        self.log("determineLength " + filename)

        try:
            self.File = FileAccess.open(filename, "rb")
        except:
            self.log("Unable to open the file")
            return

        size = self.findHeader()

        if size == 0:
            self.log('Unable to find the segment info')
            dur = 0
        else:
            dur = self.parseHeader(size)

        self.log("Duration is " + str(dur))
        return dur
开发者ID:070499,项目名称:XBMC-PseudoTV,代码行数:21,代码来源:MKVParser.py

示例10: BumperDownloader

# 需要导入模块: from resources.lib.FileAccess import FileAccess [as 别名]
# 或者: from resources.lib.FileAccess.FileAccess import open [as 别名]
def BumperDownloader():
    xbmc.log('script.pseudotv.live-donordownload: BumperDownloader')
    
    BUMPERDEST = xbmc.translatePath(os.path.join(SETTINGS_LOC, 'Bumpers.zip'))
    BumperPath = xbmc.translatePath(os.path.join(SETTINGS_LOC))
     
    try:
        os.remove(BUMPERDEST)
    except:
        pass
    
    if dlg.yesno("PseudoTV Live", "Download Bumpers?", "700Mb File"):
        try:
            os.remove(xbmc.translatePath(LinkPath))
        except:
            pass
         
        try:       
            urllib.urlretrieve(LinkURLPath, (xbmc.translatePath(LinkPath)))
            f = FileAccess.open((xbmc.translatePath(LinkPath)), "r")
            linesLST = f.readlines()
            BumperURLPath = linesLST[0]
            
            download(BumperURLPath, BUMPERDEST)
            all(BUMPERDEST, BumperPath)
                
            REAL_SETTINGS.setSetting("bumpers", "true")
            REAL_SETTINGS.setSetting("bumpersfolder", BUMPER_LOC)
            REAL_SETTINGS.setSetting("numbumpers", "1")
            
            os.remove(BUMPERDEST)
        except:
            pass
    
        REAL_SETTINGS.openSettings()
        
    else:
        REAL_SETTINGS.openSettings()
开发者ID:TulsaTV,项目名称:script.pseudotv.live,代码行数:40,代码来源:donordownload.py

示例11: main

# 需要导入模块: from resources.lib.FileAccess import FileAccess [as 别名]
# 或者: from resources.lib.FileAccess.FileAccess import open [as 别名]
def main():
    pass


import re
import os
import xbmcaddon, xbmc, xbmcgui

from resources.lib.Globals import *
from resources.lib.Settings import *
from resources.lib.FileAccess import FileAccess


flename = xbmc.translatePath(os.path.join(Globals.SETTINGS_LOC, 'settings2.xml'))  
flenname = xbmc.translatePath(os.path.join(Globals.SETTINGS_LOC, 'new_settings2.xml'))  
OpnFil = FileAccess.open(flename, "rb")
WrtFil = FileAccess.open(flename, "w")
WrtFil.write('<settings> \n')
WrtFil.write('    ' + '<setting id="Version" value="2.1.0" />\n')                        


    # Number of total lines in Settings2.xml file
nr_of_lines = sum(1 for line in FileAccess.open(flename))

# def simplecount(filename):
    # lines = 0
    # for line in FileAccess.open(flename):
        # lines += 1
    # return nr_of_lines

    # Procedure to get the total number of channels for this Settings2.xml file
开发者ID:DrSpaceMonkey,项目名称:script.pseudotv.live,代码行数:33,代码来源:defrag.py


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