def get(self, code): video = g.store.find(Video, code=code).one_or_none() if video is None: g.store.add(Event('VIDEO_STATUS_CHECK', {'code': code})) g.store.commit() return {'eta': Video.get_eta(g.store)} return video.dict(users=is_authenticated())