def get(self, channel_id, video_id = '', comment_id = ''): channel = data_source.get_channel(channel_id) offset, limit = handlers.parse_offset_and_limit(self) videos = data_source.get_videos_in_channel(channel_id, offset = offset, limit = limit) ret = {} ret["channel"] = channel ret["videos"] = videos ret["offset"] = offset ret["limit"] = limit self.render("ChannelListPage.html", ret)
def post(self): channel_id = self.request.get("channel_id") logging.info("Persisting data in channel: %s" % channel_id) videos = data_source.get_videos_in_channel(channel_id, 0, data_source.MAX_CHANNEL_SIZE) logging.info("Got videos: %d" % len(videos)) for v in videos: video_model = data_source.get_video_model(channel_id, v["video_id"]) video_model.final_score = v["final_score"] logging.info("Updating video %d with final_score %f" % (v["video_id"], v["final_score"])) video_model.put()
def get(self, channel_id): channel = data_source.get_channel(channel_id) if not channel: self.render_dict_as_json({"error" : "Channel not found. channel_id=%s" % channel_id}) return offset, limit = handlers.parse_offset_and_limit(self) videos = data_source.get_videos_in_channel(channel_id, offset = offset, limit = limit) ret = {} ret["channel"] = channel.to_dict() ret["videos"] = videos ret["offset"] = offset ret["limit"] = limit self.render_dict_as_json(ret)