def GET(self,video_id): if session.user=='username': raise web.seeother('/') else: z=model.get_country(session.user)['country'] y=model.get_countryrestriction(video_id)['CountryRestriction'] y=ast.literal_eval(y) ag=model.calculate_Age(model.get_dob(session.user)['dob']) agres=model.get_agerestriction(video_id)['AgeRestriction'] if (int(ag)>int(agres)): if (z not in y): model.add_history(session.user,video_id) model.update_views(video_id) ls=model.get_likestatus(session.user,video_id) ss=model.get_subscribestatus(session.user,model.get_uploader(video_id)['uploader']) cmts=model.get_commentlist(video_id) x=model.get_recommendation(int(video_id),int(model.calculate_Age(model.get_dob(session.user)['dob'])),model.get_country(session.user)['country']) t= x['recom_id'] s=[] for i in range(len(t)): if t[i]==video_id: r=t.pop(i) break if t==None: t=[] if range(len(t))>7: t=t[0:7] videonames=[] for i in range(len(t)): videonames.append(model.get_videoname(t[i])['name']) uploaders=[] for i in range(len(t)): uploaders.append(model.get_uploader(t[i])['uploader']) descriptions=[] for i in range(len(t)): descriptions.append(model.get_description(t[i])['description']) views=[] for i in range(len(t)): views.append(model.get_views(t[i])['views']) likes=[] dislikes=[] for i in range(len(t)): x=model.get_likestatus_count(t[i]) likes.append(x['likes']) dislikes.append(x['dislikes']) return render.play(session.user,model.get_firstname(session.user)['firstname'],video_id,model.get_videoname(video_id)['name'],model.get_uploader(video_id)['uploader'],model.get_description(video_id)['description'],model.get_views(video_id)['views'],model.get_likestatus_count(video_id)['likes'],model.get_likestatus_count(video_id)['dislikes'],ls['likestatus'],ss['subscribestatus'],cmts['commentid'],cmts['usernames'],cmts['commentlist'],t,videonames,uploaders,descriptions,views,likes,dislikes) else: return render.restrictions(model.get_firstname(session.user)['firstname']) else: return render.restrictions(model.get_firstname(session.user)['firstname'])
def GET(self,profileusername): if session.user=='username': raise web.seeother('/') if session.user==profileusername: raise web.seeother('/myprofile') u=model.get_user_stats(profileusername) return render.profile(model.get_firstname(session.user)['firstname'],profileusername,model.get_firstname(profileusername)['firstname'],u['about'],u['joined'],u['likes'],u['dislikes'],u['subscribers'])
def GET(self): if session.user=='username': raise web.seeother('/') s=model.get_uploads(session.user) t=s['videouploads'] videonames=[] for i in range(len(t)): videonames.append(model.get_videoname(t[i])['name']) uploaders=[] for i in range(len(t)): uploaders.append(model.get_uploader(t[i])['uploader']) descriptions=[] for i in range(len(t)): descriptions.append(model.get_description(t[i])['description']) views=[] for i in range(len(t)): views.append(model.get_views(t[i])['views']) likes=[] dislikes=[] for i in range(len(t)): x=model.get_likestatus_count(t[i]) likes.append(x['likes']) dislikes.append(x['dislikes']) return render.uploads(session.user,model.get_firstname(session.user)['firstname'],t,videonames,uploaders,descriptions,views,likes,dislikes)
def GET(self): if session.user=='username': raise web.seeother('/') else: x= model.get_trending(int(model.calculate_Age(model.get_dob(session.user)['dob'])),model.get_country(session.user)['country']) t= x['trend_video'] videonames=[] for i in range(len(t)): videonames.append(model.get_videoname(t[i])['name']) uploaders=[] for i in range(len(t)): uploaders.append(model.get_uploader(t[i])['uploader']) descriptions=[] for i in range(len(t)): descriptions.append(model.get_description(t[i])['description']) views=[] for i in range(len(t)): views.append(model.get_views(t[i])['views']) likes=[] dislikes=[] for i in range(len(t)): x=model.get_likestatus_count(t[i]) likes.append(x['likes']) dislikes.append(x['dislikes']) return render.homepage(model.get_firstname(session.user)['firstname'],t,videonames,uploaders,descriptions,views,likes,dislikes)
def GET(self): if session.user=='username': raise web.seeother('/') s=model.get_profile(session.user) fn=s['firstname'] ln=s['lastname'] db=s['dob'] abt=s['about'] eml=s['email'] ph=s['phone'] cntry=s['country'] return render.updateprofile(session.user,model.get_firstname(session.user)['firstname'],fn,ln,abt,db,eml,ph,cntry)
def GET(self,video_id): if session.user=='username': raise web.seeother('/') id=int(video_id) s=model.get_videodesc(id) #if s['id']==session.user: id1=s['id'] name=s['name'] uploader=s['uploader'] description=s['description'] category=s['category'] countries=s['countries'] age=s['age'] return render.uploadvideoinfo(session.user,model.get_firstname(session.user)['firstname'],id1,name,description,category,countries,age)
def POST(self,video_id): id=int(video_id) s=model.get_videodesc(id) #if s['id']==session.user: id1=s['id'] name=s['name'] uploader=s['uploader'] description=s['description'] category=s['category'] if s['countries']!='null': countries=ast.literal_eval(s['countries']) else: countries=[] age=s['age'] if s['tags']!='null': tags=ast.literal_eval(s['tags']) tags=','.join(tags) else: tags="" return render.editvideo(session.user,model.get_firstname(session.user)['firstname'],int(id1),name,description,category,countries,int(age),tags)
def GET(self,category): if session.user=='username': raise web.seeother('/') s=model.get_category_videoids(category,model.calculate_Age(model.get_dob(session.user)['dob']),model.get_country(session.user)['country']) t=s['id'] videonames=[] for i in range(len(t)): videonames.append(model.get_videoname(t[i])['name']) uploaders=[] for i in range(len(t)): uploaders.append(model.get_uploader(t[i])['uploader']) descriptions=[] for i in range(len(t)): descriptions.append(model.get_description(t[i])['description']) views=[] for i in range(len(t)): views.append(model.get_views(t[i])['views']) likes=[] dislikes=[] for i in range(len(t)): x=model.get_likestatus_count(t[i]) likes.append(x['likes']) dislikes.append(x['dislikes']) return render.category(session.user,model.get_firstname(session.user)['firstname'],t,videonames,uploaders,category,descriptions,views,likes,dislikes)
def GET(self): if session.user=='username': raise web.seeother('/') u=model.get_user_stats(session.user) s=model.get_profile(session.user) return render.myprofile(session.user,model.get_firstname(session.user)['firstname'],s['firstname'],s['lastname'],s['dob'],s['about'],s['email'],s['phone'],s['country'],u['joined'],u['likes'],u['dislikes'],u['subscribers'])
def GET(self): if session.user=='username': raise web.seeother('/') else: return render.uploadvideo(model.get_firstname(session.user)['firstname'])
def GET(self): s=model.get_subscription(session.user) t=s['subscriptions'] return render.subscription(session.user,model.get_firstname(session.user)['firstname'],t)
def POST(self): data=web.data() un=json.loads(data)['username'] s=model.get_firstname(un) return s