コード例 #1
0
ファイル: export_launcher.py プロジェクト: Denise8/pupil
    def add_export(self):
        # on MacOS we will not use os.fork, elsewhere this does nothing.
        forking_enable(0)

        logger.debug("Adding new export.")
        should_terminate = RawValue(c_bool,False)
        frames_to_export  = RawValue(c_int,0)
        current_frame = RawValue(c_int,0)

        data_dir = self.data_dir
        start_frame= self.start_frame.value
        end_frame= self.end_frame.value
        plugins = []

        # Here we make clones of every plugin that supports it.
        # So it runs in the current config when we lauch the exporter.
        for p in self.g_pool.plugins:
            try:
                p_initializer = p.get_class_name(),p.get_init_dict()
                plugins.append(p_initializer)
            except AttributeError:
                pass

        out_file_path=verify_out_file_path(self.rec_name.value,self.data_dir)
        process = Process(target=export, args=(should_terminate,frames_to_export,current_frame, data_dir,start_frame,end_frame,plugins,out_file_path))
        process.should_terminate = should_terminate
        process.frames_to_export = frames_to_export
        process.current_frame = current_frame
        process.out_file_path = out_file_path
        self.new_export = process
コード例 #2
0
    def add_export(self):
        # on MacOS we will not use os.fork, elsewhere this does nothing.
        forking_enable(0)

        logger.debug("Adding new export.")
        should_terminate = RawValue(c_bool, False)
        frames_to_export = RawValue(c_int, 0)
        current_frame = RawValue(c_int, 0)

        data_dir = self.data_dir
        start_frame = self.start_frame.value
        end_frame = self.end_frame.value
        plugins = []

        # Here we make clones of every plugin that supports it.
        # So it runs in the current config when we lauch the exporter.
        for p in self.g_pool.plugins:
            try:
                p_initializer = p.get_class_name(), p.get_init_dict()
                plugins.append(p_initializer)
            except AttributeError:
                pass

        out_file_path = verify_out_file_path(self.rec_name.value,
                                             self.data_dir)
        process = Process(target=export,
                          args=(should_terminate, frames_to_export,
                                current_frame, data_dir, start_frame,
                                end_frame, plugins, out_file_path))
        process.should_terminate = should_terminate
        process.frames_to_export = frames_to_export
        process.current_frame = current_frame
        process.out_file_path = out_file_path
        self.new_export = process
コード例 #3
0
ファイル: batch_exporter.py プロジェクト: shafcodes/pupil
    def add_exports(self):
        # on MacOS we will not use os.fork, elsewhere this does nothing.
        forking_enable(0)

        outfiles = set()
        for d in self.new_exports:
            logger.debug("Adding new export.")
            should_terminate = RawValue(c_bool, False)
            frames_to_export = RawValue(c_int, 0)
            current_frame = RawValue(c_int, 0)
            start_frame = None
            end_frame = None
            data_dir = d
            plugins = []

            # Here we make clones of every plugin that supports it.
            # So it runs in the current config when we lauch the exporter.
            for p in self.g_pool.plugins:
                try:
                    p_initializer = p.get_class_name(), p.get_init_dict()
                    plugins.append(p_initializer)
                except AttributeError:
                    pass

            #make a unique name created from rec_session and dir name
            rec_session, rec_dir = data_dir.rsplit(os.path.sep, 2)[1:]
            out_name = rec_session + "_" + rec_dir + ".avi"
            out_file_path = os.path.join(self.destination_dir.value, out_name)
            if out_file_path in outfiles:
                logger.error(
                    "This export setting would try to save %s at least twice please rename dirs to prevent this. Skipping File"
                    % out_file_path)
            else:
                outfiles.add(out_file_path)
                logger.info("Exporting to: %s" % out_file_path)

                process = Process(target=export,
                                  args=(should_terminate, frames_to_export,
                                        current_frame, data_dir, start_frame,
                                        end_frame, plugins, out_file_path))
                process.should_terminate = should_terminate
                process.frames_to_export = frames_to_export
                process.current_frame = current_frame
                process.out_file_path = out_file_path
                self.exports.append(process)
コード例 #4
0
ファイル: batch_exporter.py プロジェクト: cmcmurrough/pupil
    def add_exports(self):
        # on MacOS we will not use os.fork, elsewhere this does nothing.
        forking_enable(0)

        outfiles = set()
        for d in self.new_exports:
            logger.debug("Adding new export.")
            should_terminate = RawValue(c_bool,False)
            frames_to_export  = RawValue(c_int,0)
            current_frame = RawValue(c_int,0)
            start_frame = None
            end_frame = None
            data_dir = d
            plugins = []

            # Here we make clones of every plugin that supports it.
            # So it runs in the current config when we lauch the exporter.
            for p in self.g_pool.plugins:
                try:
                    p_initializer = p.get_class_name(),p.get_init_dict()
                    plugins.append(p_initializer)
                except AttributeError:
                    pass

            #make a unique name created from rec_session and dir name
            rec_session, rec_dir = data_dir.rsplit(os.path.sep,2)[1:]
            out_name = rec_session+"_"+rec_dir+".avi"
            out_file_path = os.path.join(self.destination_dir.value,out_name)
            if out_file_path in outfiles:
                logger.error("This export setting would try to save %s at least twice please rename dirs to prevent this. Skipping File"%out_file_path)
            else:
                outfiles.add(out_file_path)
                logger.info("Exporting to: %s"%out_file_path)

                process = Process(target=export, args=(should_terminate,frames_to_export,current_frame, data_dir,start_frame,end_frame,plugins,out_file_path))
                process.should_terminate = should_terminate
                process.frames_to_export = frames_to_export
                process.current_frame = current_frame
                process.out_file_path = out_file_path
                self.exports.append(process)