Prefer this as static method as we may want to call it even if don't have parent file? In which case would need to check permissions ie through project?
(
session,
video_parent_file_id: int,
frame_number: int,
with_for_update: bool = False,
nowait = False,
skip_locked = False
)
| 259 | |
| 260 | @staticmethod |
| 261 | def get_frame_from_video( |
| 262 | session, |
| 263 | video_parent_file_id: int, |
| 264 | frame_number: int, |
| 265 | with_for_update: bool = False, |
| 266 | nowait = False, |
| 267 | skip_locked = False |
| 268 | ): |
| 269 | """ |
| 270 | Prefer this as static method |
| 271 | as we may want to call it even if don't have parent file? |
| 272 | In which case would need to check permissions ie through project? |
| 273 | """ |
| 274 | if with_for_update: |
| 275 | return session.query(File).with_for_update(nowait = nowait, skip_locked = skip_locked).filter( |
| 276 | File.video_parent_file_id == video_parent_file_id, |
| 277 | File.frame_number == frame_number).first() |
| 278 | |
| 279 | else: |
| 280 | return session.query(File).filter( |
| 281 | File.video_parent_file_id == video_parent_file_id, |
| 282 | File.frame_number == frame_number).first() |
| 283 | |
| 284 | @staticmethod |
| 285 | def get_frame_list_from_video( |