def update_score(db, json_object):
"""
Method to update the score of the song
"""
q = Query()
j = db.search(q.url == json_object['url'])[0]
logger.debug("Duplicate post found: {}".format(j['title'].encode('ascii', 'ignore')))
logger.debug("Old Score: {}".format(j['score']))
logger.debug("Now Score: {}".format(json_object['score']))
if int(j['score']) != int(json_object['score']):
logger.debug("Updating Score for {}".format(j['title'].encode('ascii', 'ignore')))
db.update({'score':json_object['score']}, q.url == json_object['url'])
else:
logger.debug("The scores are still the same, not updating")
评论列表
文章目录