def generate(self, context): import generate, imggen (pogo, pogoCollections) = generate.getPogoData(context, self.selector) pogoImgData = generate.getPogoData(context, self.selector)[0] (img, pogomap) = imggen.createPogoHistogram(context, pogoImgData) ss = selectors.getSelectorData(context) title = self.selector.name return { "collection" : pogoCollections[0], "pogomap" : pogomap, "selectors" : ss, "title" : title, "url" : "/dynamic/image/pogo", "username" : context.geek }
def generate(self, context): import generate, imggen (pogo, pogoCollections) = generate.getPogoData(context, self.selector) pogoImgData = generate.getPogoData(context, self.selector)[0] (img, pogomap) = imggen.createPogoHistogram(context, pogoImgData) ss = selectors.getSelectorData(context) title = self.selector.name return { "collection": pogoCollections[0], "pogomap": pogomap, "selectors": ss, "title": title, "url": "/dynamic/image/pogo", "username": context.geek }
def generate(self, context): import generate, imggen, library result = [] i = 0 for selector in self.selectors: pogoData = generate.getPogoData(context, selector)[0] if len(pogoData) == 0: continue t = library.Thing(selector.name) pogoData.sort(lambda gg1, gg2: cmp(gg1.plays, gg2.plays)) giniCoefficient, giniData = generate.produceGiniDataFromPogoDate( pogoData) if giniData is None: return None (img, map) = imggen.createGiniGraph(context, giniData) t.data = giniData t.img = imageBinaryData(img) t.map = map t.id = "ginirow%d" % i i += 1 t.coefficient = giniCoefficient result.append(t) if len(result) == 0: return None return {"giniData": result}
def ipod(request, param): import selectors, library try: context = interpretRequest(request, param) pbm = generate.getPBMData(context) favourites = generate.getFavourites(context, selectors.AllGamesSelector()) favourites = favourites[:50] shouldPlayOwn = generate.getShouldPlayOwnData(context) (pogo, pogoCollections) = generate.getPogoData(context, selectors.OwnedGamesSelector()) return webserver.render("stats/ipod_main.html", locals(), request) except library.NoSuchGeekException: return webserver.render("stats/ipod_geek_error.html", locals(), request)
def pogo(request, param): import library, views, imggen, generate try: (username, selector) = library.checkGeekGetSelector(param, request, views.POGO_SELECTOR[1:]) options = views.Options(request) ispec = ImageSpecs(request) context = views.OptimisationContext(username, options, ispec) data = generate.getPogoData(context, selector)[0] (img, imap) = imggen.createPogoHistogram(context, data) return library.imageResponse(img) except library.NoSuchGeekException: img = open("error.png") return webserver.response(img, content_type="image/png")
def ipod(request, param): import selectors, library try: context = interpretRequest(request, param) pbm = generate.getPBMData(context) favourites = generate.getFavourites(context, selectors.AllGamesSelector()) favourites = favourites[:50] shouldPlayOwn = generate.getShouldPlayOwnData(context) (pogo, pogoCollections) = generate.getPogoData( context, selectors.OwnedGamesSelector()) return webserver.render("stats/ipod_main.html", locals(), request) except library.NoSuchGeekException: return webserver.render("stats/ipod_geek_error.html", locals(), request)
def generate(self, context): import generate, imggen, library result = [] i = 0 for selector in self.selectors: pogoData = generate.getPogoData(context, selector)[0] if len(pogoData) == 0: continue t = library.Thing(selector.name) pogoData.sort(lambda gg1, gg2: cmp(gg1.plays, gg2.plays)) giniCoefficient, giniData = generate.produceGiniDataFromPogoDate(pogoData) if giniData is None: return None (img, map) = imggen.createGiniGraph(context, giniData) t.data = giniData t.img = imageBinaryData(img) t.map = map t.id = "ginirow%d" % i i += 1 t.coefficient = giniCoefficient result.append(t) if len(result) == 0: return None return { "giniData" : result }
def generate(self, context): import generate (pogo, pogoCollections) = generate.getPogoData(context, self.selector) return {"pogo": pogo}
def generate(self, context): import generate (pogo, pogoCollections) = generate.getPogoData(context, self.selector) return { "pogo" : pogo }