Beispiel #1
0
    def prepareRefresh(self):
        if not self.isRefreshAllowed():
            return
        self.isrunning = True
        print("[EPGRefresh] About to start refreshing EPG")

        self._initFinishTodos()
        # Maybe read in configuration
        try:
            self.readConfiguration()
        except Exception as e:
            print("[EPGRefresh] Error occured while reading in configuration:",
                  e)

        self.scanServices = self.generateServicelist(self.services[0],
                                                     self.services[1])

        # Debug
        print("[EPGRefresh] Services we're going to scan:",
              ', '.join([repr(x) for x in self.scanServices]))

        self.maybeStopAdapter()
        # NOTE: start notification is handled in adapter initializer
        if config.plugins.epgrefresh.adapter.value.startswith("pip"):
            hidden = config.plugins.epgrefresh.adapter.value == "pip_hidden"
            refreshAdapter = PipAdapter(self.session, hide=hidden)
        elif config.plugins.epgrefresh.adapter.value.startswith("record"):
            refreshAdapter = RecordAdapter(self.session)
        else:
            refreshAdapter = MainPictureAdapter(self.session)

        if (not refreshAdapter.backgroundCapable
                and Screens.Standby.inStandby) or not refreshAdapter.prepare():
            print(
                "[EPGRefresh] Adapter is not able to run in background or not available, falling back to MainPictureAdapter"
            )
            refreshAdapter = MainPictureAdapter(self.session)
            refreshAdapter.prepare()
        self.refreshAdapter = refreshAdapter

        try:
            from plugin import AdjustExtensionsmenu, extStopDescriptor, extPendingServDescriptor, extRunDescriptor
            AdjustExtensionsmenu(True, extPendingServDescriptor)
            AdjustExtensionsmenu(True, extStopDescriptor)
            AdjustExtensionsmenu(False, extRunDescriptor)
        except:
            print(
                "[EPGRefresh] Error while adding 'Stop Running EPG-Refresh' to Extensionmenu"
            )
            print_exc(file=stdout)
        if config.plugins.epgrefresh.erase.value:
            print("[EPGRefresh] flushing EPG cache...")
            from enigma import eEPGCache
            epgcache = eEPGCache.getInstance()
            epgcache.flushEPG()
        self.refresh()
Beispiel #2
0
	def cleanUp(self):
		print("[EPGRefresh] Debug: Cleanup")
		config.plugins.epgrefresh.lastscan.value = int(time())
		config.plugins.epgrefresh.lastscan.save()
		self.doStopRunningRefresh = False

		try:
			from plugin import AdjustExtensionsmenu, housekeepingExtensionsmenu, extStopDescriptor, extPendingServDescriptor
			AdjustExtensionsmenu(False, extPendingServDescriptor)
			AdjustExtensionsmenu(False, extStopDescriptor)
			housekeepingExtensionsmenu(config.plugins.epgrefresh.show_run_in_extensionsmenu, force=True)
		except:
			print("[EPGRefresh] Error while removing 'Stop Running EPG-Refresh' to Extensionmenu:")
			print_exc(file=stdout)

		# Start Todo-Chain
		self._nextTodo()