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

Method create_frame_packet_map

shared/database/source_control/file.py:463–486  ·  view source on GitHub ↗

Generates frame packet map dict from an existing video. :param session: :return:

(self, session)

Source from the content-addressed store, hash-verified

461 return child_files
462
463 def create_frame_packet_map(self, session):
464 """
465 Generates frame packet map dict from an existing video.
466 :param session:
467 :return:
468 """
469 if self.type != 'video':
470 return
471
472 # Load all frames with their instances
473 video_frames = working_dir_database_models.WorkingDirFileLink.image_file_list_from_video(
474 session = session,
475 video_parent_file_id = self.id)
476 frame_packet_map = {}
477 for frame in video_frames:
478 for instance in frame.instance_list:
479 if instance.soft_delete:
480 continue
481 serialized_instance = instance.serialize_for_frame_packet_map()
482 if frame_packet_map.get(frame.frame_number) is None:
483 frame_packet_map[frame.frame_number] = [serialized_instance]
484 else:
485 frame_packet_map[frame.frame_number].append(serialized_instance)
486 return frame_packet_map
487
488 # Placeholders from old code
489 def serialize_with_video(self, session):

Callers

nothing calls this directly

Calls 2

getMethod · 0.45

Tested by

no test coverage detected