def AddNewVideo(self, name, videoLink, videocat): # v = self.VideoLink(videoLink) vidquery = Video.query(ancestor=self.VideoLink(videoLink)) videos = vidquery.get() if (videos != None): logging.info(str(videos.videolink)) if (str(videos.videolink) == videoLink): post = dict() post["error"] = "Already Exists" return json.dumps(post) else: vid = Video(parent=self.VideoLink(videoLink)) # name="sample",videolink=videoLink,audiolink="",videoCategory="Entertainment" vid.name = name vid.videolink = videoLink vid.audiolink = "" vid.videoCategory = videocat vid.dubsCount = 0 vid.addedDate = datetime.now() vid.put() post = dict() post["result"] = "Added new video" return json.dumps(post)
def AddNewVideo(self, name, videoLink, videocat, uniqueID): # v = self.VideoLink(videoLink) vidquery = Video.query(ancestor=self.VideoLink(videoLink)) videos = vidquery.get() if(videos != None): # logging.info(str(videos.videolink)) if(str(videos.videolink) == videoLink): post = dict() post["error"] = "Already Exists" return json.dumps(post) else: # userQuery=User.query(ancestor=self.UserKey(uniqueID)) # user = userQuery.get() # response = dict() # if(user != None): # # logging.info(str(user.uniqueID)) # videosByUser = [] # videosByUser = user.addedVideos # videosByUser.append(videoLink) # user.addedVideos = videosByUser # user.put() vid = Video(parent=self.VideoLink(videoLink)) # name="sample",videolink=videoLink,audiolink="",videoCategory="Entertainment" vid.name = str(name.encode('utf-8').lower()) vid.videolink = videoLink vid.audiolink = "" vid.videoCategory = videocat vid.dubsCount = 0 vid.addedDate = datetime.now() vid.addedUser = uniqueID vid.put() post = dict() post["result"] = "Added new video" return json.dumps(post)