示例#1
0
    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'
示例#2
0
  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'
示例#3
0
 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()
示例#4
0
  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()
示例#5
0
 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()
             })
示例#6
0
    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)
示例#7
0
  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)
示例#8
0
 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)
示例#9
0
 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)
示例#10
0
 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)
示例#11
0
 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)
示例#12
0
 def delete_comment_by_video_key_name(keyname):
   v = Video.get_by_key_name(keyname)
   if v:
     comments = v.comment_set
     MukioTools.delete(comments)
示例#13
0
 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()})
示例#14
0
 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)
示例#15
0
 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)
示例#16
0
 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)