Example #1
0
def allEmbed(param):
	x = Videos()
	username = param['username']
	hash = param['hash']
	publc = param['publc']
	
	# create a hash
	m = md5.new(username + publc + _private_key())

	# check if this hash is equal to the one transmitted
	if m.hexdigest() == hash:
		
		data = x.allUserData(param)

		if data:
			embeds = {}
			i = 0
			for item in data:
				embeds[i] = {
					'id' : item[0],
					'category' : item[1],
					'tags' : item[2],
					'data' : item[3],
					'is_public' : item[4],
					'pkid' : item[5]
					#'date_added': item[5]
				}
				i = i + 1
		else:
			embeds = False

		# get the user's playlists
		# if username is blank, data will be false
		pl = Playlists()
		playlists = pl.getPlaylists(param)
		
		dat = {
				'data': embeds,
				#'records': x.allUserDataCount(param),
				'playlists': playlists,
				'id': 1234
			}
	else:
		dat = {
				'data': False,
				#'records' : 0,
				'playlists': False,
				'id': 1234
			}
		
	return dat
Example #2
0
def allEmbedFromTags(param):
	x = Videos()
	username = param['username']
	data = x.allUserData(username)

	if data:
		embeds = {}
		i = 0
		for item in data:
			embeds[i] = {
				'id' : item[0],
				'category' : item[1],
				'tags' : item[2],
				'data' : item[3],
				'is_public' : item[4],
				'pkid' : item[5]
				#'date_added': item[5]
			}
			i = i + 1
	else:
		embeds = False

	# get the user's playlists
	# if username is blank, data will be false
	pl = Playlists()
	param = {
		'username' : username
	}
	playlists = pl.getPlaylists(param)
	
	dat = {
			'data': embeds,
			'playlists': playlists,
			'id': 1234
		}
		
	return dat