Example #1
0
    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) )
Example #2
0
 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
Example #3
0
    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
    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
    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
Example #6
0
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()
Example #7
0
 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
Example #8
0
    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
Example #9
0
    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")
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()
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()
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()
Example #13
0
    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.playlist('Unable to find element name')

        self.log("getSmartPlaylistName return")
Example #14
0
    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
Example #15
0
    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
Example #16
0
    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")
Example #17
0
 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()
Example #18
0
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")
Example #19
0
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")
Example #20
0
    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
Example #21
0
    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.setting3 = ''
        self.setting4 = ''
        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")
Example #22
0
 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()
Example #23
0
    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
Example #24
0
    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
Example #25
0
    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
Example #26
0
 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
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()
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()
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()
Example #30
0
    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
Example #31
0
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
Example #32
0
    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