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


Python FileAccess.FileAccess类代码示例

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


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

示例1: determineLength

 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,代码行数:26,代码来源:STRMParser.py

示例2: __init__

    def __init__(self, *args, **kwargs):
        self.log("__init__")
        if xbmcgui.Window(10000).getProperty("PseudoTVRunning") != "True":
            xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)
            self.madeChanges = 0
            self.showingList = True
            self.channel = 0
            self.channel_type = 9999
            self.setting1 = ''
            self.setting2 = ''
            self.setting3 = ''
            self.setting4 = ''
            self.savedRules = False
            self.DirName = ''
            self.PluginSourcePathDir = ''
            self.LockBrowse = False
            self.chnlst = ChannelList()
            if CHANNEL_SHARING:
                realloc = REAL_SETTINGS.getSetting('SettingsFolder')
                FileAccess.copy(realloc + '/settings2.xml', SETTINGS_LOC + '/settings2.xml')

            ADDON_SETTINGS.loadSettings()
            ADDON_SETTINGS.disableWriteOnSave()
            self.doModal()
            self.log("__init__ return")
        else:
            xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % ("PseudoTV Lite", "Not available while running.", 4000, THUMB) )
开发者ID:halcyonforever,项目名称:XBMC_Addons,代码行数:27,代码来源:config.py

示例3: determineLength

    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,代码行数:27,代码来源:STRMParser.py

示例4: onAction

    def onAction(self, act):
        action = act.getId()

        if action in ACTION_PREVIOUS_MENU:
            if self.showingList == False:
                self.cancelChan()
                self.hideChanDetails()
            else:
                if self.madeChanges == 1:
                    dlg = xbmcgui.Dialog()

                    if dlg.yesno("Save", "Do you want to save all changes?"):
                        ADDON_SETTINGS.writeSettings()
            
                        if CHANNEL_SHARING:
                            realloc = REAL_SETTINGS.getSetting('SettingsFolder')
                            FileAccess.copy(SETTINGS_LOC + '/settings2.xml', realloc + '/settings2.xml')

                self.close()
        elif act.getButtonCode() == 61575:      # Delete button
            curchan = self.listcontrol.getSelectedPosition() + 1

            if( (self.showingList == True) and (ADDON_SETTINGS.getSetting("Channel_" + str(curchan) + "_type") != "9999") ):
                dlg = xbmcgui.Dialog()

                if dlg.yesno("Save", "Are you sure you want to clear this channel?"):
                    ADDON_SETTINGS.setSetting("Channel_" + str(curchan) + "_type", "9999")
                    self.updateListing(curchan)
                    self.madeChanges = 1
开发者ID:yolanother,项目名称:script.pseudotv.live,代码行数:29,代码来源:config.py

示例5: onAction

    def onAction(self, act):
        action = act.getId()

        if action in ACTION_PREVIOUS_MENU:
            if self.showingList == False:
                self.cancelChan()
                self.hideChanDetails()
            else:
                if self.madeChanges == 1:
                    dlg = xbmcgui.Dialog()

                    if dlg.yesno(xbmc.getLocalizedString(190), REAL_SETTINGS.getLocalizedString(30032)):
                        ADDON_SETTINGS.writeSettings()

                        if CHANNEL_SHARING:
                            realloc = REAL_SETTINGS.getSetting("SettingsFolder")
                            FileAccess.copy(SETTINGS_LOC + "/settings2.xml", realloc + "/settings2.xml")

                self.close()
        elif act.getButtonCode() == 61575:  # Delete button
            curchan = self.listcontrol.getSelectedPosition() + 1

            if (self.showingList == True) and (
                ADDON_SETTINGS.getSetting("Channel_" + str(curchan) + "_type") != "9999"
            ):
                dlg = xbmcgui.Dialog()

                if dlg.yesno(xbmc.getLocalizedString(190), REAL_SETTINGS.getLocalizedString(30033)):
                    ADDON_SETTINGS.setSetting("Channel_" + str(curchan) + "_type", "9999")
                    self.updateListing(curchan)
                    self.madeChanges = 1
开发者ID:rafaelvieiras,项目名称:script.pseudotv,代码行数:31,代码来源:config.py

示例6: DeleteSettings2

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,代码行数:14,代码来源:utilities.py

示例7: downloadSkin

 def downloadSkin(self, selSkin):
     self.log("downloadSkin")
     url = self.SkinPanel.getSelectedItem().getProperty('PTVL.SKINZIP')
     dl = os.path.join(PTVL_SKIN_LOC,'%s.zip'%selSkin)
     try:
         print url, dl
         download(url, dl, '')
         all(dl, os.path.join(PTVL_SKIN_LOC,''),True)
         try:
             FileAccess.delete(dl)
         except:
             pass
         return True
     except:
         return False
开发者ID:PseudoTV,项目名称:PseudoTV_Live,代码行数:15,代码来源:skin.py

示例8: getSmartPlaylistName

    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,代码行数:27,代码来源:config.py

示例9: LogoDownloader

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,代码行数:33,代码来源:donordownload.py

示例10: CEDownloader

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,代码行数:35,代码来源:donordownload.py

示例11: determineLength

    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,代码行数:29,代码来源:TSParser.py

示例12: determineLength

    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,代码行数:25,代码来源:FLVParser.py

示例13: deleteSkin

 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,代码行数:10,代码来源:skin.py

示例14: __init__

    def __init__(self, *args, **kwargs):
        self.log("__init__")
        xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)
        self.madeChanges = 0
        self.showingList = True
        self.channel = 0
        self.channel_type = 9999
        self.setting1 = ""
        self.setting2 = ""
        self.savedRules = False

        if CHANNEL_SHARING:
            realloc = REAL_SETTINGS.getSetting("SettingsFolder")
            FileAccess.copy(realloc + "/settings2.xml", SETTINGS_LOC + "/settings2.xml")

        ADDON_SETTINGS.loadSettings()
        ADDON_SETTINGS.disableWriteOnSave()
        self.doModal()
        self.log("__init__ return")
开发者ID:rafaelvieiras,项目名称:script.pseudotv,代码行数:19,代码来源:config.py

示例15: donorCHK

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,代码行数:21,代码来源:service.py


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