Esempio n. 1
0
    def startConvert(self):
        if not self.checkBeforeStartConvert():
            return

        self.currentPvr = self.pvrLists.pop(0)
        if self.currentPvr is None:
            return

        (_begin, sref, name, length, real_ref) = self.currentPvr

        m_path = sref.getPath()
        sref = eServiceReference(real_ref + m_path)

        begin = int(time.time())
        end = begin + 3600  # dummy
        #end = begin + int(length) + 2
        description = ""
        eventid = None

        if isinstance(sref, eServiceReference):
            sref = ServiceReference(sref)

        if m_path.endswith('.ts'):
            m_path = m_path[:-3]

        filename = m_path + "_pvrdesc"

        recording = RecordTimerEntry(sref,
                                     begin,
                                     end,
                                     name,
                                     description,
                                     eventid,
                                     dirname=preferredInstantRecordPath(),
                                     filename=filename)
        recording.dontSave = True
        recording.autoincrease = True
        recording.setAutoincreaseEnd()
        recording.pvrConvert = True  # do not handle evStart event

        nav = self.getNavigation()
        simulTimerList = nav.RecordTimer.record(recording)
        if simulTimerList is None:  # no conflict
            recordings = self.getRecordings()
            if len(recordings) == 1:
                self.converting = recording
                self.convertFilename = (sref.getPath(), filename + ".ts")
            else:
                print "[PVRDescrambleConvert] error, wrong recordings info."
        else:
            self.currentPvr = None
            self.startConvertTimer()

            if len(simulTimerList) > 1:  # with other recording
                print "[PVRDescrambleConvert] conflicts !"
            else:
                print "[PVRDescrambleConvert] Couldn't record due to invalid service %s" % sref
            recording.autoincrease = False

        print "[PVRDescrambleConvert] startConvert, self.converting : ", self.converting
Esempio n. 2
0
    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
Esempio n. 3
0
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!")
        }
    nt = {
        "serviceref": str(timer.service_ref),
        "servicename": removeBad(timer.service_ref.getServiceName()),
        "eit": timer.eit,
        "name": timer.name,
        "begin": timer.begin,
        "end": timer.end,
        "duration": timer.end - timer.begin
    }

    return {"result": True, "message": msg, "newtimer": nt}
Esempio n. 4
0
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
	}
	
Esempio n. 5
0
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
	}
Esempio n. 6
0
	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
Esempio n. 7
0
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!")
		}
	nt = {
		"serviceref": str(timer.service_ref),
		"servicename": timer.service_ref.getServiceName().replace('\xc2\x86', '').replace('\xc2\x87', ''),
		"eit": timer.eit,
		"name": timer.name,
		"begin": timer.begin,
		"end": timer.end,
		"duration": timer.end - timer.begin
	}

	return {
		"result": True,
		"message": msg,
		"newtimer": nt
	}