def generate_yahootravel_rankings(whatever=None,skip_if_set=True,range=(0,0)): cities = City.objects.all()[range[0]:range[1]] resp = "" for c in cities: r3 = (yahootravel_ranking(c.id)) c.rating_factor_3 = r3 c.save() resp += "%s (%s) [%d]\n" % (c.name,c.wikiname,r3) resp += "Done\n" return resp
def rank_city(city,save=True): # here we are, the rankings if(city.wikiname is not None): r1 = (wikipedia_ranking(city.wikiname)) r1 = r1['content'] else: r1 = 0.0 r2 = (panoramio_ranking(city.id)) r3 = (yahootravel_ranking(city.id)) city.setRating(r1,r2,r3) if(save): city.save()
def generate_requested_rankings(whatever=None,skip_if_set=True,range=(0,0)): cities = City.objects.filter(recompute=True)[range[0]:range[1]] resp = "" for c in cities: r1 = (wikipedia_ranking(c.wikiname)) r2 = (panoramio_ranking(c.id)) r3 = (yahootravel_ranking(c.id)) c.setRating(r1['content'],r2,r3) #c.rating_factor_2 = r2 c.save() resp += "%s (%s) [%d,%d,%d]\n" % (c.name,c.wikiname,r1['content'],r2,r3) resp += "Done\n" return resp