def record(self):
		logDebug("SPI: record")
		if self.event and self.service:
			event = self.event
			ref = self.service
			if event is None:
				return
			eventid = event.getEventId()
			eref = eServiceReference(str(ref))
			refstr = eref.toString()
			for timer in self.session.nav.RecordTimer.timer_list:
				if timer.eit == eventid and timer.service_ref.ref.toString() == refstr:
					cb_func = lambda ret : not ret or self.removeTimer(timer)
					self.session.openWithCallback(cb_func, MessageBox, _("Do you really want to delete %s?") % event.getEventName())
					break
			else:
				#newEntry = RecordTimerEntry(ServiceReference(ref), checkOldTimers = True, dirname = preferredTimerPath(), *parseEvent(self.event))
				begin, end, name, description, eit = parseEvent(self.event)
				
				from SeriesPlugin import refactorTitle, refactorDescription
				if self.data:
					name = refactorTitle(name, self.data)
					description = refactorDescription(description, self.data)
				
				#newEntry = RecordTimerEntry(ServiceReference(refstr), begin, end, name, description, eit, dirname = preferredTimerPath())
				newEntry = RecordTimerEntry(ServiceReference(str(ref)), begin, end, name, description, eit, dirname = preferredTimerPath())
				#newEntry = RecordTimerEntry(refstr, begin, end, name, description, eit, dirname = preferredTimerPath())
				self.session.openWithCallback(self.finishedAdd, TimerEntry, newEntry)
 def parse(root):
     channels = {}
     version = root.get("version", "1")
     if version.startswith("1"):
         logDebug("loadXML channels - Skip old file")
     elif version.startswith("2") or version.startswith("3") or version.startswith("4"):
         logDebug("Channel XML Version 4")
         ChannelsBase.channels_changed = True
         if root:
             for element in root.findall("Channel"):
                 name = element.get("name", "")
                 reference = element.get("reference", "")
                 if name and reference:
                     alternatives = []
                     for alternative in element.findall("Alternative"):
                         alternatives.append(alternative.text)
                     channels[reference] = (name, list(set(alternatives)))
                     logDebug("Channel", reference, channels[reference])
     else:
         # XMLTV compatible channels file
         logDebug("Channel XML Version 5")
         if root:
             for element in root.findall("channel"):
                 alternatives = []
                 id = element.get("id", "")
                 alternatives.append(id)
                 name = element.get("name", "")
                 reference = element.text
                 # Test customization but XML conform
                 for web in element.findall("web"):
                     alternatives.append(web.text)
                 channels[reference] = (name, list(set(alternatives)))
                 logDebug("Channel", reference, channels[reference])
     return channels
def buildSTBchannellist(BouquetName=None):
    chlist = None
    chlist = []
    mask = eServiceReference.isMarker | eServiceReference.isDirectory
    logDebug("SPC: read STB Channellist..")
    tvbouquets = getTVBouquets()
    logDebug("SPC: found %s bouquet: %s" % (len(tvbouquets), tvbouquets))

    if not BouquetName:
        for bouquet in tvbouquets:
            bouquetlist = []
            bouquetlist = getServiceList(bouquet[0])
            for (serviceref, servicename) in bouquetlist:
                playable = not (eServiceReference(serviceref).flags & mask)
                if playable:
                    chlist.append((servicename, re.sub("::.*", ":", serviceref), unifyChannel(servicename)))
    else:
        for bouquet in tvbouquets:
            if bouquet[1] == BouquetName:
                bouquetlist = []
                bouquetlist = getServiceList(bouquet[0])
                for (serviceref, servicename) in bouquetlist:
                    playable = not (eServiceReference(serviceref).flags & mask)
                    if playable:
                        chlist.append((servicename, re.sub("::.*", ":", serviceref), unifyChannel(servicename)))
                break
    return chlist
    def setColorButtons(self):
        try:
            logDebug("SPI: event eit", self.event and self.event.getEventId())
            if self.service and self.data:

                if self.path and os.path.exists(self.path):
                    # Record file exists
                    self["key_red"].setText(_("Rename"))
                    self.redButtonFunction = self.rename
                elif self.event and self.event.getEventId():
                    # Event exists
                    #if (not self.service.flags & eServiceReference.isGroup) and self.service.getPath() and self.service.getPath()[0] == '/'
                    #for timer in self.session.nav.RecordTimer.timer_list:
                    #	if timer.eit == eventid and timer.service_ref.ref.toString() == refstr:
                    #		cb_func = lambda ret : not ret or self.removeTimer(timer)
                    self["key_red"].setText(_("Record"))
                    self.redButtonFunction = self.record
                else:
                    self["key_red"].setText("")
                    self.redButtonFunction = None
            else:
                self["key_red"].setText("")
                self.redButtonFunction = None
        except:
            pass
示例#5
0
def labelTimer(timer, begin=None, end=None, *args, **kwargs):
	if config.plugins.seriesplugin.enabled.value:
		logDebug("SeriesPlugin labelTimer is deprecated - Update Your AutoTimer!")
		try:
			SeriesPluginTimer(timer, timer.name, timer.begin, timer.end)
		except Exception as e:
			logDebug(_("SeriesPlugin label exception ") + str(e))
def test(session=None):
	# http://dm7080/autotimer
	# http://www.unixtime.de/
	try:
		#from SeriesPluginBare import bareGetSeasonEpisode 	#future=True, today=False, elapsed=False
		#bareGetSeasonEpisode("1:0:19:7C:6:85:FFFF0000:0:0:0:", "The Walking Dead", 1448740500, 1448745600, "Description", "/media/hdd/movie", True, False, False)
		#bareGetSeasonEpisode("1:0:1:2F50:F1:270F:FFFF0000:0:0:0:", "Are You the One?", 1448923500, 1448926500, "Description", "/media/hdd/movie", False, False, True)
		#bareGetSeasonEpisode("1:0:19:814D:14B:270F:FFFF0000:0:0:0:", "Bones", 1451416200, 1451416200, "Description", "/media/hdd/movie", False, True, False)
		#sp = bareGetSeasonEpisode("1:0:19:2B66:437:66:FFFF0000:0:0:0:", "Bares für Rares", 1451311500, 1451311500, "Description", "/media/hdd/movie", False, True, False)
		#sp = bareGetSeasonEpisode("1:0:19:7980:1C3:270F:FFFF0000:0:0:0:", "Offroad Survivors", 1451492100, 1451492100, "Description", "/media/hdd/movie", False, True, False)
		#from Tools.Notifications import AddPopup
		#AddPopup( sp[0], MessageBox.TYPE_INFO, 0, 'SP_PopUp_ID_Test' )
		
		#TEST INFOSCREEN MOVIE
		#	from enigma import eServiceReference
			#service = eServiceReference(eServiceReference.idDVB, 0, "/media/hdd/movie/20151120 0139 - Pro7 HD - The 100.ts")
			#service = eServiceReference(eServiceReference.idDVB, 0, "/media/hdd/movie/20151205 1625 - TNT Serie HD (S) - The Last Ship - Staffel 1.ts")
			#service = eServiceReference(eServiceReference.idDVB, 0, "/media/hdd/movie/20151204 1825 - VIVA_COMEDY CENTRAL HD - Rules of Engagement.ts")
		#	movielist_info(session, service)
		
		#TEST AUTOTIMER
		#from SeriesPluginBare import bareGetSeasonEpisode
		#bareGetSeasonEpisode("1:0:1:2F50:F1:270F:FFFF0000:0:0:0:", "Are You the One", 1448751000, 1448754000, "Description", "/media/hdd/movie", False, False, True)
		#bareGetSeasonEpisode("1:0:19:8150:14B:270F:FFFF0000:0:0:0:", "Dragons Auf zu neuen Ufern TEST_TO_BE_REMOVED", 1449390300, 1449393300, "Description", "/media/hdd/movie", False, False, True)
		pass
		
	except Exception as e:
		logDebug(_("SeriesPlugin test exception ") + str(e))
	def run(self):
		
		while not self.__queue.empty():
			
			# NOTE: we have to check this here and not using the while to prevent the parser to be started on shutdown
			if not self.__running: break
			
			logDebug('Worker is processing')
			
			item = self.__queue.pop()
			
			result = None
			
			try:
				result = item.identifier.getEpisode(
					item.name, item.begin, item.end, item.service
				)
			except Exception, e:
				logDebug("Worker: Exception:", str(e))
				
				# Exception finish job with error
				result = str(e)
			
			config.plugins.seriesplugin.lookup_counter.value += 1
			
			self.__messages.push( (item.callback, normalizeResult(result)) )
			
			self.__pump.send(0)
def normalizeResult(result):
	if result and isinstance(result, dict):
		logDebug(" Worker: result callback")
		title_   = result['title'].strip()
		series_  = result['series'].strip()
		season_  = result['season']
		episode_ = result['episode']
		
		result['rawseason'] = season_ or str(config.plugins.seriesplugin.default_season.value)
		result['rawepisode'] = episode_ or str(config.plugins.seriesplugin.default_episode.value)
		result['season'] = int(CompiledRegexpNonDecimal.sub('\\1', str(season_)) or config.plugins.seriesplugin.default_season.value)
		result['episode'] = int(CompiledRegexpNonDecimal.sub('\\1', str(episode_)) or config.plugins.seriesplugin.default_episode.value)
		
		if CompiledRegexpReplaceChars:
			title = CompiledRegexpReplaceChars.sub('', title_)
			#logDebug(" normalize title", title_, title)
			series = CompiledRegexpReplaceChars.sub('', series_)
			#logDebug(" normalize series", series_, series)
		else:
			title = title_
			series = series_
		result['title']  = title
		result['series'] = series
		return result
	else:
		logDebug(" Worker: result failed", str(result))
		return result
def buildSTBchannellist(BouquetName = None):
	chlist = None
	chlist = []
	mask = (eServiceReference.isMarker | eServiceReference.isDirectory)
	logDebug("SPC: read STB Channellist..")
	tvbouquets = getTVBouquets()
	logDebug("SPC: found %s bouquet: %s" % (len(tvbouquets), tvbouquets) )

	if not BouquetName:
		for bouquet in tvbouquets:
			bouquetlist = []
			bouquetlist = getServiceList(bouquet[0])
			for (serviceref, servicename) in bouquetlist:
				playable = not (eServiceReference(serviceref).flags & mask)
				if playable:
					chlist.append((servicename, re.sub('::.*', ':', serviceref), unifyChannel(servicename)))
	else:
		for bouquet in tvbouquets:
			if bouquet[1] == BouquetName:
				bouquetlist = []
				bouquetlist = getServiceList(bouquet[0])
				for (serviceref, servicename) in bouquetlist:
					playable = not (eServiceReference(serviceref).flags & mask)
					if playable:
						chlist.append((servicename, re.sub('::.*', ':', serviceref), unifyChannel(servicename)))
				break
	return chlist
	def __init__(self):
		logDebug("Main: Init")
		self.thread = SeriesPluginWorker(self.gotResult)
		Modules.__init__(self)
		ChannelsBase.__init__(self)
		
		# Because of the same XMLFile base class we intantiate a new object
		self.xmltv = XMLTVBase()
		
		self.serviceHandler = eServiceCenter.getInstance()
		
		#http://bugs.python.org/issue7980
		datetime.strptime('2012-01-01', '%Y-%m-%d')
		
		self.identifier_elapsed = self.instantiateModuleWithName( config.plugins.seriesplugin.identifier_elapsed.value )
		#logDebug(self.identifier_elapsed)
		
		self.identifier_today = self.instantiateModuleWithName( config.plugins.seriesplugin.identifier_today.value )
		#logDebug(self.identifier_today)
		
		self.identifier_future = self.instantiateModuleWithName( config.plugins.seriesplugin.identifier_future.value )
		#logDebug(self.identifier_future)
		
		pattern = config.plugins.seriesplugin.pattern_title.value
		pattern = pattern.replace("{org:s}", "(.+)")
		pattern = re.sub('{season:?\d*d?}', '\d+', pattern)
		pattern = re.sub('{episode:?\d*d?}', '\d+', pattern)
		pattern = re.sub('{rawseason:s}', '.+', pattern)
		pattern = re.sub('{rawseason:s}', '.+', pattern)
		pattern = pattern.replace("{title:s}", ".+")
		self.compiledRegexpSeries = re.compile(pattern)
    def getSeasonEpisode(self, name, webChannel, unixtime, max_time_drift):
        result = None

        skipped = self.skip.get(name, None)
        if skipped:
            if (time() - skipped) < skip_expiration:
                #return _("Skipped")
                socket.setdefaulttimeout(reduced_timeout)
            else:
                del self.skip[name]

        try:
            result = self.sp.cache.getSeasonEpisode(name, webChannel, unixtime,
                                                    max_time_drift)
            logDebug("SerienServer getSeasonEpisode result:", result)
        except Exception as e:
            logInfo("Exception in xmlrpc: " + str(e) + ' - ' + str(result))
            self.skip[name] = time()
            result = str(e)

        if skipped:
            timeout = config.plugins.seriesplugin.socket_timeout.value
            socket.setdefaulttimeout(float(timeout))

        return result
				def parse(root):
					channels = {}
					version = root.get("version", "1")
					if version.startswith("1"):
						logDebug("loadXML channels - Skip old file")
					elif version.startswith("2") or version.startswith("3") or version.startswith("4"):
						logDebug("Channel XML Version 4")
						ChannelsBase.channels_changed = True
						if root:
							for element in root.findall("Channel"):
								name = element.get("name", "")
								reference = element.get("reference", "")
								if name and reference:
									alternatives = []
									for alternative in element.findall("Alternative"):
										alternatives.append( alternative.text )
									channels[reference] = (name, list(set(alternatives)))
									logDebug("Channel", reference, channels[reference] )
					else:
						# XMLTV compatible channels file
						logDebug("Channel XML Version 5")
						if root:
							for element in root.findall("channel"):
								alternatives = []
								id = element.get("id", "")
								alternatives.append( id )
								name = element.get("name", "")
								reference = element.text
								#Test customization but XML conform
								for web in element.findall("web"):
									alternatives.append( web.text )
								channels[reference] = (name, list(set(alternatives)))
								logDebug("Channel", reference, channels[reference] )
					return channels
示例#13
0
def refactorDescription(org_, data):
    if CompiledRegexpReplaceChars:
        org = CompiledRegexpReplaceChars.sub('', org_)
        logDebug("SP: refactor desc", org_, org)
    else:
        org = org_
    if data:
        season, episode, title, series = data
        if config.plugins.seriesplugin.pattern_description.value and not config.plugins.seriesplugin.pattern_description.value == "Off" and not config.plugins.seriesplugin.pattern_description.value == "Disabled":
            cust_ = config.plugins.seriesplugin.pattern_description.value.strip(
            ).format(
                **{
                    'org': org,
                    'season': season,
                    'episode': episode,
                    'title': title,
                    'series': series
                })
            cust = cust_.replace("\n", " ").replace('&amp;', '&').replace(
                '&apos;',
                "'").replace('&gt;', '>').replace('&lt;', '<').replace(
                    '&quot;', '"').replace('/', ' ').replace('  ', ' ')
            logDebug("SP: refactor desc", cust_, cust)
            return cust
        else:
            return org
    else:
        return org
示例#14
0
def test(session=None):
    # http://dm7080/autotimer
    # http://www.unixtime.de/
    try:
        #from SeriesPluginBare import bareGetSeasonEpisode 	#future=True, today=False, elapsed=False
        #bareGetSeasonEpisode("1:0:19:7C:6:85:FFFF0000:0:0:0:", "The Walking Dead", 1448740500, 1448745600, "Description", "/media/hdd/movie", True, False, False)
        #bareGetSeasonEpisode("1:0:1:2F50:F1:270F:FFFF0000:0:0:0:", "Are You the One?", 1448923500, 1448926500, "Description", "/media/hdd/movie", False, False, True)
        #bareGetSeasonEpisode("1:0:19:814D:14B:270F:FFFF0000:0:0:0:", "Bones", 1451416200, 1451416200, "Description", "/media/hdd/movie", False, True, False)
        #sp = bareGetSeasonEpisode("1:0:19:2B66:437:66:FFFF0000:0:0:0:", "Bares für Rares", 1451311500, 1451311500, "Description", "/media/hdd/movie", False, True, False)
        #sp = bareGetSeasonEpisode("1:0:19:7980:1C3:270F:FFFF0000:0:0:0:", "Offroad Survivors", 1451492100, 1451492100, "Description", "/media/hdd/movie", False, True, False)
        #from Tools.Notifications import AddPopup
        #AddPopup( sp[0], MessageBox.TYPE_INFO, 0, 'SP_PopUp_ID_Test' )

        #TEST INFOSCREEN MOVIE
        #	from enigma import eServiceReference
        #service = eServiceReference(eServiceReference.idDVB, 0, "/media/hdd/movie/20151120 0139 - Pro7 HD - The 100.ts")
        #service = eServiceReference(eServiceReference.idDVB, 0, "/media/hdd/movie/20151205 1625 - TNT Serie HD (S) - The Last Ship - Staffel 1.ts")
        #service = eServiceReference(eServiceReference.idDVB, 0, "/media/hdd/movie/20151204 1825 - VIVA_COMEDY CENTRAL HD - Rules of Engagement.ts")
        #	movielist_info(session, service)

        #TEST AUTOTIMER
        #from SeriesPluginBare import bareGetSeasonEpisode
        #bareGetSeasonEpisode("1:0:1:2F50:F1:270F:FFFF0000:0:0:0:", "Are You the One", 1448751000, 1448754000, "Description", "/media/hdd/movie", False, False, True)
        #bareGetSeasonEpisode("1:0:19:8150:14B:270F:FFFF0000:0:0:0:", "Dragons Auf zu neuen Ufern TEST_TO_BE_REMOVED", 1449390300, 1449393300, "Description", "/media/hdd/movie", False, False, True)
        pass

    except Exception as e:
        logDebug(_("SeriesPlugin test exception ") + str(e))
示例#15
0
def labelTimer(timer, begin=None, end=None, *args, **kwargs):
	if config.plugins.seriesplugin.enabled.value:
		logDebug("SeriesPlugin labelTimer is deprecated - Update Your AutoTimer!")
		try:
			SeriesPluginTimer(timer, timer.name, timer.begin, timer.end)
		except Exception as e:
			logDebug(_("SeriesPlugin label exception ") + str(e))
    def loadXML(self):
        try:
            # Read xml config file
            root = self.readXML()
            if root:
                channels = {}

                # Parse Config
                def parse(root):
                    channels = {}
                    version = root.get("version", "1")
                    if version.startswith("1"):
                        logDebug("loadXML channels - Skip old file")
                    else:
                        if root:
                            for element in root.findall("Channel"):
                                name = element.get("name", "")
                                reference = element.get("reference", "")
                                if name and reference:
                                    alternatives = []
                                    for alternative in element.findall("Alternative"):
                                        alternatives.append(alternative.text)
                                    channels[reference] = (name, list(set(alternatives)))
                                    logDebug("SP loadXML parse", reference, channels[reference])
                    return channels

                channels = parse(root)
                # logDebug("loadXML channels", channels)
                logDebug("SP loadXML channels", len(channels))
            else:
                channels = {}
            ChannelsBase.channels = channels
        except Exception as e:
            logDebug("Exception in loadXML: " + str(e))
示例#17
0
def sp_extension(session, *args, **kwargs):
	if config.plugins.seriesplugin.enabled.value:
		try:
			if session:
				session.open(SeriesPluginInfoScreen)
		except Exception as e:
			logDebug(_("SeriesPlugin extension exception ") + str(e))
def test(**kwargs):
    # http://dm7080/autotimer
    # http://www.unixtime.de/
    try:
        # from SeriesPluginBare import bareGetSeasonEpisode 	#future=True, today=False, elapsed=False
        # bareGetSeasonEpisode("1:0:19:7C:6:85:FFFF0000:0:0:0:", "The Walking Dead", 1448740500, 1448745600, "Description", "/media/hdd/movie", True, False, False)
        # bareGetSeasonEpisode("1:0:1:2F50:F1:270F:FFFF0000:0:0:0:", "Are You the One?", 1448923500, 1448926500, "Description", "/media/hdd/movie", False, False, True)

        # TEST INFOSCREEN MOVIE
        # if kwargs.has_key("session"):
        # 	from enigma import eServiceReference
        # 	session = kwargs["session"]
        # service = eServiceReference(eServiceReference.idDVB, 0, "/media/hdd/movie/20151120 0139 - Pro7 HD - The 100.ts")
        # service = eServiceReference(eServiceReference.idDVB, 0, "/media/hdd/movie/20151205 1625 - TNT Serie HD (S) - The Last Ship - Staffel 1.ts")
        # service = eServiceReference(eServiceReference.idDVB, 0, "/media/hdd/movie/20151204 1825 - VIVA_COMEDY CENTRAL HD - Rules of Engagement.ts")
        # 	movielist_info(session, service)

        # TEST AUTOTIMER
        # from SeriesPluginBare import bareGetSeasonEpisode
        # bareGetSeasonEpisode("1:0:1:2F50:F1:270F:FFFF0000:0:0:0:", "Are You the One", 1448751000, 1448754000, "Description", "/media/hdd/movie", False, False, True)
        # bareGetSeasonEpisode("1:0:19:8150:14B:270F:FFFF0000:0:0:0:", "Dragons Auf zu neuen Ufern TEST_TO_BE_REMOVED", 1449390300, 1449393300, "Description", "/media/hdd/movie", False, False, True)
        pass

    except Exception as e:
        logDebug(_("SeriesPlugin test exception ") + str(e))
示例#19
0
def test(**kwargs):
	# http://dm7080/autotimer
	# http://www.unixtime.de/
	try:
		#from SeriesPluginBare import bareGetSeasonEpisode 	#future=True, today=False, elapsed=False
		#bareGetSeasonEpisode("1:0:19:7C:6:85:FFFF0000:0:0:0:", "The Walking Dead", 1448740500, 1448745600, "Description", "/media/hdd/movie", True, False, False)
		#bareGetSeasonEpisode("1:0:1:2F50:F1:270F:FFFF0000:0:0:0:", "Are You the One?", 1448923500, 1448926500, "Description", "/media/hdd/movie", False, False, True)
		
		#TEST INFOSCREEN MOVIE
		#if kwargs.has_key("session"):
		#	from enigma import eServiceReference
		#	session = kwargs["session"]
			#service = eServiceReference(eServiceReference.idDVB, 0, "/media/hdd/movie/20151120 0139 - Pro7 HD - The 100.ts")
			#service = eServiceReference(eServiceReference.idDVB, 0, "/media/hdd/movie/20151205 1625 - TNT Serie HD (S) - The Last Ship - Staffel 1.ts")
			#service = eServiceReference(eServiceReference.idDVB, 0, "/media/hdd/movie/20151204 1825 - VIVA_COMEDY CENTRAL HD - Rules of Engagement.ts")
		#	movielist_info(session, service)
		
		#TEST AUTOTIMER
		#from SeriesPluginBare import bareGetSeasonEpisode
		#bareGetSeasonEpisode("1:0:1:2F50:F1:270F:FFFF0000:0:0:0:", "Are You the One", 1448751000, 1448754000, "Description", "/media/hdd/movie", False, False, True)
		#bareGetSeasonEpisode("1:0:19:8150:14B:270F:FFFF0000:0:0:0:", "Dragons Auf zu neuen Ufern TEST_TO_BE_REMOVED", 1449390300, 1449393300, "Description", "/media/hdd/movie", False, False, True)
		pass
		
	except Exception as e:
		logDebug(_("SeriesPlugin test exception ") + str(e))
	def setColorButtons(self):
		try:
			logDebug("SPI: event eit", self.event and self.event.getEventId())
			if self.service and self.data:
				
				if self.path and os.path.exists(self.path):
					# Record file exists
					self["key_red"].setText(_("Rename"))
					self.redButtonFunction = self.rename
				elif self.event and self.event.getEventId():
					# Event exists
					#if (not self.service.flags & eServiceReference.isGroup) and self.service.getPath() and self.service.getPath()[0] == '/'
					#for timer in self.session.nav.RecordTimer.timer_list:
					#	if timer.eit == eventid and timer.service_ref.ref.toString() == refstr:
					#		cb_func = lambda ret : not ret or self.removeTimer(timer)
					self["key_red"].setText(_("Record"))
					self.redButtonFunction = self.record
				else:
					self["key_red"].setText("")
					self.redButtonFunction = None
			else:
				self["key_red"].setText("")
				self.redButtonFunction = None
		except:
			pass
示例#21
0
def sp_extension(session, *args, **kwargs):
	if config.plugins.seriesplugin.enabled.value:
		try:
			if session:
				session.open(SeriesPluginInfoScreen)
		except Exception as e:
			logDebug(_("SeriesPlugin extension exception ") + str(e))
示例#22
0
    def close(self):
        logDebug("SPI: user close")

        global instance
        instance = None

        # Call baseclass function
        Screen.close(self)
示例#23
0
	def keyCancel(self):
		logDebug("SPC keyCancel")
		#self.seriesPlugin.resetChannels()
		resetInstance()
		if self["config"].isChanged() or self.changesMade:
			self.session.openWithCallback(self.cancelConfirm, MessageBox, _("Really close without saving settings?"))
		else:
			self.close()
	def close(self):
		logDebug("SPI: user close")
		
		global instance
		instance = None
		
		# Call baseclass function
		Screen.close(self)
	def channelReset(self, answer):
		if answer:
			logDebug("SPC: channel-list reset...")
			self.resetChannels()
			self.stbChlist = []
			self.webChlist = []
			self.stbToWebChlist = []
			self.readChannels()
示例#26
0
def getSeasonEpisode4(service_ref, name, begin, end, description, path, *args, **kwargs):
	if config.plugins.seriesplugin.enabled.value:
		from SeriesPluginBare import bareGetSeasonEpisode
		try:
			return bareGetSeasonEpisode(service_ref, name, begin, end, description, path, True, False, False)
		except Exception as e:
			logDebug( "SeriesPlugin getSeasonEpisode4 exception " + str(e))
			return str(e)
示例#27
0
 def channelReset(self, answer):
     if answer:
         logDebug("SPC: channel-list reset...")
         self.resetChannels()
         self.stbChlist = []
         self.webChlist = []
         self.stbToWebChlist = []
         self.readChannels()
示例#28
0
    def getWebChannels(self):

        logDebug("SerienServer getWebChannels()")

        result = self.server.getWebChannels()
        logDebug("SerienServer getWebChannels result:", result)

        return result
	def keyCancel(self):
		logDebug("SPC keyCancel")
		#self.seriesPlugin.resetChannels()
		resetInstance()
		if self["config"].isChanged() or self.changesMade:
			self.session.openWithCallback(self.cancelConfirm, MessageBox, _("Really close without saving settings?"))
		else:
			self.close()
示例#30
0
def getSeasonEpisode4(service_ref, name, begin, end, description, path, *args, **kwargs):
	if config.plugins.seriesplugin.enabled.value:
		from SeriesPluginBare import bareGetSeasonEpisode
		try:
			return bareGetSeasonEpisode(service_ref, name, begin, end, description, path, True, False, False)
		except Exception as e:
			logDebug( "SeriesPlugin getSeasonEpisode4 exception " + str(e))
			return str(e)
	def getWebChannels(self):
		
		logDebug("SerienServer getWebChannels()")
		
		result = self.server.getWebChannels()
		logDebug("SerienServer getWebChannels result:", result)
		
		return result
	def stop(self):
		logDebug("SP: Main: stop")
		self.thread.stop()
		# NOTE: while we don't need to join the thread, we should do so in case it's currently parsing
		#self.thread.join()
		
		self.thread = None
		self.saveXML()
示例#33
0
def channel(session, service=None, *args, **kwargs):
	if config.plugins.seriesplugin.enabled.value:
		try:
			from enigma import eServiceCenter
			info = eServiceCenter.getInstance().info(service)
			event = info.getEvent(service)
			session.open(SeriesPluginInfoScreen, service, event)
		except Exception as e:
			logDebug(_("SeriesPlugin extension exception ") + str(e))
	def __init__(self, timer, name, begin, end, block=False):
		
		logDebug("SPT: SeriesPluginTimer: name, timername, begin, end:", name, timer.name, begin, end)
		
		if block:
			# We do not want to execute the blocking code here
			return
		
		self.getSeasonAndEpisode(timer, name, begin, end, block)
示例#35
0
    def stop(self):
        logDebug("SP: Main: stop")
        if self.thread:
            self.thread.stop()
        # NOTE: while we don't need to join the thread, we should do so in case it's currently parsing
        #self.thread.join()

        self.thread = None
        self.saveXML()
示例#36
0
def recoverAutoTimer():
	try:
		global ATmodifyTimer
		if AutoTimer:
			if ATmodifyTimer:
				AutoTimer.modifyTimer = ATmodifyTimer
				ATmodifyTimer = None
	except:
		logDebug("SeriesPlugin found old AutoTimer")
示例#37
0
def channel(session, service=None, *args, **kwargs):
	if config.plugins.seriesplugin.enabled.value:
		try:
			from enigma import eServiceCenter
			info = eServiceCenter.getInstance().info(service)
			event = info.getEvent(service)
			session.open(SeriesPluginInfoScreen, service, event)
		except Exception as e:
			logDebug(_("SeriesPlugin extension exception ") + str(e))
示例#38
0
    def episodeCallback(self, data=None):
        #TODO episode list handling
        #store the list and just open the first one

        logDebug("SPI: episodeCallback", data)
        #logDebug(data)
        if data and len(data) == 4:
            # Episode data available
            season, episode, title, series = self.data = data

            if season == 0 and episode == 0:
                custom = _("{title:s}").format(**{
                    'season': season,
                    'episode': episode,
                    'title': title
                })
            elif season == 0:
                custom = _("Episode: {episode:d}\n{title:s}").format(
                    **{
                        'season': season,
                        'episode': episode,
                        'title': title
                    })
            elif episode == 0:
                custom = _("Season: {season:d}\n{title:s}").format(
                    **{
                        'season': season,
                        'episode': episode,
                        'title': title
                    })
            else:
                custom = _(
                    "Season: {season:d}  Episode: {episode:d}\n{title:s}"
                ).format(**{
                    'season': season,
                    'episode': episode,
                    'title': title
                })

            try:
                self.setColorButtons()
            except Exception as e:
                # Screen already closed
                logDebug("SPI: exception:", str(e))
        elif data:
            custom = str(data)
        else:
            custom = _("No matching episode found")

        # Check if the dialog is already closed
        try:
            self["event_episode"].setText(custom)
        except Exception as e:
            # Screen already closed
            #logDebug("SPI: exception:", str(e))
            pass
	def stop(self):
		logDebug(" Main: stop")
		if self.thread:
			self.thread.stop()
		# NOTE: while we don't need to join the thread, we should do so in case it's currently parsing
		#self.thread.join()
		
		self.thread = None
		self.saveXML()
		self.xmltv.writeXMLTVConfig()
def compareChannels(ref, remote):
	logDebug("compareChannels", ref, remote)
	remote = remote.lower()
	if ref in ChannelsBase.channels:
		( name, alternatives ) = ChannelsBase.channels[ref]
		for altname in alternatives:
			if altname.lower() in remote or remote in altname.lower():
				return True
		
	return False
def compareChannels(ref, remote):
    logDebug("compareChannels", ref, remote)
    remote = remote.lower()
    if ref in ChannelsBase.channels:
        (name, alternatives) = ChannelsBase.channels[ref]
        for altname in alternatives:
            if altname.lower() in remote or remote in altname.lower():
                return True

    return False
示例#42
0
def getSeasonAndEpisode(timer, name, begin, end, *args, **kwargs):
	result = None
	if config.plugins.seriesplugin.enabled.value:
		logDebug("SeriesPlugin getSeasonEpisode is deprecated - Update Your AutoTimer!")
		try:
			spt = SeriesPluginTimer(timer, name, begin, end, True)
			result = spt.getSeasonAndEpisode(timer, name, begin, end, True, False, False)
		except Exception as e:
			logDebug(_("SeriesPlugin label exception ") + str(e))
	return result
示例#43
0
def getSeasonAndEpisode(timer, name, begin, end, *args, **kwargs):
	result = None
	if config.plugins.seriesplugin.enabled.value:
		logDebug("SeriesPlugin getSeasonEpisode is deprecated - Update Your AutoTimer!")
		try:
			spt = SeriesPluginTimer(timer, name, begin, end, True)
			result = spt.getSeasonAndEpisode(timer, name, begin, end)
		except Exception as e:
			logDebug(_("SeriesPlugin label exception ") + str(e))
	return result
    def __init__(self, timer, name, begin, end, block=False):

        logDebug("SPT: SeriesPluginTimer: name, timername, begin, end:", name,
                 timer.name, begin, end)

        if block:
            # We do not want to execute the blocking code here
            return

        self.getSeasonAndEpisode(timer, name, begin, end, block)
示例#45
0
 def removeConfirm(self, servicename, serviceref, answer):
     if not answer:
         return
     if serviceref:
         idx = self.getIndexOfServiceref(serviceref)
         if idx is not False:
             logDebug("SPC: removeConfirm", servicename, serviceref, idx)
             self.setTitle(_("Channel '- %s -' removed.") % servicename)
             self.removeChannel(serviceref)
             self.stbToWebChlist[idx] = (servicename, "", serviceref, "0")
             self['list'].setList(self.stbToWebChlist)
def lookupChannelByReference(ref):
	if ref in ChannelsBase.channels:
		( name, alternatives ) = ChannelsBase.channels[ref]
		altnames = []
		for altname in alternatives:
			if altname:
				logDebug("lookupChannelByReference", ref, altname)
				altnames.append(altname)
		return altnames
		
	return False
示例#47
0
	def doCacheList(self, url, list):
		global cache
		
		if not list:
			logDebug("Cache: Got empty list")
			return
		
		if not config.plugins.seriesplugin.caching.value:
			return
		
		cache[url] = ( time(), list )
	def keyRemove(self):
		check = self['list'].getCurrent()
		if check == None:
			logDebug("SPC: keyRemove list empty")
			return
		else:
			(servicename, webSender, serviceref, state) = self['list'].getCurrent()[0]
			logDebug("SPC: keyRemove", servicename, webSender, serviceref, state)
			if serviceref:
				#TODO handle multiple links/alternatives - show a choicebox
				self.session.openWithCallback( boundFunction(self.removeConfirm, servicename, serviceref), MessageBox, _("Remove '%s'?") % servicename, MessageBox.TYPE_YESNO, default = False)
示例#49
0
def movielist_rename(session, service, services=None, *args, **kwargs):
	if config.plugins.seriesplugin.enabled.value:
		try:
			if services:
				if not isinstance(services, list):
					services = [services]	
			else:
				services = [service]
			SeriesPluginRenamer(session, services)
		except Exception as e:
			logDebug(_("SeriesPlugin renamer exception ") + str(e))
	def removeConfirm(self, servicename, serviceref, answer):
		if not answer:
			return
		if serviceref:
			idx = self.getIndexOfServiceref(serviceref)
			if idx is not False:
				logDebug("SPC: removeConfirm", servicename, serviceref, idx)
				self.setTitle(_("Channel '- %s -' removed.") % servicename)
				self.removeChannel(serviceref)
				self.stbToWebChlist[idx] = (servicename, "", serviceref, "0")
				self.chooseMenuList.setList(map(self.buildList, self.stbToWebChlist))
示例#51
0
    def doCachePage(self, url, page):
        global cache

        if not page:
            logDebug("Cache: Got empty page")
            return

        if not config.plugins.seriesplugin.caching.value:
            return

        cache[url] = (time(), page)
示例#52
0
    def doCacheList(self, url, list):
        global cache

        if not list:
            logDebug("Cache: Got empty list")
            return

        if not config.plugins.seriesplugin.caching.value:
            return

        cache[url] = (time(), list)
	def addChannel(self, ref, name, remote):
		logDebug("SP addChannel name remote", name, remote)
		
		if ref in ChannelsBase.channels:
			( name, alternatives ) = ChannelsBase.channels[ref]
			if remote not in alternatives:
				alternatives.append(remote)
				ChannelsBase.channels[ref] = ( name, alternatives )
		else:
			ChannelsBase.channels[ref] = ( name, [remote] )
		ChannelsBase.channels_changed = True
示例#54
0
def movielist_rename(session, service, services=None, *args, **kwargs):
	if config.plugins.seriesplugin.enabled.value:
		try:
			if services:
				if not isinstance(services, list):
					services = [services]	
			else:
				services = [service]
			SeriesPluginRenamer(session, services)
		except Exception as e:
			logDebug(_("SeriesPlugin renamer exception ") + str(e))
def lookupChannelByReference(ref):
    if ref in ChannelsBase.channels:
        (name, alternatives) = ChannelsBase.channels[ref]
        altnames = []
        for altname in alternatives:
            if altname:
                logDebug("lookupChannelByReference", ref, altname)
                altnames.append(altname)
        return altnames

    return False
    def addChannel(self, ref, name, remote):
        logDebug("SP addChannel name remote", name, remote)

        if ref in ChannelsBase.channels:
            (name, alternatives) = ChannelsBase.channels[ref]
            if remote not in alternatives:
                alternatives.append(remote)
                ChannelsBase.channels[ref] = (name, alternatives)
        else:
            ChannelsBase.channels[ref] = (name, [remote])
        ChannelsBase.channels_changed = True
def resetInstance():
	if config.plugins.seriesplugin.lookup_counter.isChanged():
		config.plugins.seriesplugin.lookup_counter.save()
	
	global instance
	if instance is not None:
		logDebug(" SERIESPLUGIN INSTANCE STOP")
		instance.stop()
		instance = None
	
	from Cacher import clearCache
	clearCache()