本文整理汇总了Python中video.Video.setUUID方法的典型用法代码示例。如果您正苦于以下问题:Python Video.setUUID方法的具体用法?Python Video.setUUID怎么用?Python Video.setUUID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类video.Video
的用法示例。
在下文中一共展示了Video.setUUID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from video import Video [as 别名]
# 或者: from video.Video import setUUID [as 别名]
class Root:
def __init__(self):
self.dbExecutor = DatabaseExecutor(nameOfDatabase, userDatabase, 10, path_db)
self.user = User()
self.video = Video()
self.rvb = RandomVideoBuilder(lDictionary)
@cherrypy.expose
def index(self, videoUUID = None):
time = self.rvb.compute()
if videoUUID == None:
videoUUID = self.rvb.getUuid()
else:
videoUUID = urllib.quote_plus(videoUUID)
if not self.rvb.isVideoExists(videoUUID):
# for security but need to check that is a valid video otherwise a user can vote for bullshit
# to do that, load the page and search for the ?v=videoUUID in the page. If it's present, the video is valid, otherwise it not
# since if the uuid is not valid, youtube resend you to youtube.com and the video should not be on the page
raise cherrypy.HTTPRedirect(rootPath) # redirect on home page
self.video.setUUID(videoUUID)# load in the page a particularVideo, http://localhost:8000/?videoUUID=f9O5F1eiIjI
votes = self.dbExecutor.computeAllVotes(videoUUID)
# userID = self.user.getUUID();
# userVote = None
# if userID != None:
# userVote = hasAlreadyVotedForThisVideo(videoUUID, userID)
return env.get_template('index.html').render(
pageURL = url,
pageTitle = 'Lose my time',
currentVideoId = self.video.getUUID(),
nextVideoId = self.rvb.getNuuid(),
videoTitle = self.rvb.getTitle(),
time = time,
wikilink = wikipediaPythonLink,
path = rootPath,
nbBored = votes[0],
nbLiked = votes[1],
connected = self.user.isValid())
@cherrypy.expose
def concept(self):
return env.get_template('concept.html').render(
pageTitle = 'Concept',
path = '../')
@cherrypy.expose
def podium(self):
ranking = self.dbExecutor.getRanking()
return env.get_template('podium.html').render(
pageTitle = 'Podium',
ranking = ranking,
path = '../')
@cherrypy.expose
def doVote(self, hasGotBored = None):
if self.user.isValid() and hasGotBored != None:
valid = self.dbExecutor.insertNewVote(str(self.video.getUUID()), hasGotBored, self.user.getUUID()) # return true if the insertion is valid (ie an update or an new entry)
if valid:
print "insertion done"
@cherrypy.expose
def updateFbInfo(self, userID = None, token = None, status = None):
self.user.setUUID(userID)
self.user.setValid(status == 'connected')
if self.user.isValid():
hasVoted = self.dbExecutor.hasAlreadyVotedForThisVideo(self.video.getUUID(), self.user.getUUID())
self.user.setHasVoted(hasVoted)
if hasVoted != None:
return hasVoted
else:
self.user.setHasVoted(None) # if the user deconnects for instance