Example #1
0
    def cleanUp(self):
        config.plugins.epgrefresh.lastscan.value = int(time())
        config.plugins.epgrefresh.lastscan.save()
        if config.plugins.epgrefresh.save_epg.value:
            try:
                from enigma import eEPGCache
                epgcache = eEPGCache.getInstance()
                epgcache.save()
                print("[EPGRefresh] save epgcache...")
            except:
                pass
            if config.plugins.epgrefresh_extra.save_backup.value and config.plugins.epgrefresh_extra.epgcachepath.value != "/etc/enigma2/":
                from os import system as my_system
                from os import chmod as my_chmod
                from os import path as my_path
                restore_backup = config.misc.epgcache_filename.value + ".backup"
                if my_path.exists(config.misc.epgcache_filename.value):
                    try:
                        my_system("cp -f %s %s" %
                                  (config.misc.epgcache_filename.value,
                                   restore_backup))
                        my_chmod("%s" % (restore_backup), 0644)
                        print("[EPGRefresh] save epgcache backup...")
                    except:
                        pass
        if config.plugins.epgrefresh.parse_autotimer.value:
            try:
                from Plugins.Extensions.AutoTimer.plugin import autotimer

                if autotimer is None:
                    from Plugins.Extensions.AutoTimer.AutoTimer import AutoTimer
                    autotimer = AutoTimer()
                autotimer.readXml()
                autotimer.parseEPGAsync(simulateOnly=False)
                if not self.autotimer_pause.isActive():
                    if config.plugins.epgrefresh.afterevent.value and not self.DontShutdown:
                        try:
                            from Plugins.Extensions.SeriesPlugin.plugin import renameTimer
                        except:
                            self.autotimer_pause.startLongTimer(120)
                        else:
                            self.autotimer_pause.startLongTimer(
                                int(config.plugins.epgrefresh.timeout_shutdown.
                                    value) * 60)
                    else:
                        self.finish()
            except Exception as e:
                print("[EPGRefresh] Could not start AutoTimer:", e)
                self.finish()
        else:
            self.finish()
Example #2
0
	def cleanUp(self):
		config.plugins.epgrefresh.lastscan.value = int(time())
		config.plugins.epgrefresh.lastscan.save()
		if config.plugins.epgrefresh.save_epg.value:
			try:
				from enigma import eEPGCache
				epgcache = eEPGCache.getInstance()
				epgcache.save()
				print("[EPGRefresh] save epgcache...")
			except:
				pass
			if config.plugins.epgrefresh_extra.save_backup.value and config.plugins.epgrefresh_extra.epgcachepath.value != "/etc/enigma2/":
				from os import system as my_system
				from os import chmod as my_chmod
				from os import path as my_path
				restore_backup = config.misc.epgcache_filename.value + ".backup"
				if my_path.exists(config.misc.epgcache_filename.value):
					try:
						my_system("cp -f %s %s" % (config.misc.epgcache_filename.value, restore_backup))
						my_chmod("%s" % (restore_backup), 0644)
						print("[EPGRefresh] save epgcache backup...")
					except:
						pass
		if config.plugins.epgrefresh.parse_autotimer.value:
			try:
				from Plugins.Extensions.AutoTimer.plugin import autotimer

				if autotimer is None:
					from Plugins.Extensions.AutoTimer.AutoTimer import AutoTimer
					autotimer = AutoTimer()
				autotimer.readXml()
				autotimer.parseEPGAsync(simulateOnly=False)
				if not self.autotimer_pause.isActive():
					if config.plugins.epgrefresh.afterevent.value and not self.DontShutdown:
						try:
							from Plugins.Extensions.SeriesPlugin.plugin import renameTimer
						except:
							self.autotimer_pause.startLongTimer(120)
						else:
							self.autotimer_pause.startLongTimer(int(config.plugins.epgrefresh.timeout_shutdown.value)*60)
					else:
						self.finish()
			except Exception as e:
				print("[EPGRefresh] Could not start AutoTimer:", e)
				self.finish()
		else:
			self.finish()
Example #3
0
	def _ToDoCallAutotimerCB(self, parseAT):
		print("[EPGRefresh] Debug: Call AutoTimer: " + str(parseAT))
		if parseAT:
			try:
				# Import Instance
				from Plugins.Extensions.AutoTimer.plugin import autotimer
	
				if autotimer is None:
					# Create an instance
					from Plugins.Extensions.AutoTimer.AutoTimer import AutoTimer
					autotimer = AutoTimer()
	
				# Parse EPG
				autotimer.parseEPGAsync(simulateOnly=False).addCallback(self._nextTodo).addErrback(self._autotimerErrback)
			except:
				from traceback import format_exc
				print("[EPGRefresh] Could not start AutoTimer:" + str(format_exc()))
		else:
			self._nextTodo()
Example #4
0
	def _ToDoCallAutotimerCB(self, parseAT):
		print("[EPGRefresh] Debug: Call AutoTimer: " + str(parseAT))
		if parseAT:
			try:
				# Import Instance
				from Plugins.Extensions.AutoTimer.plugin import autotimer
	
				if autotimer is None:
					# Create an instance
					from Plugins.Extensions.AutoTimer.AutoTimer import AutoTimer
					autotimer = AutoTimer()
	
				# Parse EPG
				autotimer.parseEPGAsync(simulateOnly=False).addCallback(self._nextTodo).addErrback(self._autotimerErrback)
			except:
				from traceback import format_exc
				print("[EPGRefresh] Could not start AutoTimer:" + str(format_exc()))
				self._nextTodo()
		else:
			self._nextTodo()
Example #5
0
def doneImport(reboot=False, epgfile=None):
	global _session, lastImportResult, BouquetChannelListList, parse_autotimer, serviceIgnoreList
	BouquetChannelListList = None
	serviceIgnoreList = None
	lastImportResult = (time.time(), epgimport.eventCount)
	try:
		start, count = lastImportResult
		localtime = time.asctime( time.localtime(time.time()))
		lastimport = "%s, %d" % (localtime, count)
		config.plugins.extra_epgimport.last_import.value = lastimport
		config.plugins.extra_epgimport.last_import.save()
		print>>log, "[EPGImport] Save last import date and count event"
	except:
		print>>log, "[EPGImport] Error to save last import date and count event"
	if reboot:
		if Screens.Standby.inStandby:
			print>>log, "[EPGImport] Restart enigma2"
			restartEnigma(True)
		else:
			msg = _("EPG Import finished, %d events") % epgimport.eventCount + "\n" + _("You must restart Enigma2 to load the EPG data,\nis this OK?")
			_session.openWithCallback(restartEnigma, MessageBox, msg, MessageBox.TYPE_YESNO, timeout = 15, default = True)
			print>>log, "[EPGImport] Need restart enigma2"
	else:
		if config.plugins.epgimport.parse_autotimer.value and fileExists("/usr/lib/enigma2/python/Plugins/Extensions/AutoTimer/plugin.py"):
			try:
				from Plugins.Extensions.AutoTimer.plugin import autotimer
				if autotimer is None:
					from Plugins.Extensions.AutoTimer.AutoTimer import AutoTimer
					autotimer = AutoTimer()
				if not parse_autotimer:
					autotimer.readXml()
					checkDeepstandby(_session, parse=True)
					autotimer.parseEPGAsync(simulateOnly=False)
					print>>log, "[EPGImport] Run start parse autotimers"
					parse_autotimer = True
			except:
				print>>log, "[EPGImport] Could not start autotimers"
				checkDeepstandby(_session, parse=False)
		else:
			checkDeepstandby(_session, parse=False)
def doneImport(reboot=False, epgfile=None):
	global _session, lastImportResult, BouquetChannelListList, parse_autotimer, serviceIgnoreList
	BouquetChannelListList = None
	serviceIgnoreList = None
	lastImportResult = (time.time(), epgimport.eventCount)
	try:
		start, count = lastImportResult
		localtime = time.asctime( time.localtime(time.time()))
		lastimport = "%s, %d" % (localtime, count)
		config.plugins.extra_epgimport.last_import.value = lastimport
		config.plugins.extra_epgimport.last_import.save()
		print>>log, "[EPGImport] Save last import date and count event"
	except:
		print>>log, "[EPGImport] Error to save last import date and count event"
	if reboot:
		if Screens.Standby.inStandby:
			print>>log, "[EPGImport] Restart enigma2"
			restartEnigma(True)
		else:
			msg = _("EPG Import finished, %d events") % epgimport.eventCount + "\n" + _("You must restart Enigma2 to load the EPG data,\nis this OK?")
			_session.openWithCallback(restartEnigma, MessageBox, msg, MessageBox.TYPE_YESNO, timeout = 15, default = True)
			print>>log, "[EPGImport] Need restart enigma2"
	else:
		if config.plugins.epgimport.parse_autotimer.value and fileExists("/usr/lib/enigma2/python/Plugins/Extensions/AutoTimer/plugin.py"):
			try:
				from Plugins.Extensions.AutoTimer.plugin import autotimer
				if autotimer is None:
					from Plugins.Extensions.AutoTimer.AutoTimer import AutoTimer
					autotimer = AutoTimer()
				if not parse_autotimer:
					autotimer.readXml()
					checkDeepstandby(_session, parse=True)
					autotimer.parseEPGAsync(simulateOnly=False)
					print>>log, "[EPGImport] Run start parse autotimers"
					parse_autotimer = True
			except:
				print>>log, "[EPGImport] Could not start autotimers"
				checkDeepstandby(_session, parse=False)
		else:
			checkDeepstandby(_session, parse=False)