示例#1
0
文件: adapter.py 项目: burnnat/hdhr
    def device_create_from_str(device_str):
        """Create a device-object to manipulate a specific device with."""

        _LOGGER.debug("Creating device-entity for device [%s]." % (device_str))

        try:
            device = CFUNC_hdhomerun_device_create_from_str(
                ascii_bytes(device_str), None)
        except:
            _LOGGER.exception("Library call to create device entity failed.")
            raise

        if not device:
            message = "Could not build device entity."

            _LOGGER.exception(message)
            raise Exception(message)

        return device.contents
示例#2
0
文件: adapter.py 项目: burnnat/hdhr
    def set_tuner_target(self, target_uri=None):
        """Start sending video to the given URI."""

        if target_uri is None:
            target_uri = 'none'

        _LOGGER.debug("Setting target to [%s]." % (target_uri))

        try:
            result = CFUNC_hdhomerun_device_set_tuner_target(
                self.hd, ascii_bytes(target_uri))
        except:
            _LOGGER.exception("There was an exception while setting the tuner "
                              "target.")
            raise

        if result != 1:
            message = ("Could not set tuner target to [%s]." % (target))

            _LOGGER.error(message)
            raise error_for_result(result, message)
示例#3
0
文件: adapter.py 项目: burnnat/hdhr
    def set_tuner_vchannel(self, vchannel):
        """Set the current vchannel (familiar channel numbering)."""

        vchannel = str(vchannel)

        _LOGGER.debug(
            "Doing device_set_tuner_vchannel call for device [%s] with"
            " vchannel [%s]." % (self.hd, vchannel))

        try:
            result = CFUNC_hdhomerun_device_set_tuner_vchannel(
                self.hd, ascii_bytes(vchannel))
        except:
            _LOGGER.exception("Could not set vchannel.")
            raise

        if result != 1:
            message = "Failed to set vchannel."

            _LOGGER.error(message)
            raise error_for_result(result, message)