def post(self): print 'Content-Type: text/plain' print '' video = Video.get_by_key_name('vid' + self.request.get('playerID')) if not video: video = Video.get_by_key_name(self.request.get('playerID')) author = users.get_current_user() if video: text = unicode(self.request.get('message')).strip() stime = float(self.request.get('playTime')) mode = int(self.request.get('mode')) fontsize = int(self.request.get('fontsize')) color = int(self.request.get('color')) cmt = Comment(author=author, text=text, stime=stime, mode=mode, fontsize=fontsize, color=color, cid=video) if cmt: cmt.put() print 'OK' else: print 'Failed' else: print 'Failed'
def post(self): print 'Content-Type: text/plain' print '' video = Video.get_by_key_name('vid' + self.request.get('playerID')) if not video: video = Video.get_by_key_name(self.request.get('playerID')) author = users.get_current_user() if video: text = unicode(self.request.get('message')).strip() stime = float(self.request.get('playTime')) mode = int(self.request.get('mode')) fontsize = int(self.request.get('fontsize')) color = int(self.request.get('color')) cmt = Comment(author=author, text=text, stime=stime, mode=mode, fontsize=fontsize, color=color, cid=video) if cmt: cmt.put() print 'OK' else: print 'Failed' else: print 'Failed'
def delete_comment_by_video_key_name_without_author(keyname): v = Video.get_by_key_name(keyname) user = users.get_current_user() if v and user: comments = v.comment_set for c in comments: if c.author != user: c.delete()
def delete_video_by_key_name(keyname): v = Video.get_by_key_name(keyname) if v: comments = v.comment_set MukioTools.delete(comments) cblocks = v.cblock_set MukioTools.delete(cblocks)# 新,删永久xml v.delete()
def get(self, cid): video = Video.get_by_key_name(cid) if not video: self.error(404) else: self.render( 'addblock.html', { 'video': video, 'title': 'Add/Update XML File for Video: ' + video.key().name() })
def get(self, cid, block=''): video = Video.get_by_key_name('vid' + cid) if not video: video = Video.get_by_key_name(cid) if block == 'permanent': #新,双重字幕中的永久字幕,可以通过导入空的xml来覆盖 block = video.cblock_set.get() self.render('pcmt.xml', {'cblock': block}) else: comments = [] if video: cmts = video.comment_set #cmts.order('parttitle') for c in cmts: c.keyid = c.key().id() c.postdate += timedelta(hours=+8) comments.append(c) tmpvars = {'comments': comments} self.render('comment.xml', tmpvars)
def get(self,cid,block=''): video = Video.get_by_key_name('vid' + cid) if not video: video = Video.get_by_key_name(cid) if block == 'permanent':#新,双重字幕中的永久字幕,可以通过导入空的xml来覆盖 block = video.cblock_set.get() self.render('pcmt.xml',{'cblock':block}) else: comments = [] if video: cmts = video.comment_set #cmts.order('parttitle') for c in cmts: c.keyid = c.key().id() c.postdate += timedelta(hours=+8) comments.append(c) tmpvars = {'comments':comments} self.render('comment.xml',tmpvars)
def delete_video(self, key_name): video = Video.get_by_key_name(key_name) if video: if video.art.author == self.user: MukioTools.delete_video_by_key_name(key_name)
def delete_user_comment(self, key_name): video = Video.get_by_key_name(key_name) if video: if video.art.author == self.user: MukioTools.delete_comment_by_video_key_name_without_author( key_name)
def delete_permanent_comment(self, key_name): video = Video.get_by_key_name(key_name) if video: if video.art.author == self.user: MukioTools.delete_permanent_comment_by_video_key_name(key_name)
def delete_permanent_comment_by_video_key_name(keyname): v = Video.get_by_key_name(keyname) if v: cblocks = v.cblock_set MukioTools.delete(cblocks)
def delete_comment_by_video_key_name(keyname): v = Video.get_by_key_name(keyname) if v: comments = v.comment_set MukioTools.delete(comments)
def get(self,cid): video = Video.get_by_key_name(cid) if not video: self.error(404) else: self.render('addblock.html',{'video':video,'title':'Add/Update XML File for Video: ' + video.key().name()})
def delete_video(self, key_name): video = Video.get_by_key_name(key_name) if video: if video.art.author == self.user: MukioTools.delete_video_by_key_name(key_name)
def delete_user_comment(self, key_name): video = Video.get_by_key_name(key_name) if video: if video.art.author == self.user: MukioTools.delete_comment_by_video_key_name_without_author(key_name)
def delete_permanent_comment(self, key_name): video = Video.get_by_key_name(key_name) if video: if video.art.author == self.user: MukioTools.delete_permanent_comment_by_video_key_name(key_name)