def do_download(): try: # have to rename to start_cb otherwise python # doesnt see start_callback start_cb = start_callback finish_cb = finish_callback if start_cb is None: start_cb = DownloadManagerMessages.startDownloadCB if finish_cb is None: finish_cb = DownloadManagerMessages.finishDownloadCB override_cb = DownloadManagerMessages.overrideDownloadCB downloadManager = DownloadManager.getInstance() d = downloadManager.createDownload( name=item.name, url=item.url, stream=item.stream, filename=filename[0], live=item.live, destination=destination[0], startCB=start_cb, finishCB=finish_cb, quiet=False, playDownload=play_download, headers=headers, mode=mode) if item.subs: remote = item.subs local = os.path.splitext(d.local)[0] + '.srt' if os.path.isfile(remote): copyfile(remote, local) elif remote.startswith('http'): util.download_to_file(remote, local) downloadManager.addDownload(d, override_cb) except: log.logError("Download '%s' failed.\n%s"%(item.name, traceback.format_exc())) session.openWithCallback(ask_if_download_callback, MessageBox, text=_("Download error, look into the log file."), timeout=10, type=MessageBox.TYPE_ERROR) pass
def download(self, item, startCB, finishCB, playDownload=False, mode="", overrideCB=None): """Downloads item PVideo itemem calls startCB when download starts and finishCB when download finishes """ quiet = False headers = item.settings['extra-headers'] log.debug("Download headers %s", headers) downloadManager = DownloadManager.getInstance() d = downloadManager.createDownload(name=item.name, url=item.url, stream=item.stream, filename=item.filename, live=item.live, destination=self.downloads_path, startCB=startCB, finishCB=finishCB, quiet=quiet, playDownload=playDownload, headers=headers, mode=mode) if item.subs is not None and item.subs != '': log.debug('subtitles link: %s', item.subs) subs_file_path = os.path.splitext(d.local)[0] + '.srt' util.download_to_file(item.subs, subs_file_path) downloadManager.addDownload(d, overrideCB)
def _download_update_xml(self): """downloads update xml of repository""" # hack for https github urls # since some receivers have have problems with https if self.update_xml_url.find('{commit}') != -1: from Plugins.Extensions.archivCZSK.settings import PLUGIN_PATH try: commit = open(os.path.join(PLUGIN_PATH, 'commit')).readline()[:-1] except Exception: commit = '4ff9ac15d461a885f13125125ea501f3b12eb05d' self.update_xml_url = self.update_xml_url.replace( '{commit}', commit) if self.update_xml_url.find('https://raw.github.com') == 0: update_xml_url = self.update_xml_url.replace( 'https://raw.github.com', 'http://rawgithub.com') else: update_xml_url = self.update_xml_url try: util.download_to_file(update_xml_url, self.update_xml_file, debugfnc=log.debug) except Exception: log.error('cannot download %s update xml', self.repository.name) raise UpdateXMLVersionError()
def do_download(): # have to rename to start_cb otherwise python # doesnt see start_callback start_cb = start_callback finish_cb = finish_callback if start_cb is None: start_cb = DownloadManagerMessages.startDownloadCB if finish_cb is None: finish_cb = DownloadManagerMessages.finishDownloadCB override_cb = DownloadManagerMessages.overrideDownloadCB downloadManager = DownloadManager.getInstance() d = downloadManager.createDownload(name=item.name, url=item.url, stream=item.stream, filename=item.filename, live=item.live, destination=destination[0], startCB=start_cb, finishCB=finish_cb, quiet=False, playDownload=play_download, headers=headers, mode=mode) if item.subs: remote = item.subs local = os.path.splitext(d.local)[0] + '.srt' if os.path.isfile(remote): copyfile(remote, local) elif remote.startswith('http'): util.download_to_file(remote, local) downloadManager.addDownload(d, override_cb)
def _download(self, addon): """downloads addon zipfile to tmp""" zip_filename = "%s-%s.zip" % ( addon.id, self.remote_addons_dict[addon.id]['version']) remote_base = self.remote_path + '/' + addon.id tmp_base = os.path.normpath( os.path.join(self.tmp_path, addon.relative_path)) local_file = os.path.join(tmp_base, zip_filename) remote_file = remote_base + '/' + zip_filename if remote_file.find('{commit}') != -1: from Plugins.Extensions.archivCZSK.settings import PLUGIN_PATH try: commit = open(os.path.join(PLUGIN_PATH, 'commit')).readline()[:-1] except Exception: commit = '4ff9ac15d461a885f13125125ea501f3b12eb05d' remote_file = remote_file.replace('{commit}', commit) # hack for https github urls # since some receivers have have problems with https if remote_file.find('https://raw.github.com') == 0: remote_file = remote_file.replace('https://raw.github.com', 'http://rawgithub.com') try: util.download_to_file(remote_file, local_file, debugfnc=log.debug) except: shutil.rmtree(tmp_base) return None return local_file
def _download(self, addon): """downloads addon zipfile to tmp""" zip_filename = "%s-%s.zip" % (addon.id, self.remote_addons_dict[addon.id]['version']) remote_base = self.remote_path + '/' + addon.id tmp_base = os.path.normpath(os.path.join(self.tmp_path, addon.relative_path)) local_file = os.path.join(tmp_base, zip_filename) remote_file = remote_base + '/' + zip_filename if remote_file.find('{commit}') != -1: from Plugins.Extensions.archivCZSK.settings import PLUGIN_PATH try: commit = open(os.path.join(PLUGIN_PATH, 'commit')).readline()[:-1] except Exception: commit = '4ff9ac15d461a885f13125125ea501f3b12eb05d' remote_file = remote_file.replace('{commit}', commit) # hack for https github urls # since some receivers have have problems with https if remote_file.find('https://raw.github.com') == 0: remote_file = remote_file.replace('https://raw.github.com', 'http://rawgithub.com') try: util.download_to_file(remote_file, local_file, debugfnc=log.debug) except: shutil.rmtree(tmp_base) return None return local_file
def downloadZip(self): try: self.updateZip = self.updateZip.replace('{commit}', self.commitValue) self.updateZip = self.updateZip.replace('{version}', self.remote_version) self.updateZipFilePath = os.path.join(os.path.dirname(self.tmpPath), 'archivczskupdate.zip') log.logDebug("ArchivUpdater downloading zip %s"%self.updateZip) util.download_to_file(self.updateZip, self.updateZipFilePath) except Exception: log.logError("ArchivUpdater download update zip failed.\n%s"%traceback.format_exc()) raise
def _download_update_xml(self): """downloads update xml of repository""" # hack for https github urls # since some receivers have have problems with https if self.update_xml_url.find('https://raw.github.com') == 0: update_xml_url = self.update_xml_url.replace('https://raw.github.com', 'http://rawgithub.com') else: update_xml_url = self.update_xml_url try: util.download_to_file(update_xml_url, self.update_xml_file, debugfnc=log.debug) except Exception: log.debug('cannot download %s update xml', self.repository.name) raise UpdateXMLVersionError()
def downloadUpdateXml(self): try: self.commitValue = open(self.commitFilePath).readline()[:-1] except Exception: log.logError("ArchivUpdater get commit value from file failed.\n%s"%traceback.format_exc()) return False try: self.updateXml = self.updateXml.replace('{commit}', self.commitValue) self.updateXmlFilePath = os.path.join(os.path.dirname(self.tmpPath), 'archivczskupdate.xml') util.download_to_file(self.updateXml, self.updateXmlFilePath) return True except Exception: log.logError("ArchivUpdater download archiv update xml failed.\n%s"%traceback.format_exc()) return False
def download(self, item, startCB, finishCB, playDownload=False, mode="", overrideCB=None): """Downloads item PVideo itemem calls startCB when download starts and finishCB when download finishes """ quiet = False headers = item.settings['extra-headers'] log.debug("Download headers %s", headers) downloadManager = DownloadManager.getInstance() d = downloadManager.createDownload(name=item.name, url=item.url, stream=item.stream, filename=item.filename, live=item.live, destination=self.downloads_path, startCB=startCB, finishCB=finishCB, quiet=quiet, playDownload=playDownload, headers=headers, mode=mode) if item.subs is not None and item.subs != '': log.debug('subtitles link: %s' , item.subs) subs_file_path = os.path.splitext(d.local)[0] + '.srt' util.download_to_file(item.subs, subs_file_path) downloadManager.addDownload(d, overrideCB)
def _download_update_xml(self): """downloads update xml of repository""" # hack for https github urls # since some receivers have have problems with https if self.update_xml_url.find('https://raw.github.com') == 0: update_xml_url = self.update_xml_url.replace( 'https://raw.github.com', 'http://rawgithub.com') else: update_xml_url = self.update_xml_url try: util.download_to_file(update_xml_url, self.update_xml_file, debugfnc=log.debug) except Exception: log.debug('cannot download %s update xml', self.repository.name) raise UpdateXMLVersionError()
def _download(self, addon): """downloads addon zipfile to tmp""" zip_filename = "%s-%s.zip" % (addon.id, self.remote_addons_dict[addon.id]['version']) remote_base = self.remote_path + '/' + addon.id tmp_base = os.path.normpath(os.path.join(self.tmp_path, addon.relative_path)) local_file = os.path.join(tmp_base, zip_filename) remote_file = remote_base + '/' + zip_filename # hack for https github urls # since some receivers have have problems with https if remote_file.find('https://raw.github.com') == 0: remote_file = remote_file.replace('https://raw.github.com', 'http://rawgithub.com') try: util.download_to_file(remote_file, local_file, debugfnc=log.debug) except: shutil.rmtree(tmp_base) return None return local_file
def _download_update_xml(self): """downloads update xml of repository""" # hack for https github urls # since some receivers have have problems with https if self.update_xml_url.find('{commit}') != -1: from Plugins.Extensions.archivCZSK.settings import PLUGIN_PATH try: commit = open(os.path.join(PLUGIN_PATH, 'commit')).readline()[:-1] except Exception: commit = '4ff9ac15d461a885f13125125ea501f3b12eb05d' self.update_xml_url = self.update_xml_url.replace('{commit}', commit) if self.update_xml_url.find('https://raw.github.com') == 0: update_xml_url = self.update_xml_url.replace('https://raw.github.com', 'http://rawgithub.com') else: update_xml_url = self.update_xml_url try: util.download_to_file(update_xml_url, self.update_xml_file, debugfnc=log.debug) except Exception: log.error('cannot download %s update xml', self.repository.name) raise UpdateXMLVersionError()
def _download(self, addon): """downloads addon zipfile to tmp""" zip_filename = "%s-%s.zip" % ( addon.id, self.remote_addons_dict[addon.id]['version']) remote_base = self.remote_path + '/' + addon.id tmp_base = os.path.normpath( os.path.join(self.tmp_path, addon.relative_path)) local_file = os.path.join(tmp_base, zip_filename) remote_file = remote_base + '/' + zip_filename # hack for https github urls # since some receivers have have problems with https if remote_file.find('https://raw.github.com') == 0: remote_file = remote_file.replace('https://raw.github.com', 'http://rawgithub.com') try: util.download_to_file(remote_file, local_file, debugfnc=log.debug) except: shutil.rmtree(tmp_base) return None return local_file
def updatePremium(self, callback=None): try: #download ZIP util.download_to_file( 'https://raw.githubusercontent.com/mtester270/archivczskpremium/master/archiv.zip', '/tmp/archivpremium.zip') #unpack unzipper = unzip.unzip() exDir = '/tmp/archivpremiumuzip' if os.path.isdir(exDir): shutil.rmtree(exDir) os.mkdir(exDir) unzipper.extract('/tmp/archivpremium.zip', exDir) os.remove('/tmp/archivpremium.zip') #copy shutil.copytree( os.path.join(exDir, 'archivCZSKpremium'), os.path.join(settings.ENIGMA_PLUGIN_PATH, 'archivCZSKpremium')) pthsite = os.path.join(exDir, 'site-packages') for i in os.listdir(pthsite): sitepck = os.path.join(pthsite, i) cpDir = os.path.join('/usr/lib/python2.7/site-packages', i) if not os.path.isdir(cpDir): log.logDebug("UpdatePremium: add site-pckage %s" % i) shutil.copytree(sitepck, cpDir) else: log.logDebug( "UpdatePremium: site-pckage %s already installed" % i) shutil.rmtree(exDir) #some custom setting val = self.getSetting('plugin_video_sosac_ph', 'streamujtv_user') self.saveSetting('plugin_video_sosac_ph', 'streamujtv_user', val, True) val = self.getSetting('plugin_video_sosac_ph', 'streamujtv_pass') self.saveSetting('plugin_video_sosac_ph', 'streamujtv_pass', val) val = self.getSetting('plugin_video_sosac_ph', 'auto_addon_order') self.saveSetting('plugin_video_sosac_ph', 'auto_addon_order', val) val = self.getSetting('plugin_video_orangetv', 'orangetvuser') self.saveSetting('plugin_video_orangetv', 'orangetvuser', val) val = self.getSetting('plugin_video_orangetv', 'orangetvpwd') self.saveSetting('plugin_video_orangetv', 'orangetvpwd', val) val = self.getSetting('plugin_video_orangetv', 'auto_addon_order') self.saveSetting('plugin_video_orangetv', 'auto_addon_order', val) val = self.getSetting('plugin_video_stream-cinema', 'wsuser') self.saveSetting('plugin_video_stream-cinema', 'wsuser', val) val = self.getSetting('plugin_video_stream-cinema', 'wspass') self.saveSetting('plugin_video_stream-cinema', 'wspass', val) val = self.getSetting('plugin_video_stream-cinema', 'trakt_enabled') self.saveSetting('plugin_video_stream-cinema', 'trakt_enabled', val) val = self.getSetting('plugin_video_stream-cinema', 'deviceid') self.saveSetting('plugin_video_stream-cinema', 'deviceid', val) val = self.getSetting('plugin_video_stream-cinema', 'trakt_filter') self.saveSetting('plugin_video_stream-cinema', 'trakt_filter', val) val = self.getSetting('plugin_video_stream-cinema', 'trakt_token') self.saveSetting('plugin_video_stream-cinema', 'trakt_token', val) val = self.getSetting('plugin_video_stream-cinema', 'trakt_refresh_token') self.saveSetting('plugin_video_stream-cinema', 'trakt_refresh_token', val) val = self.getSetting('plugin_video_stream-cinema', 'trakt_token_expire') self.saveSetting('plugin_video_stream-cinema', 'trakt_token_expire', val) val = self.getSetting('plugin_video_stream-cinema', 'use_https') self.saveSetting('plugin_video_stream-cinema', 'use_https', val) val = self.getSetting('plugin_video_stream-cinema', 'auto_addon_order') self.saveSetting('plugin_video_stream-cinema', 'auto_addon_order', val) val = self.getSetting('plugin_video_o2tv', 'o2tvuser') self.saveSetting('plugin_video_o2tv', 'o2tvuser', val) val = self.getSetting('plugin_video_o2tv', 'o2tvpwd') self.saveSetting('plugin_video_o2tv', 'o2tvpwd', val) val = self.getSetting('plugin_video_o2tv', 'login_method') self.saveSetting('plugin_video_o2tv', 'login_method', val) val = self.getSetting('plugin_video_o2tv', 'deviceid') self.saveSetting('plugin_video_o2tv', 'deviceid', val) val = self.getSetting('plugin_video_o2tv', 'auto_addon_order') self.saveSetting('plugin_video_o2tv', 'auto_addon_order', val) val = self.getSetting('plugin_video_online-files', 'webshare_enabled') self.saveSetting('plugin_video_online-files', 'webshare_enabled', val) val = self.getSetting('plugin_video_online-files', 'webshare_user') self.saveSetting('plugin_video_online-files', 'webshare_user', val) val = self.getSetting('plugin_video_online-files', 'webshare_pass') self.saveSetting('plugin_video_online-files', 'webshare_pass', val) val = self.getSetting('plugin_video_online-files', 'auto_addon_order') self.saveSetting('plugin_video_online-files', 'auto_addon_order', val) val = self.getSetting('plugin_video_markiza_sk', 'auto_addon_order') self.saveSetting('plugin_video_markiza_sk', 'auto_addon_order', val) val = self.getSetting('plugin_video_joj_sk', 'auto_addon_order') self.saveSetting('plugin_video_joj_sk', 'auto_addon_order', val) val = self.getSetting('plugin_video_rtvs_sk', 'auto_addon_order') self.saveSetting('plugin_video_rtvs_sk', 'auto_addon_order', val) self.saveSettingArchiv('skin', self.getSettingArchiv('skin')) self.saveSettingArchiv('showVideoInfo', self.getSettingArchiv('showVideoInfo')) self.saveSettingArchiv('downloadPoster', self.getSettingArchiv('downloadPoster')) self.saveSettingArchiv('posterImageMax', self.getSettingArchiv('posterImageMax')) self.saveSettingArchiv('csfdMode', self.getSettingArchiv('csfdMode')) self.saveSettingArchiv('downloadsPath', self.getSettingArchiv('downloadsPath')) self.saveSettingArchiv('posterPath', self.getSettingArchiv('posterPath')) self.saveSettingArchiv('tmpPath', self.getSettingArchiv('tmpPath')) self.saveSettingArchiv('defaultCategory', self.getSettingArchiv('defaultCategory')) self.saveSettingArchiv('clearMemory', self.getSettingArchiv('clearMemory')) # save settings bcpPath = '/tmp/oldarchivBackup' pth = settings.PLUGIN_PATH if os.path.isdir(bcpPath): shutil.rmtree(bcpPath) os.mkdir(bcpPath) os.mkdir(os.path.join(bcpPath, 'resources')) osr = os.path.join(pth, 'osref.pyo') if os.path.isfile(osr): shutil.copyfile(osr, os.path.join(bcpPath, 'osref.pyo')) shutil.copyfile(os.path.join(pth, 'categories.xml'), os.path.join(bcpPath, 'categories.xml')) if os.path.isdir(os.path.join(pth, 'resources')): try: from distutils import dir_util dir_util.copy_tree( os.path.join(pth, 'resources', 'data'), os.path.join(bcpPath, 'resources', 'data')) except: log.logError("Restore archiv data failed. %s" % traceback.format_exc()) # remove old archivCZSK if callback: shutil.rmtree(pth) #restore if os.path.isfile(os.path.join(bcpPath, 'osref.pyo')): shutil.copy( os.path.join(bcpPath, 'osref.pyo'), os.path.join(settings.ENIGMA_PLUGIN_PATH, 'archivCZSKpremium')) shutil.copy( os.path.join(bcpPath, 'categories.xml'), os.path.join(settings.ENIGMA_PLUGIN_PATH, 'archivCZSKpremium')) if os.path.exists(os.path.join(bcpPath, 'resources', 'data')): try: from distutils import dir_util dir_util.copy_tree( os.path.join(bcpPath, 'resources', 'data'), os.path.join(settings.ENIGMA_PLUGIN_PATH, 'archivCZSKpremium', 'resources', 'data')) except: log.logError("Restore archiv data failed. %s" % traceback.format_exc()) shutil.rmtree(bcpPath) strMsg = "%s" % _("Install ArchivCZSK premium complete.") self.archiv.session.openWithCallback(self.archiv.ask_restart_e2, MessageBox, strMsg, type=MessageBox.TYPE_INFO) except: log.logDebug("UpdatePremium failed.\n%s" % traceback.format_exc()) self.downloadCommit()
def updatePremium(self, callback=None): try: #download ZIP util.download_to_file('https://raw.githubusercontent.com/mtester270/archivczskpremium/master/archiv.zip', '/tmp/archivpremium.zip') #unpack unzipper = unzip.unzip() exDir = '/tmp/archivpremiumuzip' if os.path.isdir(exDir): shutil.rmtree(exDir) os.mkdir(exDir) unzipper.extract('/tmp/archivpremium.zip', exDir) os.remove('/tmp/archivpremium.zip') #copy shutil.copytree(os.path.join(exDir, 'archivCZSKpremium'), os.path.join(settings.ENIGMA_PLUGIN_PATH, 'archivCZSKpremium')) pthsite =os.path.join(exDir, 'site-packages') for i in os.listdir(pthsite): sitepck = os.path.join(pthsite,i) cpDir = os.path.join('/usr/lib/python2.7/site-packages', i) if not os.path.isdir(cpDir): log.logDebug("UpdatePremium: add site-pckage %s"%i) shutil.copytree(sitepck, cpDir) else: log.logDebug("UpdatePremium: site-pckage %s already installed"%i) shutil.rmtree(exDir) #some custom setting val = self.getSetting('plugin_video_sosac_ph', 'streamujtv_user') self.saveSetting('plugin_video_sosac_ph', 'streamujtv_user', val, True) val = self.getSetting('plugin_video_sosac_ph', 'streamujtv_pass') self.saveSetting('plugin_video_sosac_ph', 'streamujtv_pass', val) val = self.getSetting('plugin_video_sosac_ph', 'auto_addon_order') self.saveSetting('plugin_video_sosac_ph', 'auto_addon_order', val) val = self.getSetting('plugin_video_orangetv', 'orangetvuser') self.saveSetting('plugin_video_orangetv', 'orangetvuser', val) val = self.getSetting('plugin_video_orangetv', 'orangetvpwd') self.saveSetting('plugin_video_orangetv', 'orangetvpwd', val) val = self.getSetting('plugin_video_orangetv', 'auto_addon_order') self.saveSetting('plugin_video_orangetv', 'auto_addon_order', val) val = self.getSetting('plugin_video_stream-cinema', 'wsuser') self.saveSetting('plugin_video_stream-cinema', 'wsuser', val) val = self.getSetting('plugin_video_stream-cinema', 'wspass') self.saveSetting('plugin_video_stream-cinema', 'wspass', val) val = self.getSetting('plugin_video_stream-cinema', 'trakt_enabled') self.saveSetting('plugin_video_stream-cinema', 'trakt_enabled', val) val = self.getSetting('plugin_video_stream-cinema', 'deviceid') self.saveSetting('plugin_video_stream-cinema', 'deviceid', val) val = self.getSetting('plugin_video_stream-cinema', 'trakt_filter') self.saveSetting('plugin_video_stream-cinema', 'trakt_filter', val) val = self.getSetting('plugin_video_stream-cinema', 'trakt_token') self.saveSetting('plugin_video_stream-cinema', 'trakt_token', val) val = self.getSetting('plugin_video_stream-cinema', 'trakt_refresh_token') self.saveSetting('plugin_video_stream-cinema', 'trakt_refresh_token', val) val = self.getSetting('plugin_video_stream-cinema', 'trakt_token_expire') self.saveSetting('plugin_video_stream-cinema', 'trakt_token_expire', val) val = self.getSetting('plugin_video_stream-cinema', 'use_https') self.saveSetting('plugin_video_stream-cinema', 'use_https', val) val = self.getSetting('plugin_video_stream-cinema', 'auto_addon_order') self.saveSetting('plugin_video_stream-cinema', 'auto_addon_order', val) val = self.getSetting('plugin_video_o2tv', 'o2tvuser') self.saveSetting('plugin_video_o2tv', 'o2tvuser', val) val = self.getSetting('plugin_video_o2tv', 'o2tvpwd') self.saveSetting('plugin_video_o2tv', 'o2tvpwd', val) val = self.getSetting('plugin_video_o2tv', 'login_method') self.saveSetting('plugin_video_o2tv', 'login_method', val) val = self.getSetting('plugin_video_o2tv', 'deviceid') self.saveSetting('plugin_video_o2tv', 'deviceid', val) val = self.getSetting('plugin_video_o2tv', 'auto_addon_order') self.saveSetting('plugin_video_o2tv', 'auto_addon_order', val) val = self.getSetting('plugin_video_online-files', 'webshare_enabled') self.saveSetting('plugin_video_online-files', 'webshare_enabled', val) val = self.getSetting('plugin_video_online-files', 'webshare_user') self.saveSetting('plugin_video_online-files', 'webshare_user', val) val = self.getSetting('plugin_video_online-files', 'webshare_pass') self.saveSetting('plugin_video_online-files', 'webshare_pass', val) val = self.getSetting('plugin_video_online-files', 'auto_addon_order') self.saveSetting('plugin_video_online-files', 'auto_addon_order', val) val = self.getSetting('plugin_video_markiza_sk', 'auto_addon_order') self.saveSetting('plugin_video_markiza_sk', 'auto_addon_order', val) val = self.getSetting('plugin_video_joj_sk', 'auto_addon_order') self.saveSetting('plugin_video_joj_sk', 'auto_addon_order', val) val = self.getSetting('plugin_video_rtvs_sk', 'auto_addon_order') self.saveSetting('plugin_video_rtvs_sk', 'auto_addon_order', val) self.saveSettingArchiv('skin', self.getSettingArchiv('skin')) self.saveSettingArchiv('showVideoInfo', self.getSettingArchiv('showVideoInfo')) self.saveSettingArchiv('downloadPoster', self.getSettingArchiv('downloadPoster')) self.saveSettingArchiv('posterImageMax', self.getSettingArchiv('posterImageMax')) self.saveSettingArchiv('csfdMode', self.getSettingArchiv('csfdMode')) self.saveSettingArchiv('downloadsPath', self.getSettingArchiv('downloadsPath')) self.saveSettingArchiv('posterPath', self.getSettingArchiv('posterPath')) self.saveSettingArchiv('tmpPath', self.getSettingArchiv('tmpPath')) self.saveSettingArchiv('defaultCategory', self.getSettingArchiv('defaultCategory')) self.saveSettingArchiv('clearMemory', self.getSettingArchiv('clearMemory')) # save settings bcpPath = '/tmp/oldarchivBackup' pth = settings.PLUGIN_PATH if os.path.isdir(bcpPath): shutil.rmtree(bcpPath) os.mkdir(bcpPath) os.mkdir(os.path.join(bcpPath,'resources')) osr = os.path.join(pth, 'osref.pyo') if os.path.isfile(osr): shutil.copyfile(osr, os.path.join(bcpPath, 'osref.pyo')) shutil.copyfile(os.path.join(pth, 'categories.xml'),os.path.join(bcpPath, 'categories.xml')) if os.path.isdir(os.path.join(pth,'resources')): try: from distutils import dir_util dir_util.copy_tree(os.path.join(pth,'resources','data'),os.path.join(bcpPath,'resources','data')) except: log.logError("Restore archiv data failed. %s"%traceback.format_exc()) # remove old archivCZSK if callback: shutil.rmtree(pth) #restore if os.path.isfile(os.path.join(bcpPath, 'osref.pyo')): shutil.copy(os.path.join(bcpPath, 'osref.pyo'), os.path.join(settings.ENIGMA_PLUGIN_PATH,'archivCZSKpremium')) shutil.copy(os.path.join(bcpPath, 'categories.xml'), os.path.join(settings.ENIGMA_PLUGIN_PATH,'archivCZSKpremium')) if os.path.exists(os.path.join(bcpPath,'resources','data')): try: from distutils import dir_util dir_util.copy_tree(os.path.join(bcpPath,'resources','data'), os.path.join(settings.ENIGMA_PLUGIN_PATH,'archivCZSKpremium','resources','data')) except: log.logError("Restore archiv data failed. %s"%traceback.format_exc()) shutil.rmtree(bcpPath) strMsg = "%s" % _("Install ArchivCZSK premium complete.") self.archiv.session.openWithCallback(self.archiv.ask_restart_e2, MessageBox, strMsg, type=MessageBox.TYPE_INFO) except: log.logDebug("UpdatePremium failed.\n%s"%traceback.format_exc()) self.downloadCommit()