当前位置: 首页>>代码示例>>Python>>正文


Python RecordTimer.RecordTimerEntry类代码示例

本文整理汇总了Python中RecordTimer.RecordTimerEntry的典型用法代码示例。如果您正苦于以下问题:Python RecordTimerEntry类的具体用法?Python RecordTimerEntry怎么用?Python RecordTimerEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了RecordTimerEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: KeyOk

	def KeyOk(self):
		sel = self["list"].getCurrent()[0]
		if (sel == "searchEPGe2"):
			if self.epgserchplugin:
				self.epgserchplugin(session=self.session, servicelist=self)
		elif (sel == "searchEPG"):
			if config.dbp.usevkeyboard.value:
				self.session.openWithCallback(self.beginSearch, VirtualKeyBoard, title = _("Enter event to search:"), text = "")
			else:
				self.session.openWithCallback(self.beginSearch,InputBox, title = _("Enter event to search:"), windowTitle = _("Search in EPG cache"), text="")
		elif (sel == "searchEPGLast"):
			self.session.open(NEpgSearchLast)
		elif (sel == "downloadEPG"):
			if self.checkDevice():
				self.ref = self.session.nav.getCurrentlyPlayingServiceReference()
				if config.nemepg.downskyit.value:
					self.downloadItEPG()
				elif config.nemepg.downskyuk.value:
					self.downloadUkEPG()
		elif (sel == "e2LoaderEpg") or (sel == "e2LoaderEpgI"):
			self.downIMode = { 'e2LoaderEpg':False, 'e2LoaderEpgI':True }[sel]
			msg = _('Do you want download EPG\nusing e2_loadepg?')
			self.epgDBox = self.session.openWithCallback(self.downEPG,MessageBox, msg, MessageBox.TYPE_YESNO)
			self.epgDBox.setTitle(_("Download EPG"))
		elif (sel == "reloadEPG"):
			if self.e2Loader:
				searchPaths = ['/tmp/%s','/media/usb/%s','/media/cf/%s','/media/hdd/%s']
				for path in searchPaths:
					epgFile = (path % 'ext.epg.dat')
					if fileExists(epgFile):
						system("mv " +  epgFile + " " + config.nemepg.path.value + "/epg.dat")
			msg = _('Load EPG data in Enigma cache from:\n%s/epg.dat.\nPlease Wait...') % config.nemepg.path.value
			self.epgRBox = self.session.open(MessageBox, msg, MessageBox.TYPE_INFO)
			self.epgRBox.setTitle(_("Loading EPG"))
			self.reloadEPGTimer.start(500, False)
		elif (sel == "eraseEPG"):
			msg = _('Erasing EPG Chache.\nPlease Wait...')
			self.epgCBox = self.session.open(MessageBox, msg, MessageBox.TYPE_INFO)
			self.epgCBox.setTitle(_("Erasing EPG cache"))
			self.clearEPGTimer.start(500, False)
		elif (sel == "backupEPG"):
			msg = _('Backup Enigma EPG data on:\n%s.\nPlease Wait...') % config.nemepg.path.value
			self.epgBBox = self.session.open(MessageBox, msg, MessageBox.TYPE_INFO)
			self.epgBBox.setTitle(_("Backing-up EPG"))
			self.saveEPGTimer.start(500, False)
		elif (sel == "createTIMER"):
			serviceref = ServiceReference(getSid(config.nemepg.skyitch.value))
			begin = 1239332400
			end = 1239333600
			name = "Download EPG Daily"
			description = "Please do not remove this entry!"
			timer = RecordTimerEntry(serviceref, begin, end, name, description, 66, False, 2, 1)
			timer.repeated = 127
			self.session.openWithCallback(self.finishedAdd, TimerEntry, timer)
		elif (sel == "openTIMER"):
			self.session.open(TimerEditList)
		elif (sel == "epglog"):
			self.session.open(dbpShowPanel, '/usr/log/crossepg.log' ,_('EPG Timer log')) 
		elif (sel == "configEPG"):
			self.session.openWithCallback(self.saveConfig, NSetup, "epg")
开发者ID:kakunbsc,项目名称:enigma2.4,代码行数:60,代码来源:dbpEpgPanel.py

示例2: __init__

 def __init__(
     self,
     session,
     serviceref,
     begin,
     end,
     name,
     description,
     eit,
     disabled=False,
     justplay=False,
     afterEvent=AFTEREVENT.AUTO,
     checkOldTimers=False,
     dirname=None,
     tags=None,
 ):
     self.session = session
     RecordTimerEntry.__init__(
         self,
         serviceref,
         begin,
         end,
         name,
         description,
         eit,
         disabled=False,
         justplay=False,
         afterEvent=AFTEREVENT.AUTO,
         checkOldTimers=False,
         dirname=None,
         tags=None,
     )
开发者ID:Lishoo,项目名称:enigma2-plugins-sh4,代码行数:32,代码来源:HelperFunctions.py

示例3: addTimer

def addTimer(
    session,
    serviceref,
    begin,
    end,
    name,
    description,
    disabled,
    justplay,
    afterevent,
    dirname,
    tags,
    repeated,
    logentries=None,
    eit=0,
):
    serviceref = unquote(serviceref)
    rt = session.nav.RecordTimer

    print "mao1", dirname

    if not dirname:
        dirname = preferredTimerPath()

    print "mao2", dirname

    try:
        timer = RecordTimerEntry(
            ServiceReference(serviceref),
            begin,
            end,
            name,
            description,
            eit,
            disabled,
            justplay,
            afterevent,
            dirname=dirname,
            tags=tags,
        )

        timer.repeated = repeated

        if logentries:
            timer.log_entries = logentries

        conflicts = rt.record(timer)
        if conflicts:
            errors = []
            for conflict in conflicts:
                errors.append(conflict.name)

            return {"result": False, "message": "Conflicting Timer(s) detected! %s" % " / ".join(errors)}
    except Exception, e:
        print e
        return {"result": False, "message": "Could not add timer '%s'!" % name}
开发者ID:rodrigopill,项目名称:e2openplugin-OpenWebif,代码行数:56,代码来源:timers.py

示例4: recordNow

def recordNow(session, infinite):
	rt = session.nav.RecordTimer
	serviceref = session.nav.getCurrentlyPlayingServiceReference().toString()

	try:
		event = session.nav.getCurrentService().info().getEvent(0)
	except Exception:
		event = None
		
	if not event and not infinite:
		return {
			"result": False,
			"message": "No event found! Not recording!"
		}
		
	if event:
		(begin, end, name, description, eit) = parseEvent(event)
		begin = time()
		msg = "Instant record for current Event started"
	else:
		name = "instant record"
		description = ""
		eit = 0
		
	if infinite:
		begin = time()
		end = begin + 3600 * 10
		msg = "Infinite Instant recording started"
		
	timer = RecordTimerEntry(
		ServiceReference(serviceref),
		begin,
		end,
		name,
		description, 
		eit,
		False,
		False,
		0,
		dirname=preferredInstantRecordPath()
	)
	timer.dontSave = True
	
	if rt.record(timer):
		return {
			"result": False,
			"message": "Timer conflict detected! Not recording!"
		}
		
	return {
		"result": True,
		"message": msg
	}
	
开发者ID:betz,项目名称:e2openplugin-OpenWebif,代码行数:53,代码来源:timers.py

示例5: recordNow

	def recordNow(self, param):
		if not config.misc.recording_allowed.value:
			return (False, _("Recording is currently disabled!"))

		limitEvent = True
		if param == "undefinitely" or param == "infinite":
			ret = (True, "Infinite Instant recording started")
			limitEvent = False
		else:
			ret = ( True, "Instant record for current Event started" )

		serviceref = ServiceReference(self.session.nav.getCurrentlyPlayingServiceReference().toString())

		event = None

		try:
			service = self.session.nav.getCurrentService()
			event = service.info().getEvent(0)
		except Exception:
			print "[Webcomponents.Timer] recordNow Exception!"

		begin = time()
		end = begin + 3600 * 10
		name = "instant record"
		description = ""
		eventid = 0

		if event is not None:
			curEvent = parseEvent(event)
			name = curEvent[2]
			description = curEvent[3]
			eventid = curEvent[4]
			if limitEvent:
				end = curEvent[1]
		else:
			if limitEvent:
				ret = ( False, "No event found! Not recording!" )

		if ret[0]:
			location = preferredInstantRecordPath()
			timer = RecordTimerEntry(serviceref, begin, end, name, description, eventid, False, False, 0, dirname=location)
			timer.dontSave = True
			recRet = self.recordtimer.record(timer)
			if recRet is not None:
				# a conflict is rather unlikely, but this can also indicate a non-recordable service
				ret = (False, "Timer conflict detected! Not recording!" )

		return ret
开发者ID:OpenDMM,项目名称:enigma2-plugins,代码行数:48,代码来源:Timer.py

示例6: program_seek_vps_multiple_closed

	def program_seek_vps_multiple_closed(self, retval):
		self.program_seek_vps_multiple_started = -1
		
		self.found_vps_multiple = sorted(self.found_vps_multiple)
		
		for evt_begin, evt_id, evt in self.found_vps_multiple:
			# eigenen Timer überprüfen, wenn Zeiten nicht überschrieben werden dürfen
			if not self.timer.vpsplugin_overwrite and evt_begin <= self.timer.end:
				self.next_events.append(evt_id)
				self.timer.log(0, "[VPS] add event_id "+ str(evt_id))
			
			else:
				canbeadded = True
				evt_begin += 60
				evt_end = evt.getBeginTime() + evt.getDuration() - 60
				now = time()
				
				for checktimer in self.session.nav.RecordTimer.timer_list:
					if checktimer == self.timer:
						continue
					if (checktimer.begin - now) > 3600*24:
						break
					if checktimer.service_ref.ref.toCompareString() == self.timer.service_ref.ref.toCompareString() or checktimer.service_ref.ref.toCompareString() == self.rec_ref.toCompareString():	
						if checktimer.begin <= evt_begin and checktimer.end >= evt_end:
							if not checktimer.vpsplugin_enabled or not checktimer.vpsplugin_overwrite:
								canbeadded = False
							
							# manuell angelegter Timer mit VPS
							if checktimer.vpsplugin_enabled and checktimer.name == "" and checktimer.vpsplugin_time is not None:
								checktimer.eit = evt_id
								checktimer.name = evt.getEventName()
								checktimer.description = evt.getShortDescription()
								checktimer.vpsplugin_time = None
								checktimer.log(0, "[VPS] changed timer (found same PDC-Time as in other VPS-recording)")
								canbeadded = False
								break

				
				if canbeadded:
					newevent_data = parseEvent(evt)
					newEntry = RecordTimerEntry(ServiceReference(self.rec_ref), *newevent_data)
					newEntry.vpsplugin_enabled = True
					newEntry.vpsplugin_overwrite = True
					newEntry.log(0, "[VPS] added this timer (found same PDC-Time as in other VPS-recording)")
					
					# Wenn kein Timer-Konflikt auftritt, wird der Timer angelegt.
					NavigationInstance.instance.RecordTimer.record(newEntry)
开发者ID:BAZANT,项目名称:enigma2-plugins-sh4,代码行数:47,代码来源:Vps.py

示例7: copyTimer

	def copyTimer(self, start, duration):
		starttime = start - config.recording.margin_before.value * 60
		endtime = start + duration + config.recording.margin_after.value * 60
		self.new_timer_copy = RecordTimerEntry(ServiceReference(self.rec_ref), starttime, endtime, self.timer.name, self.timer.description, self.timer.eit, False, False, AFTEREVENT.AUTO, False, self.timer.dirname, self.timer.tags)
		self.new_timer_copy.vpsplugin_enabled = True
		self.new_timer_copy.vpsplugin_overwrite = self.timer.vpsplugin_overwrite
		self.new_timer_copy.log(0, "[VPS] added this timer")
		NavigationInstance.instance.RecordTimer.record(self.new_timer_copy)
开发者ID:Haehnchen,项目名称:enigma2-plugins,代码行数:8,代码来源:Vps.py

示例8: recordNow

    def recordNow(self, param):
        limitEvent = True
        if param == "undefinitely" or param == "infinite":
            ret = (True, "Infinite Instant recording started")
            limitEvent = False
        else:
            ret = (True, "Instant record for current Event started")

        serviceref = ServiceReference(self.session.nav.getCurrentlyPlayingServiceReference().toString())

        event = None

        try:
            service = self.session.nav.getCurrentService()
            event = service.info().getEvent(0)
        except Exception:
            print "[Webcomponents.Timer] recordNow Exception!"

        begin = time()
        end = begin + 3600 * 10
        name = "instant record"
        description = ""
        eventid = 0

        if event is not None:
            curEvent = parseEvent(event)
            name = curEvent[2]
            description = curEvent[3]
            eventid = curEvent[4]
            if limitEvent:
                end = curEvent[1]
        else:
            if limitEvent:
                ret = (False, "No event found! Not recording!")

        if ret[0]:
            location = config.movielist.last_videodir.value
            timer = RecordTimerEntry(
                serviceref, begin, end, name, description, eventid, False, False, 0, dirname=location
            )
            timer.dontSave = True
            self.recordtimer.record(timer)

        return ret
开发者ID:backtrack2016,项目名称:tdt,代码行数:44,代码来源:Timer.py

示例9: addTimer

def addTimer(session, serviceref, begin, end, name, description, disabled, justplay, afterevent, dirname, tags, repeated, vpsinfo=None, logentries=None, eit=0, always_zap=-1):
	serviceref = unquote(serviceref)
	rt = session.nav.RecordTimer

	print "mao1", dirname

	if not dirname:
		dirname = preferredTimerPath()

	print "mao2", dirname

	try:
		timer = RecordTimerEntry(
			ServiceReference(serviceref),
			begin,
			end,
			name,
			description,
			eit,
			disabled,
			justplay,
			afterevent,
			dirname=dirname,
			tags=tags)

		timer.repeated = repeated

		if logentries:
			timer.log_entries = logentries

		conflicts = rt.record(timer)
		if conflicts:
			errors = []
			for conflict in conflicts:
				errors.append(conflict.name)

			return {
				"result": False,
				"message": _("Conflicting Timer(s) detected! %s") % " / ".join(errors)
			}
		#VPS
		if vpsinfo is not None:
			timer.vpsplugin_enabled = vpsinfo["vpsplugin_enabled"]
			timer.vpsplugin_overwrite = vpsinfo["vpsplugin_overwrite"]
			timer.vpsplugin_time = vpsinfo["vpsplugin_time"]

		if always_zap <> -1:
			if hasattr(timer,"always_zap"):
				timer.always_zap = always_zap == 1

	except Exception, e:
		print e
		return {
			"result": False,
			"message": _("Could not add timer '%s'!") % name
		}
开发者ID:Leatherface75,项目名称:enigma2pc,代码行数:56,代码来源:timers.py

示例10: getTimers

	def getTimers(self):
		self._timer_list = []
		self._processed_timers = []

		baseurl = self.getBaseUrl()

		print "[GBIpboxRemoteTimer] get remote timer list"

		try:
			httprequest = urllib2.urlopen(baseurl + '/web/timerlist')
			xmldoc = minidom.parseString(httprequest.read())
			timers = xmldoc.getElementsByTagName('e2timer') 
			for timer in timers:
				serviceref = ServiceReference(getValueFromNode(timer, 'e2servicereference'))
				begin = int(getValueFromNode(timer, 'e2timebegin'))
				end = int(getValueFromNode(timer, 'e2timeend'))
				name = getValueFromNode(timer, 'e2name')
				description = getValueFromNode(timer, 'e2description')
				eit = int(getValueFromNode(timer, 'e2eit'))
				disabled = int(getValueFromNode(timer, 'e2disabled'))
				justplay = int(getValueFromNode(timer, 'e2justplay'))
				afterevent = int(getValueFromNode(timer, 'e2afterevent'))
				repeated = int(getValueFromNode(timer, 'e2repeated'))
				location = getValueFromNode(timer, 'e2location')
				tags = getValueFromNode(timer, 'e2tags').split(" ")

				entry = RecordTimerEntry(serviceref, begin, end, name, description, eit, disabled, justplay, afterevent, dirname = location, tags = tags, descramble = 1, record_ecm = 0, isAutoTimer = 0, always_zap = 0)
				entry.repeated = repeated

				entry.orig = RecordTimerEntry(serviceref, begin, end, name, description, eit, disabled, justplay, afterevent, dirname = location, tags = tags, descramble = 1, record_ecm = 0, isAutoTimer = 0, always_zap = 0)
				entry.orig.repeated = repeated

				if entry.shouldSkip() or entry.state == TimerEntry.StateEnded or (entry.state == TimerEntry.StateWaiting and entry.disabled):
					insort(self._processed_timers, entry)
				else:
					insort(self._timer_list, entry)
		except Exception, e:
			print "[GBIpboxRemoteTimer]", e
开发者ID:sunder67,项目名称:gbremote-client,代码行数:38,代码来源:GBIpboxRemoteTimer.py

示例11: UPDT

	def UPDT(self, args):
		# <id> <settings>
		args = args.split(None, 1)
		if len(args) != 2:
			payload = "%d argument error" % (CODE_SYNTAX,)
			return self.sendLine(payload)

		try:
			timerId = int(args[0])
		except ValueError:
			payload = "%d argument error" % (CODE_SYNTAX,)
			return self.sendLine(payload)

		list = self.getTimerList()

		if timerId < 1:
			payload = "%d argument error" % (CODE_SYNTAX,)
			return self.sendLine(payload)

		if len(list) >= timerId: oldTimer = list[timerId - 1]
		else: oldTimer = None

		try:
			flags, channelid, datestring, beginstring, endstring, priority, lifetime, name, description = args[1].split(':')
			flags = int(flags)
			service_ref = ServiceReference(self.channelList[int(channelid)-1])
			datestruct = strptime(datestring, '%Y-%m-%d')
			timestruct = strptime(beginstring, '%H%M')
			begin = mktime((datestruct.tm_year, datestruct.tm_mon, datestruct.tm_mday, timestruct.tm_hour, timestruct.tm_min, 0, datestruct.tm_wday, datestruct.tm_yday, -1))
			timestruct = strptime(endstring, '%H%M')
			end = mktime((datestruct.tm_year, datestruct.tm_mon, datestruct.tm_mday, timestruct.tm_hour, timestruct.tm_min, 0, datestruct.tm_wday, datestruct.tm_yday, -1))
			del datestruct, timestruct
		except ValueError as e:
			payload = "%d argument error" % (CODE_SYNTAX,)
			return self.sendLine(payload)
		except KeyError as e:
			payload = "%d argument error" % (CODE_SYNTAX,)
			return self.sendLine(payload)

		if end < begin: end += 86400 # Add 1 day, beware - this is evil and might not work correctly due to dst
		timer = RecordTimerEntry(service_ref, begin, end, name, description, 0, disabled=flags & 1 == 0)
		if oldTimer:
			recordTimer.removeEntry(oldTimer)
			timer.justplay = oldTimer.justplay
			timer.afterEvent = oldTimer.afterEvent
			timer.dirname = oldTimer.dirname
			timer.tags = oldTimer.tags
			timer.log_entries = oldTimer.log_entries

		conflict = recordTimer.record(timer)
		if conflict is None:
			return self.sendTimerLine(timer, timerId, last=True)
		else:
			payload = "%d timer conflict detected, original timer lost." % (CODE_ERR_LOCAL,)
			return self.sendLine(payload)
开发者ID:Blacksens,项目名称:enigma2-plugins,代码行数:55,代码来源:SVDRP.py

示例12: parseTimer


#.........这里部分代码省略.........
				# Abort if we don't want to modify timers or timer is repeated
				if config.plugins.autotimer.refresh.value == "none" or newEntry.repeated:
					doLog("Won't modify existing timer because either no modification allowed or repeated timer")
					continue

				if hasattr(newEntry, "isAutoTimer"):
					msg = "[AutoTimer] AutoTimer %s modified this automatically generated timer." % (timer.name)
					doLog(msg)
					newEntry.log(501, msg)
				elif config.plugins.autotimer.add_autotimer_to_tags.value and TAG in newEntry.tags:
					msg = "[AutoTimer] AutoTimer %s modified this automatically generated timer." % (timer.name)
					doLog(msg)
					newEntry.log(501, msg)
				else:
					if config.plugins.autotimer.refresh.value != "all":
						doLog("Won't modify existing timer because it's no timer set by us")
						continue

					msg = "[AutoTimer] Warning, AutoTimer %s messed with a timer which might not belong to it: %s ." % (timer.name, newEntry.name)
					doLog(msg)
					newEntry.log(501, msg)

				modified += 1

				if allow_modify:
					self.modifyTimer(newEntry, name, shortdesc, begin, end, serviceref, eit)
					msg = "[AutoTimer] AutoTimer modified timer: %s ." % (newEntry.name)
					doLog(msg)
					newEntry.log(501, msg)
				else:
					msg = "[AutoTimer] AutoTimer modification not allowed for timer: %s ." % (newEntry.name)
					doLog(msg)
			else:
				newEntry = RecordTimerEntry(ServiceReference(serviceref), begin, end, name, shortdesc, eit)
				msg = "[AutoTimer] Try to add new timer based on AutoTimer %s." % (timer.name)
				doLog(msg)
				newEntry.log(500, msg)
				
				# Mark this entry as AutoTimer (only AutoTimers will have this Attribute set)
				# It is only temporarily, after a restart it will be lost,
				# because it won't be stored in the timer xml file
				newEntry.isAutoTimer = True

			# Apply afterEvent
			if timer.hasAfterEvent():
				afterEvent = timer.getAfterEventTimespan(localtime(end))
				if afterEvent is None:
					afterEvent = timer.getAfterEvent()
				if afterEvent is not None:
					newEntry.afterEvent = afterEvent

			newEntry.dirname = dest
			newEntry.calculateFilename()

			newEntry.justplay = timer.justplay
			newEntry.vpsplugin_enabled = timer.vps_enabled
			newEntry.vpsplugin_overwrite = timer.vps_overwrite
			tags = timer.tags[:]
			if config.plugins.autotimer.add_autotimer_to_tags.value:
				if TAG not in tags:
					tags.append(TAG)
			if config.plugins.autotimer.add_name_to_tags.value:
				tagname = timer.name.strip()
				if tagname:
					tagname = tagname[0].upper() + tagname[1:].replace(" ", "_")
					if tagname not in tags:
开发者ID:dogfight76,项目名称:enigma2-plugins,代码行数:67,代码来源:AutoTimer.py

示例13: parseTimer


#.........这里部分代码省略.........
						skipped += 1
						break
				elif timer.avoidDuplicateDescription >= 1 and not rtimer.disabled:
					if self.checkSimilarity(timer, name, rtimer.name, shortdesc, rtimer.description, extdesc, rtimer.extdesc ):
						print("[AutoTimer] We found a timer with similar description, skipping event")
						oldExists = True
						break

			# We found no timer we want to edit
			if newEntry is None:
				# But there is a match
				if oldExists:
					continue

				# We want to search for possible doubles
				for rtimer in chain.from_iterable( itervalues(timerdict) ):
					if not rtimer.disabled:
						if self.checkDoubleTimers(timer, name, rtimer.name, begin, rtimer.begin, end, rtimer.end ):
							oldExists = True
							# print("[AutoTimer] We found a timer with same StartTime, skipping event")
							break
						if timer.avoidDuplicateDescription >= 2:
							if self.checkSimilarity(timer, name, rtimer.name, shortdesc, rtimer.description, extdesc, rtimer.extdesc ):
								oldExists = True
								print("[AutoTimer] We found a timer (any service) with same description, skipping event")
								break
				if oldExists:
					continue

				if timer.checkCounter(timestamp):
					print("[AutoTimer] Not adding new timer because counter is depleted.")
					continue

				newEntry = RecordTimerEntry(ServiceReference(serviceref), begin, end, name, shortdesc, eit)
				newEntry.log(500, "[AutoTimer] Try to add new timer based on AutoTimer %s." % (timer.name))

				# Mark this entry as AutoTimer (only AutoTimers will have this Attribute set)
				# It is only temporarily, after a restart it will be lost,
				# because it won't be stored in the timer xml file
				newEntry.isAutoTimer = True

			# Apply afterEvent
			if timer.hasAfterEvent():
				afterEvent = timer.getAfterEventTimespan(localtime(end))
				if afterEvent is None:
					afterEvent = timer.getAfterEvent()
				if afterEvent is not None:
					newEntry.afterEvent = afterEvent

			newEntry.dirname = timer.destination
			newEntry.justplay = timer.justplay
			newEntry.vpsplugin_enabled = timer.vps_enabled
			newEntry.vpsplugin_overwrite = timer.vps_overwrite
			tags = timer.tags[:]
			if config.plugins.autotimer.add_autotimer_to_tags.value:
				tags.append('AutoTimer')
			if config.plugins.autotimer.add_name_to_tags.value:
				tagname = timer.name.strip()
				if tagname:
					tagname = tagname[0].upper() + tagname[1:].replace(" ", "_")
					tags.append(tagname)
			newEntry.tags = tags

			if oldExists:
				# XXX: this won't perform a sanity check, but do we actually want to do so?
				recordHandler.timeChanged(newEntry)
开发者ID:Linux-Box,项目名称:enigma2-plugins,代码行数:67,代码来源:AutoTimer.py

示例14: parseEPG


#.........这里部分代码省略.........
				# Initialize
				newEntry = None
				oldExists = False

				# Check for double Timers
				# We first check eit and if user wants us to guess event based on time
				# we try this as backup. The allowed diff should be configurable though.
				for rtimer in recorddict.get(serviceref, ()):
					if rtimer.eit == eit or config.plugins.autotimer.try_guessing.value and getTimeDiff(rtimer, begin, end) > ((duration/10)*8):
						oldExists = True

						# Abort if we don't want to modify timers or timer is repeated
						if config.plugins.autotimer.refresh.value == "none":
							print "[AutoTimer] Won't modify existing timer because no modification allowed"
							break
						if rtimer.repeated:
							print "[AutoTimer] Won't modify existing timer because repeated timer"
							break

						if hasattr(rtimer, "isAutoTimer"):
								rtimer.log(501, "[AutoTimer] AutoTimer %s modified this automatically generated timer." % (timer.name,))
						else:
							if config.plugins.autotimer.refresh.value != "all":
								print "[AutoTimer] Won't modify existing timer because it's no timer set by us"
								break

							rtimer.log(501, "[AutoTimer] Warning, AutoTimer %s messed with a timer which might not belong to it." % (timer.name,))

						newEntry = rtimer
						modified += 1

						# Modify values saved in timer
						newEntry.name = evtInfo.name
						newEntry.description = evtInfo.shortDescription
						newEntry.begin = int(begin)
						newEntry.end = int(end)
						newEntry.service_ref = ServiceReference(serviceref)

						break
					elif timer.avoidDuplicateDescription >= 1 and self.normalizeRecordTimer(rtimer) == evtInfo:
						oldExists = True
						print "[AutoTimer] We found a timer with same service and description, skipping event"
						break

				# We found no timer we want to edit
				if newEntry is None:
					# But there is a match
					if oldExists:
						continue

					# We want to search for possible doubles
					if timer.avoidDuplicateDescription >= 2 and self.isEventInList(evtInfo, recorddict, self.normalizeRecordTimer):
						print "[AutoTimer] We found a timer with same description, skipping event"
						continue

					if timer.checkCounter(timestamp):
						print "[AutoTimer] Not adding new timer because counter is depleted."
						continue

					newEntry = RecordTimerEntry(ServiceReference(serviceref), begin, end, evtInfo.name, evtInfo.shortDescription, eit)
					newEntry.log(500, "[AutoTimer] Adding new timer based on AutoTimer %s." % (timer.name,))

					# Mark this entry as AutoTimer (only AutoTimers will have this Attribute set)
					newEntry.isAutoTimer = True

				# Apply afterEvent
				if timer.hasAfterEvent():
					afterEvent = timer.getAfterEventTimespan(localtime(end))
					if afterEvent is None:
						afterEvent = timer.getAfterEvent()
					if afterEvent is not None:
						newEntry.afterEvent = afterEvent

				newEntry.dirname = timer.destination
				newEntry.justplay = timer.justplay
				newEntry.tags = timer.tags
				newEntry.vpsplugin_enabled = timer.vps_enabled
				newEntry.vpsplugin_overwrite = timer.vps_overwrite

				if oldExists:
					# XXX: this won't perform a sanity check, but do we actually want to do so?
					NavigationInstance.instance.RecordTimer.timeChanged(newEntry)
				else:
					conflicts = NavigationInstance.instance.RecordTimer.record(newEntry)
					if conflicts and config.plugins.autotimer.disabled_on_conflict.value:
						conflictString = ' / '.join(["%s (%s)" % (x.name, strftime("%Y%m%d %H%M", localtime(x.begin))) for x in conflicts])
						newEntry.log(503, "[AutoTimer] Timer disabled because of conflicts with %s." % (conflictString,))
						del conflictString
						newEntry.disabled = True
						# We might want to do the sanity check locally so we don't run it twice - but I consider this workaround a hack anyway
						conflicts = NavigationInstance.instance.RecordTimer.record(newEntry)
						conflicting.append((evtInfo.name, begin, end, serviceref, timer.name))
					if conflicts is None:
						timer.decrementCounter()
						new += 1
						recorddict.setdefault(serviceref, []).append(newEntry)
					else:
						conflicting.append((evtInfo.name, begin, end, serviceref, timer.name))

		return (total, new, modified, timers, conflicting)
开发者ID:Johnny-Dopp,项目名称:enigma2-plugins,代码行数:101,代码来源:AutoTimer.py

示例15: editTimer


#.........这里部分代码省略.........
                disabled = True
            else:
                # TODO - maybe we can give the user some useful hint here
                pass

        justplay = False  # Default to: Record
        if "justplay" in param:
            if param["justplay"] == "1":
                justplay = True

        afterEvent = 3  # Default to Afterevent: Auto
        if "afterevent" in param:
            if (param["afterevent"] == "0") or (param["afterevent"] == "1") or (param["afterevent"] == "2"):
                afterEvent = int(param["afterevent"])

        dirname = config.movielist.last_timer_videodir.value
        if "dirname" in param and param["dirname"]:
            dirname = param["dirname"]

        tags = []
        if "tags" in param and param["tags"]:
            tags = unescape(param["tags"]).split(" ")

        delold = 0
        if "deleteOldOnSave" in param:
            delold = int(param["deleteOldOnSave"])

            # Try to edit an existing Timer
        if delold:
            if "channelOld" in param and param["channelOld"]:
                channelOld = ServiceReference(param["channelOld"])
            else:
                return (False, "Missing Parameter: channelOld")
                # We do need all of the following Parameters, too, for being able of finding the Timer.
                # Therefore so we can neither use default values in this part nor can we
                # continue if a parameter is missing
            if "beginOld" not in param:
                return (False, "Missing Parameter: beginOld")
            beginOld = int(param["beginOld"])

            if "endOld" not in param:
                return (False, "Missing Parameter: endOld")
            endOld = int(param["endOld"])

            # let's try to find the timer
            try:
                for timer in self.recordtimer.timer_list + self.recordtimer.processed_timers:
                    if str(timer.service_ref) == str(channelOld):
                        if int(timer.begin) == beginOld:
                            if int(timer.end) == endOld:
                                # we've found the timer we've been searching for
                                # Let's apply the new values
                                timer.service_ref = service_ref
                                timer.begin = int(begin)
                                timer.end = int(end)
                                timer.name = name
                                timer.description = description
                                timer.disabled = disabled
                                timer.justplay = justplay
                                timer.afterEvent = afterEvent
                                timer.repeated = repeated
                                timer.dirname = dirname
                                timer.tags = tags

                                # send the changed timer back to enigma2 and hope it's good
                                self.session.nav.RecordTimer.timeChanged(timer)
                                print "[WebComponents.Timer] editTimer: Timer changed!"
                                return (True, "Timer %s has been changed!" % (timer.name))
            except Exception:
                # obviously some value was not good, return an error
                return (False, "Changing the timer for '%s' failed!" % name)

            return (False, "Could not find timer '%s' with given start and end time!" % name)

            # Try adding a new Timer

        try:
            # Create a new instance of recordtimerentry
            timer = RecordTimerEntry(
                service_ref,
                begin,
                end,
                name,
                description,
                0,
                disabled,
                justplay,
                afterEvent,
                dirname=dirname,
                tags=tags,
            )
            timer.repeated = repeated
            # add the new timer
            self.recordtimer.record(timer)
            return (True, "Timer added successfully!")
        except Exception:
            # something went wrong, most possibly one of the given paramater-values was wrong
            return (False, "Could not add timer '%s'!" % name)

        return (False, "Unexpected Error")
开发者ID:backtrack2016,项目名称:tdt,代码行数:101,代码来源:Timer.py


注:本文中的RecordTimer.RecordTimerEntry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。