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


Python Configuration.write_media方法代码示例

本文整理汇总了Python中configuration.Configuration.write_media方法的典型用法代码示例。如果您正苦于以下问题:Python Configuration.write_media方法的具体用法?Python Configuration.write_media怎么用?Python Configuration.write_media使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在configuration.Configuration的用法示例。


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

示例1: __init__

# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import write_media [as 别名]

#.........这里部分代码省略.........
        media = self._get_media(media_name=media_name)
        if not media:
            return False
        if media.is_media_video():
            log.print_function(logger.error, "Cannot start record to a media media %s." % media_name)
            return False
        return media.start_record(path=path)

    def stop_record(self, media_name):
        media = self._get_media(media_name=media_name)
        if not media:
            return False
        if media.is_media_video():
            log.print_function(logger.error, "Cannot stop record to a media media %s." % media_name)
            return False
        return media.stop_record()

    def get_params_media(self, media_name):
        media = self._get_media(media_name=media_name)
        if not media:
            return []
        return media.get_properties_param()

    def update_param_media(self, media_name, param_name, value):
        media = self._get_media(media_name=media_name)
        if not media:
            return False
        return media.update_property_param(param_name, value)

    def save_params_media(self, media_name):
        media = self._get_media(media_name=media_name)
        if not media:
            return False
        return self.config.write_media(media)

    ##########################################################################
    #############################  OBSERVER  #################################
    ##########################################################################
    def add_image_observer(self, observer, execution_name, filter_name):
        """
            Inform the server what filter we want to observe
            Param :
                - ref, observer is a reference on method for callback
                - string, execution_name to select an execution
                - string, filter_name to select the filter
        """
        filterchain = self._get_filterchain(execution_name)
        if not filterchain:
            return False
        return filterchain.add_image_observer(observer, filter_name)

    def set_image_observer(self, observer, execution_name, filter_name_old, filter_name_new):
        """
            Inform the server what filter we want to change observer
            Param :
                - ref, observer is a reference on method for callback
                - string, execution_name to select an execution
                - string, filter_name_old , filter to replace
                - string, filter_name_new , filter to use
        """
        if filter_name_old == filter_name_new:
            log.print_function(logger.error, "New and old filter_name is equal: %s" % filter_name_old)
            return False
        filterchain = self._get_filterchain(execution_name)
        if not filterchain:
            return False
开发者ID:FredericLanglois,项目名称:SeaGoatVision,代码行数:70,代码来源:manager.py

示例2: __init__

# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import write_media [as 别名]

#.........这里部分代码省略.........

        param.set(value)
        return True

    def reset_param_media(self, media_name, param_name):
        self._post_command_(locals())
        # param_name can be a list or string
        lst_param = self._get_lst_param_media(media_name, param_name)

        if not lst_param:
            return False

        for param in lst_param:
            param.reset()
        return True

    def set_as_default_param_media(self, media_name, param_name):
        self._post_command_(locals())
        # param_name can be a list or string
        lst_param = self._get_lst_param_media(media_name, param_name)

        if not lst_param:
            return False

        for param in lst_param:
            param.set_as_default()
        return True

    def save_params_media(self, media_name):
        self._post_command_(locals())
        media = self._get_media(media_name=media_name)
        if not media:
            return False
        return self.config.write_media(media)

    def cut_video(self, video_name, begin, end, cut_video_name):
        self._post_command_(locals())
        if not os.path.isfile(video_name):
            log.print_function(logger.error, "File specified %s doesn't exist." % video_name)
            return
        if not video_name[-4:] == ".avi":
            log.print_function(logger.error, "File specified %s is not .avi." % video_name)
            return
        video_media = Movie(video_name)
        if not video_media:
            return False
        rec_thread = ThreadRecordCutVideo(video_media, begin, end, cut_video_name, self)
        rec_thread.start()
        return True

    #
    # OBSERVER  #################################
    #
    def add_image_observer(self, observer, execution_name, filter_name):
        """
            Inform the server what filter we want to observe
            Param :
                - ref, observer is a reference on method for callback
                - string, execution_name to select an execution
                - string, filter_name to select the filter
        """
        self._post_command_(locals())
        filterchain = self._get_filterchain(execution_name)
        if not filterchain:
            return False
        return filterchain.add_image_observer(observer, filter_name)
开发者ID:Octets,项目名称:SeaGoatVision,代码行数:70,代码来源:cmdHandler.py


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