Пример #1
0
	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)
Пример #2
0
	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)
Пример #3
0
	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'])
Пример #4
0
	def POST(self):
		i = web.input()
		s = model.send_search(i.searchtext,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.search(session.user,t,videonames,uploaders,descriptions,views,likes,dislikes)
Пример #5
0
	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)
Пример #6
0
 def POST(self):
     data = web.data()
     id = json.loads(data)['vid']
     s = model.get_description(id)
     return s