( self, session, video, instance)
| 36 | |
| 37 | |
| 38 | def new_thumb_image_from_frame( |
| 39 | self, |
| 40 | session, |
| 41 | video, |
| 42 | instance): |
| 43 | |
| 44 | # new |
| 45 | if video.root_blob_path_to_frames: |
| 46 | root_path = video.root_blob_path_to_frames |
| 47 | # assumed to have trailing "/" |
| 48 | |
| 49 | blob_path = root_path + str(instance.frame_number) |
| 50 | |
| 51 | # migration |
| 52 | else: |
| 53 | if not instance.file.image: |
| 54 | return False |
| 55 | |
| 56 | blob_path = self.get_migration_path( |
| 57 | project = instance.file.project, |
| 58 | image = instance.file.image) |
| 59 | |
| 60 | image_np = data_tools.get_image(blob_path) |
| 61 | |
| 62 | cropped_image = self.crop_image(image_np, instance) |
| 63 | if cropped_image is False: |
| 64 | return False |
| 65 | |
| 66 | self.upload(session, instance, cropped_image) |
| 67 | |
| 68 | return True |
| 69 | |
| 70 | |
| 71 | def get_migration_path(self, project, image): |
no test coverage detected