MCPcopy Index your code
hub / github.com/diffgram/diffgram / push_frames_for_copy_to_queue

Method push_frames_for_copy_to_queue

walrus/methods/video/video.py:789–845  ·  view source on GitHub ↗

Give the current data at self.input, get the video frame of the existing file and push them to the ProcessMedia Queue. :return:

(
        self,
        source_video_parent_file_id,
        destination_video_parent_file_id)

Source from the content-addressed store, hash-verified

787 self.input.frame_packet_map[frame_number] = instance_list
788
789 def push_frames_for_copy_to_queue(
790 self,
791 source_video_parent_file_id,
792 destination_video_parent_file_id):
793 """
794 Give the current data at self.input, get the video frame of the existing file
795 and push them to the ProcessMedia Queue.
796 :return:
797 """
798
799 source_video_frames = WorkingDirFileLink.image_file_list_from_video(
800 session = self.session,
801 video_parent_file_id = source_video_parent_file_id,
802 order_by_frame = True
803 )
804 frame_completion_controller = FrameCompletionControl()
805 for frame in source_video_frames:
806 frame_completion_controller.add_pending_frame(frame.frame_number)
807
808 for frame in source_video_frames:
809 ### HOW TOD AVOID DETACHED SESSION
810 ### Must only pass IDs and not pass any other objects
811
812 # Actually the add remove link thing could be different too...
813
814 # Careful the file id is the newly copied video
815 # The previous video id should come from the NEW file id not the previous one
816 frame_input = Input.new(
817 parent_input_id = self.input.id,
818 sequence_map = self.input.sequence_map,
819 file_id = frame.id, # existing
820 video_parent_length = len(source_video_frames),
821 directory_id = self.input.directory_id,
822 source_directory_id = self.input.source_directory_id,
823 remove_link = self.input.remove_link,
824 add_link = self.input.add_link,
825 copy_instance_list = self.input.copy_instance_list,
826 parent_file_id = destination_video_parent_file_id,
827 # This is the parent video file where all data is going to be copied.
828 project_id = self.input.project_id,
829 mode = 'copy_file',
830 type = None,
831 media_type = 'frame',
832 )
833
834 item = PrioritizedItem(
835 input = frame_input,
836 frame_completion_controller = frame_completion_controller,
837 total_frames = source_video_frames[len(source_video_frames) - 1].frame_number,
838 num_frames_to_update = len(source_video_frames),
839 media_type = frame_input.media_type, # declaring here helps with routing
840 priority = 100 + frame.frame_number, # Process in frame priority
841 frame_number = frame.frame_number # Careful, downstream process currently expects it
842 )
843
844 process_media_queue_manager.router(item)
845 return source_video_frames
846

Callers 1

__copy_videoMethod · 0.95

Calls 6

add_pending_frameMethod · 0.95
PrioritizedItemClass · 0.90
routerMethod · 0.80
newMethod · 0.45

Tested by

no test coverage detected