Пример #1
0
 def add_image_description(self, description: str):
     get_mongo_client()['sessions'].update(
         {'_id': self.session_id},
         {'$set': {
             'image': {
                 'description': description
             }
         }})
Пример #2
0
 def add_image(self, image_type: str, image: bytes):
     get_mongo_client()['sessions'].update(
         {'_id': self.session_id},
         {'$set': {
             'image': {
                 'type': image_type,
                 'content': image
             }
         }})
Пример #3
0
 def add_target_frame(self, frame_id: int):
     get_mongo_client()['sessions'].update({'_id': self.session_id},
                                           {'$push': {
                                               'frames': frame_id
                                           }})
Пример #4
0
 def clear_image(self):
     get_mongo_client()['sessions'].update({'_id': self.session_id},
                                           {'$unset': {
                                               'image': None
                                           }})
Пример #5
0
 def _get_session(self):
     return get_mongo_client()['sessions'].find_one(
         {'_id': self.session_id})
Пример #6
0
 def _start_new_session(self):
     timestamp = dt.datetime.utcnow()
     get_mongo_client()['sessions'].insert({
         '_id': self.session_id,
         'timestamp': timestamp
     })