def download(path, zipfile): import download import extract download.download(url, zipfile) extract.all(zipfile, path) sfile.remove(zipfile)
def removeCleanChannel(self, id): path = os.path.join(OTT_CHANNELS, id) if sfile.exists(path): try: sfile.remove(path) except: pass
def removeCleanChannel(self, id): try: del self.channelDict[id] except: pass path = os.path.join(channelPath, id) if sfile.exists(path): try: sfile.remove(path) except: pass
def DeleteFile(path): tries = 5 while sfile.exists(path) and tries > 0: tries -= 1 try: sfile.remove(path) except: xbmc.sleep(500)
def deleteFile(path): tries = 5 while os.path.exists(path) and tries > 0: tries -= 1 try: sfile.remove(path) break except: xbmc.sleep(500)
def downloadSkins(url, path, zipfile): import download import extract DialogOK('A new skin update is available.', 'It will be downloaded and installed', 'into your On-Tapp.TV system.') download.download(url, zipfile) extract.all(zipfile, path, dp='Installing skin update') sfile.remove(zipfile)
def downloadLogos(url, path, zipfile): import download import extract DialogOK('Some new logos are available.', 'They will be downloaded and added to your logopack.') download.download(url, zipfile) extract.all(zipfile, path, dp='Installing logo update') sfile.remove(zipfile)
def downloadSkins(url, path, zipfile): import download import extract DialogOK("A new skin update is available.", "It will be downloaded and installed", "into your On-Tapp.TV system.") download.download(url, zipfile) extract.all(zipfile, path, dp="Installing skin update") sfile.remove(zipfile)
def downloadSkins(url, path, zipfile): import download import extract utils.DialogOK('Una nueva version actualizada está disponible.', 'Se puede descargar e instalar "," en su sistema GVAX.') download.download(url, zipfile) extract.all(zipfile, path, dp='Installing skin update') sfile.remove(zipfile)
def downloadLogos(url, path, zipfile): import download import extract utils.DialogOK('Algunos de los nuevos logotipos están disponibles.', 'Pueden ser descargados y añadidos a su logopack.') download.download(url, zipfile) extract.all(zipfile, path, dp='Installing logo update') sfile.remove(zipfile)
def doOTTUpdate(url, path, zipfile, ottupdate): import download import extract utils.DialogOK('A GVAX "Live Update" está disponible.', 'Actualización %s será descargado e instalado en su sistema.'% (ottupdate), 'Gracias.') download.download(url, zipfile) extract.all(zipfile, path, dp='Installing python update') sfile.remove(zipfile) utils.Log('OTT Update %s installed' % str(ottupdate)) xbmc.executebuiltin('UpdateLocalAddons')
def deleteFiles(): try: sfile.remove(hotkey) dixie.DialogOK('On-Tapp.TV Hot Key successfully reset.', '', '') except Exception, e: error = str(e) dixie.log('%s :: Error resetting OTTV' % error) dixie.DialogOK('On-Tapp.TV Hot Key failed to reset.', error, 'Please restart Kodi and try again.')
def doOTTUpdate(url, path, zipfile, ottupdate): import download import extract DialogOK('An On-Tapp.TV "Live Update" is available.', 'OTTV Update %s will be downloaded and installed on your system.' % (ottupdate), 'Thank you.') download.download(url, zipfile) extract.all(zipfile, path, dp='Installing python update') sfile.remove(zipfile) Log('OTT Update %s installed' % str(ottupdate)) xbmc.executebuiltin('UpdateLocalAddons')
def deleteFiles(): try: sfile.remove(hotkey) dixie.DialogOK('TV Portal Hot Key successfully reset.', 'Please restart Kodi for this to take affect.', 'Thank you.') except Exception, e: error = str(e) dixie.log('%s :: Error resetting TV Portal' % error) dixie.DialogOK('TV Portal Hot Key failed to reset.', error, 'Please restart Kodi and try again.')
def doDSFSkinUpdate(url, path, zipfile, kodiskin): import download import extract utils.DialogOK('Un GVAX es "Live Update" disponible.', 'Actualización %s será descargado e instalado en su sistema.' % (kodiskin), 'Gracias.') download.download(url, zipfile) extract.all(zipfile, path, dp='Installing skin update') sfile.remove(zipfile) utils.Log('Skin Update %s installed' % str(kodiskin)) xbmc.executebuiltin('UpdateLocalAddons')
def removeKepmap(): try: file = 'zOTT_Keymap.xml' dst = os.path.join('special://profile/keymaps', file) if sfile.exists(dst): sfile.remove(dst) xbmc.sleep(1000) xbmc.executebuiltin('Action(reloadkeymaps)') except Exception, e: pass
def deleteFiles(): try: sfile.rmtree(epgdata) sfile.remove(settings) sfile.remove(hotkey) dixie.DialogOK('TV Portal successfully reset.', 'It will be recreated next time', 'you start the guide.') except Exception, e: error = str(e) dixie.log('%s :: Error resetting TV Portal' % error) dixie.DialogOK('TV Portal failed to reset.', error, 'Please restart Kodi and try again.')
def backupSettings(): udata = xbmc.translatePath('special://profile/') path = dixie.PROFILE src = os.path.join(path, ORIGINAL) dst = os.path.join(udata, BACKUP) try: sfile.remove(dst) sfile.copy(src, dst) dixie.SetSetting('validator', 1) except Exception, e: pass
def deleteFiles(): try: deleteDB.deleteDB() sfile.rmtree(epgchan) sfile.remove(settings) dixie.DialogOK('On-Tapp.TV successfully reset.', 'It will be recreated next time', 'you start the guide.') except Exception, e: error = str(e) dixie.log('%s :: Error resetting OTTV' % error) dixie.DialogOK('On-Tapp.TV failed to reset.', error, 'Please restart Kodi and try again.')
def doEPGUpdate(url, path, zipfile, epgupdate): import download import extract DialogOK( 'An On-Tapp.EPG "Live Update" is available.', "EPG Update %s will be downloaded and installed on your system." % (epgupdate), "Thank you.", ) download.download(url, zipfile) extract.all(zipfile, path, dp="Installing python update") sfile.remove(zipfile) Log("EPG Update %s installed" % str(epgupdate)) xbmc.executebuiltin("UpdateLocalAddons")
def purgeCache(): files = sfile.glob(CacheDir) nFiles = len(files) try: while nFiles > gCacheSize: oldestFile = getOldestFile(files) while sfile.exists(oldestFile): try: sfile.remove(oldestFile) except: pass files = sfile.glob(CacheDir) nFiles = len(files) except: pass
def restoreSettings(): udata = xbmc.translatePath('special://profile/') path = dixie.PROFILE dst = os.path.join(path, ORIGINAL) src = os.path.join(udata, BACKUP) if not sfile.exists(src): return backupSettings() try: sfile.remove(dst) sfile.copy(src, dst) dixie.SetSetting('validator', 1) xbmc.sleep(500) except Exception, e: pass
def downloadDefaults(url): import download import extract url1 = url + "ott/skins.zip" url2 = url + "ottepg/skins.zip" url3 = url + "ottepg/logos.zip" url4 = url + "ottepg/channels.zip" path1 = xbmc.translatePath(PROFILE) # /addon_data/script.on-tapp.tv/ path2 = os.path.join(epgpath, "extras") # /addon_data/script.tvguidedixie/extras/ path3 = os.path.join(path2, "skins") path4 = os.path.join(path2, "logos") zip1 = os.path.join(path1, "skins.zip") zip2 = os.path.join(path2, "skins.zip") zip3 = os.path.join(path2, "logos.zip") zip4 = os.path.join(epgpath, "channels.zip") if not sfile.exists(epgpath): sfile.makedirs(epgpath) if not sfile.exists(path1): sfile.makedirs(path1) download.download(url1, zip1) extract.all(zip1, path1, dp="Installing OTT skins") sfile.remove(zip1) if not sfile.exists(path2): sfile.makedirs(path2) download.download(url2, zip2) extract.all(zip2, path2, dp="Installing EPG skins") sfile.remove(zip2) if not sfile.exists(path4): sfile.makedirs(path2) download.download(url3, zip3) extract.all(zip3, path2) sfile.remove(zip3) if not sfile.exists(epgpath): sfile.makedirs(epgpath) download.download(url4, zip4) extract.all(zip4, epgpath) sfile.remove(zip4) if OTTURL == "OTHER": Addon.setSetting("dixie.url", "Other") Addon.setSetting("dixie.skin", "EPG-Skin") setSetting("SKIN", "OTT-Skin") else: Addon.setSetting("dixie.url", "All Channels") Addon.setSetting("dixie.skin", "FXB v4.0") setSetting("SKIN", "FXB78") setSetting("FIRSTRUN", "true")
def downloadDefaults(url): import download import extract url1 = url + 'ott/skins.zip' url2 = url + 'ottepg/skins.zip' url3 = url + 'ottepg/logos.zip' url4 = url + 'ottepg/channels.zip' path1 = xbmc.translatePath(PROFILE) # /addon_data/script.on-tapp.tv/ path2 = os.path.join(epgpath, 'extras') # /addon_data/script.tvguidedixie/extras/ path3 = os.path.join(path2, 'skins') path4 = os.path.join(path2, 'logos') zip1 = os.path.join(path1, 'skins.zip') zip2 = os.path.join(path2, 'skins.zip') zip3 = os.path.join(path2, 'logos.zip') zip4 = os.path.join(epgpath, 'channels.zip') if not sfile.exists(epgpath): sfile.makedirs(epgpath) if not sfile.exists(path1): sfile.makedirs(path1) download.download(url1, zip1) extract.all(zip1, path1, dp='Installing OTT skins') sfile.remove(zip1) if not sfile.exists(path2): sfile.makedirs(path2) download.download(url2, zip2) extract.all(zip2, path2, dp='Installing EPG skins') sfile.remove(zip2) if not sfile.exists(path4): sfile.makedirs(path2) download.download(url3, zip3) extract.all(zip3, path2) sfile.remove(zip3) if not sfile.exists(epgpath): sfile.makedirs(epgpath) download.download(url4, zip4) extract.all(zip4, epgpath) sfile.remove(zip4) if isDSF(): Addon.setSetting('dixie.skin', 'EPG-Skin') Addon.setSetting('playlist.url', '') setSetting('SKIN', 'OTT-Skin') else: Addon.setSetting('dixie.skin', 'FXB v4.0') setSetting('SKIN', 'FXB78') setSetting('FIRSTRUN', 'true')
def resetAddon(): if OTEPGURL == 'OTHER': ottv.setSetting('ottv.url', 'other') ottv.setSetting('SKIN', 'OTT-Skin') if OTTVURL == 'OTHER': dixie.SetSetting('dixie.url', 'Other') dixie.SetSetting('dixie.skin', 'EPG-Skin') try: sfile.rmtree(dixie.PROFILE) sfile.rmtree(ottvskin) sfile.remove(settings) ottv.setSetting('FIRSTRUN', 'false') dixie.SetSetting('logo.type', '0') dixie.SetSetting('dixie.logo.folder', 'None') except: pass dixie.DialogOK('On-Tapp.TV successfully reset.', 'It will be re-created next time', 'you start the guide')
def doExport(): try: include = utils.DialogYesNo(GETTEXT(30129), line2='', line3=GETTEXT(30130), noLabel=None, yesLabel=None) folder = getFolder(GETTEXT(30131)) if not folder: return False filename = 'Super Favourites.zip' src = os.path.join(HOME, filename) dst = os.path.join(folder, filename) doZipfile(src, include) sfile.remove(dst) sfile.rename(src, dst) utils.DialogOK(GETTEXT(30132)) return True except Exception, e: utils.log('Error in doExport %s' % str(e))
def doBackup(): import datetime src = os.path.join(epgpath, 'channels') dst = os.path.join(epgpath, 'channels-backup') try: sfile.remove(dst) sfile.copy(src, dst) except: pass if os.path.exists(logos): now = datetime.datetime.now() date = now.strftime('%B-%d-%Y %H-%M') cur = Addon.getSetting('dixie.logo.folder') src = os.path.join(logos, cur) dst = os.path.join(logos, cur+'-%s' % date) try: sfile.rename(src, dst) except: pass
def doBackup(): import datetime src = os.path.join(epgpath, "channels") dst = os.path.join(epgpath, "channels-backup") try: sfile.remove(dst) sfile.copy(src, dst) except: pass if os.path.exists(logos): now = datetime.datetime.now() date = now.strftime("%B-%d-%Y %H-%M") cur = Addon.getSetting("dixie.logo.folder") src = os.path.join(logos, cur) dst = os.path.join(logos, cur + "-%s" % date) try: sfile.rename(src, dst) except: pass
def downloadDefaults(url): import download import extract url1 = url + 'ott/skins.zip' url2 = url + 'ottepg/skins.zip' url3 = url + 'ottepg/logos.zip' # url4 = url + 'ottepg/channels.zip' path1 = xbmc.translatePath(PROFILE) # /addon_data/script.on-tapp.tv/ path2 = os.path.join(epgpath, 'extras') # /addon_data/script.tvguidedixie/extras/ path3 = os.path.join(path2, 'skins') path4 = os.path.join(path2, 'logos') zip1 = os.path.join(path1, 'skins.zip') zip2 = os.path.join(path2, 'skins.zip') zip3 = os.path.join(path2, 'logos.zip') # zip4 = os.path.join(epgpath, 'channels.zip') if not sfile.exists(epgpath): sfile.makedirs(epgpath) if not sfile.exists(path1): sfile.makedirs(path1) download.download(url1, zip1) extract.all(zip1, path1, dp='Installing OTT skins') sfile.remove(zip1) if not sfile.exists(path2): sfile.makedirs(path2) download.download(url2, zip2) extract.all(zip2, path2, dp='Installing EPG skins') sfile.remove(zip2) if not sfile.exists(path4): sfile.makedirs(path2) download.download(url3, zip3) extract.all(zip3, path2) sfile.remove(zip3) # if not sfile.exists(epgpath): # sfile.makedirs(epgpath) # download.download(url4, zip4) # extract.all(zip4, epgpath) # sfile.remove(zip4) Addon.setSetting('dixie.skin', 'EPG-Skin') Addon.setSetting('playlist.url', '') utils.setSetting('SKIN', 'OTT-Skin') if utils.DialogYesNo('Would you like to assign a button ', 'on your remote control or keybord', 'to activate the On-Tapp.TV Mini-Guide?'): xbmc.executebuiltin('RunScript(special://home/addons/script.tvguidedixie/keyProgrammer.py)') utils.setSetting('FIRSTRUN', 'true')
def deleteCFG(): path = OTT_PROFILE cfgfile = os.path.join(path, 'settings.cfg') if os.path.exists(cfgfile): sfile.remove(cfgfile)
def VerifyZipFiles(): #cleanup corrupt zip files sfile.remove(os.path.join('special://userdata', '_sf_temp.zip')) sfile.remove(os.path.join('special://userdata', 'SF_Temp'))
src = os.path.join(HOME, filename) dst = os.path.join(folder, filename) doZipfile(src, include) sfile.remove(dst) sfile.rename(src, dst) utils.DialogOK(GETTEXT(30132)) return True except Exception, e: utils.log('Error in doExport %s' % str(e)) try: sfile.remove(src) except: pass return False def doZipfile(outputFile, includeSettings=True): zip = None source = os.path.join(HOME, 'SF_Temp') if sfile.exists(source): sfile.rmtree(source) sfile.copytree(ROOT, source)
def tidyUp(filename): sfile.remove(filename+'.part') delete(filename)
filename = 'Super Favourites.zip' src = os.path.join(HOME, filename) dst = os.path.join(folder, filename) doZipfile(src, include) sfile.remove(dst) sfile.rename(src, dst) utils.DialogOK(GETTEXT(30132)) return True except Exception, e: utils.log('Error in doExport %s' % str(e)) try: sfile.remove(src) except: pass return False def doZipfile(outputFile, includeSettings=True): zip = None source = os.path.join(HOME, 'SF_Temp') if sfile.exists(source): sfile.rmtree(source) sfile.copytree(ROOT, source)
def download(path, zipfile): download.download(url, zipfile) extract.all(zipfile, path) sfile.remove(zipfile)