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

Class New_video

walrus/methods/video/video.py:50–921  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48
49
50class New_video():
51 """
52 """
53
54 def __init__(
55 self,
56 session,
57 project,
58 input
59 ):
60
61 self.session = session
62 self.project = project
63 self.input = input
64
65 self.found_sequences = {}
66 self.sequence_number_to_id = {}
67 self.highest_frame_encountered = None
68
69 def upload_video_file(
70 self,
71 video_file_name,
72 extension,
73 video):
74
75 video.file_blob_path = settings.PROJECT_VIDEOS_BASE_DIR + \
76 str(self.project.id) + "/" + str(video.id)
77
78 data_tools = Data_tools().data_tools
79 data_tools.upload_to_cloud_storage(
80 temp_local_path = video_file_name,
81 blob_path = video.file_blob_path,
82 content_type = f"video/{str(extension[1:])}",
83 timeout = 60 * 10
84 )
85
86 video.file_signed_url = data_tools.build_secure_url(video.file_blob_path, 2592000)
87
88 def check_free_tier_frame_count(self, frame_count):
89
90 member = self.input.member_created
91 user = None
92 if member:
93 user = member.user
94
95 feature_checker = FeatureChecker(
96 session = self.session,
97 user = user,
98 project = self.project
99 )
100
101 max_frames = feature_checker.get_limit_from_plan('MAX_FRAMES_PER_VIDEO')
102 if max_frames is not None and frame_count >= max_frames:
103 self.input.status = "failed"
104 message = 'Free Tier Limit Reached - Max Frames Per Video Allowed: {}. But Video has {}'.format(
105 max_frames,
106 frame_count)
107 self.input.status_text = message

Callers 3

__copy_videoMethod · 0.90
process_videoMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected