示例#1
0
def get_album_rating(sid, album_id, user_id):
	rating = cache.get_album_rating(sid, album_id, user_id)
	if not rating:
		rating = db.c.fetch_row("SELECT album_rating_user AS rating_user, album_fave AS fave FROM r4_album_ratings WHERE user_id = %s AND album_id = %s AND sid = %s", (user_id, album_id, sid))
		if not rating:
			rating = { "rating_user": 0, "fave": None }
	cache.set_album_rating(sid, album_id, user_id, rating)
	return rating
示例#2
0
文件: rating.py 项目: nv043/rainwave
def get_album_rating(sid, album_id, user_id):
    rating = cache.get_album_rating(sid, album_id, user_id)
    if not rating:
        rating = db.c.fetch_row(
            "SELECT album_rating_user AS rating_user, album_fave AS fave, album_rating_complete AS rating_complete FROM r4_album_ratings WHERE user_id = %s AND album_id = %s AND sid = %s",
            (user_id, album_id, sid))
        if not rating:
            rating = {"rating_user": 0, "fave": None, "rating_complete": False}
    cache.set_album_rating(sid, album_id, user_id, rating)
    return rating
示例#3
0
def get_album_rating(sid, album_id, user_id):
	rating = cache.get_album_rating(sid, album_id, user_id)
	if not rating:
		rating = db.c.fetch_row(
			"SELECT album_rating_user AS rating_user, album_rating_complete AS rating_complete "
			"FROM r4_album_ratings "
			"WHERE user_id = %s AND album_id = %s AND sid = %s",
			(user_id, album_id, sid)
		)
		if not rating:
			rating = {"rating_user": 0, "rating_complete": False}
		rating['fave'] = db.c.fetch_var("SELECT album_fave FROM r4_album_faves WHERE user_id = %s AND album_id = %s", (user_id, album_id)) or False
	cache.set_album_rating(sid, album_id, user_id, rating)
	return rating
示例#4
0
def get_album_rating(sid, album_id, user_id):
	rating = cache.get_album_rating(sid, album_id, user_id)
	if not rating:
		rating = db.c.fetch_row(
			"SELECT album_rating_user AS rating_user, album_fave AS fave, album_rating_complete AS rating_complete "
			"FROM r4_album_ratings "
			"LEFT JOIN r4_album_faves USING (user_id, album_id) "
			"WHERE user_id = %s AND album_id = %s AND sid = %s",
			(user_id, album_id, sid)
		)
		if not rating:
			rating = { "rating_user": 0, "fave": None, "rating_complete": False }
	cache.set_album_rating(sid, album_id, user_id, rating)
	return rating
示例#5
0
文件: rating.py 项目: nullun/rainwave
def get_album_rating(sid, album_id, user_id):
    rating = cache.get_album_rating(sid, album_id, user_id)
    if not rating:
        rating = db.c.fetch_row(
            "SELECT album_rating_user AS rating_user, album_rating_complete AS rating_complete "
            "FROM r4_album_ratings "
            "WHERE user_id = %s AND album_id = %s AND sid = %s",
            (user_id, album_id, sid))
        if not rating:
            rating = {"rating_user": 0, "rating_complete": False}
        rating['fave'] = db.c.fetch_var(
            "SELECT album_fave FROM r4_album_faves WHERE user_id = %s AND album_id = %s",
            (user_id, album_id)) or False
    cache.set_album_rating(sid, album_id, user_id, rating)
    return rating