def zapService(session, id, title="", stream=False):
    if checkIsQPiP():
        return {
            "result": False,
            "message": "Can not zap service in quad PiP mode."
        }

    # Must NOT unquote id here, breaks zap to streams
    service = eServiceReference(id)

    if len(title) > 0:
        service.setName(title)
    else:
        title = id

    isRecording = service.getPath()
    isRecording = isRecording and isRecording.startswith("/")

    if not isRecording:
        if config.ParentalControl.servicepinactive.value and config.OpenWebif.parentalenabled.value:
            if getProtection(service.toString()) != "0":
                return {
                    "result":
                    False,
                    "message":
                    "Service '%s' is blocked by parental Control" % title
                }

    # use mediaplayer for recording
    if isRecording:
        if isinstance(session.current_dialog, InfoBar):
            session.open(MoviePlayer, service)
        else:
            session.nav.playService(service)
    else:
        if isinstance(session.current_dialog, MoviePlayer):
            session.current_dialog.lastservice = service
            session.current_dialog.close()
        from Screens.Standby import inStandby
        if inStandby is None:
            zapInServiceList(service)
        else:
            if stream:
                stop_text = ""
                if session.nav.getCurrentlyPlayingServiceReference(
                ) and isPlayableForCur(service):
                    session.nav.stopService()
                    stop_text = ": simple stop current service"
                return {
                    "result":
                    True,
                    "message":
                    "For stream don't need zap in standby %s" % stop_text
                }
            else:
                session.nav.playService(service)

    return {"result": True, "message": "Active service is now '%s'" % title}
def zapService(session, id, title="", stream=False):
	if checkIsQPiP():
		return {
			"result": False,
			"message": "Can not zap service in quad PiP mode."
		}

	# Must NOT unquote id here, breaks zap to streams
	service = eServiceReference(id)

	if len(title) > 0:
		service.setName(title)
	else:
		title = id

	isRecording = service.getPath()
	isRecording = isRecording and isRecording.startswith("/")

	if not isRecording:
		if config.ParentalControl.servicepinactive.value and config.OpenWebif.parentalenabled.value:
			if getProtection(service.toString()) != "0":
				return {
					"result": False,
					"message": "Service '%s' is blocked by parental Control" % title
				}

	# use mediaplayer for recording
	if isRecording:
		if isinstance(session.current_dialog, InfoBar):
			session.open(MoviePlayer, service)
		else:
			session.nav.playService(service)
	else:
		if isinstance(session.current_dialog, MoviePlayer):
			session.current_dialog.lastservice = service
			session.current_dialog.close()
		from Screens.Standby import inStandby
		if inStandby is None:
			zapInServiceList(service)
		else:
			if stream:
				stop_text = ""
				if session.nav.getCurrentlyPlayingServiceReference() and isPlayableForCur(service):
					session.nav.stopService()
					stop_text = ": simple stop current service"
				return {
					"result": True,
					"message": "For stream don't need zap in standby %s" % stop_text
				}
			else:
				session.nav.playService(service)

	return {
		"result": True,
		"message": "Active service is now '%s'" % title
	}
def zapService(session, id, title = ""):
	# Must NOT unquote id here, breaks zap to streams
	service = eServiceReference(id)
	
	if len(title) > 0:
		service.setName(title)
	else:
		title = id

	# TODO: check standby

	isRecording = service.getPath()
	isRecording = isRecording and isRecording.startswith("/")
	
	if not isRecording:
		if config.ParentalControl.configured.value and config.OpenWebif.parentalenabled.value:
			if getProtection(service.toString()) == "0":
				return {
					"result": False,
					"message": "Service '%s' is blocked by parental Control" % title
				}

	# use mediaplayer for recording
	if isRecording:
		if isinstance(session.current_dialog, InfoBar):
			session.open(MoviePlayer, service)
		else:
			session.nav.playService(service)
	else:
		if isinstance(session.current_dialog, MoviePlayer):
			session.current_dialog.lastservice = service
			session.current_dialog.close()
		session.nav.playService(service)

	
	return {
		"result": True,
		"message": "Active service is now '%s'" % title
	}
Exemple #4
0
def zapService(session, id, title=""):
    # Must NOT unquote id here, breaks zap to streams
    service = eServiceReference(id)

    if len(title) > 0:
        service.setName(title)
    else:
        title = id

    # TODO: check standby

    isRecording = service.getPath()
    isRecording = isRecording and isRecording.startswith("/")

    if not isRecording:
        if config.ParentalControl.servicepinactive.value and config.ModernWebif.parentalenabled.value:
            if getProtection(service.toString()) != "0":
                return {
                    "result":
                    False,
                    "message":
                    "Service '%s' is blocked by parental Control" % title
                }

    # use mediaplayer for recording
    if isRecording:
        if isinstance(session.current_dialog, InfoBar):
            session.open(MoviePlayer, service)
        else:
            session.nav.playService(service)
    else:
        if isinstance(session.current_dialog, MoviePlayer):
            session.current_dialog.lastservice = service
            session.current_dialog.close()
        zapInServiceList(service)

    return {"result": True, "message": "Active service is now '%s'" % title}
def zapService(session, id, title = ""):
	# Must NOT unquote id here, breaks zap to streams
	service = eServiceReference(id)
	
	if len(title) > 0:
		service.setName(title)
	else:
		title = id
	
	if config.ParentalControl.configured.value and config.OpenWebif.parentalenabled.value:
		if getProtection(service.toString()) == "0":
			session.nav.playService(service)
		else:
			return {
				"result": False,
				"message": "Service '%s' is blocked by parental Control" % title
			}
	else:
		session.nav.playService(service)
	
	return {
		"result": True,
		"message": "Active service is now '%s'" % title
	}