def playrate(request, param): import views, library, generate, imggen try: if "/" in param: fields = param.split("/") selector = "/".join(fields[1:]) context = views.interpretRequest(request, fields[0]) else: selector = "all" context = views.interpretRequest(request, param) import selectors data = generate.getPlayRateData(context, selector) (img, imap) = imggen.createPlayRateGraph(context, data) return library.imageResponse(img) except library.NoSuchGeekException: img = open("error.png") return webserver.response(img, content_type="image/png")
def mostPlayedCumulativeTimeline(request, param): import library, views, imggen, generate try: context = views.interpretRequest(request, param) data = generate.getMostPlayedTimelineData(context) img = imggen.createMostPlayedTimelineGraph(context, data) return library.imageResponse(img) except library.NoSuchGeekException: img = open("error.png") return webserver.response(img, content_type="image/png")
def lagHistogram(request, param): import views, library, generate, imggen try: context = views.interpretRequest(request, param) data = generate.getLagData(context) img = imggen.createLagHistogram(context, data) return library.imageResponse(img) except library.NoSuchGeekException: img = open("error.png") return webserver.response(img, content_type="image/png")
def pbmGraph(request, param): import library, views, imggen, generate try: context = views.interpretRequest(request, param) data = generate.getPBMData(context) img = imggen.createPBMGraph(context, data) return library.imageResponse(img) except library.NoSuchGeekException: img = open("error.png") return webserver.response(img, content_type="image/png")
def morgansPieCharts(request, param): import views, library, generate, imggen try: context = views.interpretRequest(request, param) data = generate.getMorgansPieChartsData(context.geek) img = imggen.createMorgansPieCharts(data) return library.imageResponse(img) except library.NoSuchGeekException: img = open("error.png") return webserver.response(img, content_type="image/png")
def playsByQuarter(request, param): import views, library, generate, imggen try: context = views.interpretRequest(request, param) data = generate.getPlaysByQuarterData(context, 1990) img = imggen.createPlaysForYearByQuarterPlot(data, context.imageSpec, 1990) return library.imageResponse(img) except library.NoSuchGeekException: img = open("error.png") return webserver.response(img, content_type="image/png")
def playrateprevown(request, param): import views, library, generate, imggen try: context = views.interpretRequest(request, param) import selectors data = generate.getPlayRateData(context, "prevowned") (img, imap) = imggen.createPlayRateGraph(context, data) return library.imageResponse(img) except library.NoSuchGeekException: img = open("error.png") return webserver.response(img, content_type="image/png")
def firstPlayVsRating(request, param): import views, library, generate, imggen try: context = views.interpretRequest(request, param) data = generate.getFirstPlayVsRatingData(context.geek) years = generate.getGeekYears(context.geek) img = imggen.createFirstPlayVsRatingGraph(context, data, years) return library.imageResponse(img) except library.NoSuchGeekException: img = open("error.png") return webserver.response(img, content_type="image/png")
def category(request, param): import library, views, imggen try: fields = param.split("/") context = views.interpretRequest(request, fields[0]) cattype = fields[1] cat = "/".join(fields[2:]) img = imggen.plotCategoryRatings(context, cattype, cat) return library.imageResponse(img) except library.NoSuchGeekException: img = open("error.png") return webserver.response(img, content_type="image/png")
def morePieCharts(request, param): import library, imggen, generate, views try: fields = param.split("/") if len(fields) > 0: context = views.interpretRequest(request, fields[0]) (plays, messages, year, month, day, args) = context.substrate.getPlaysForDescribedRange(fields[1:]) data = generate.morePieChartData(plays) img = imggen.createMorePieCharts(data) return library.imageResponse(img) else: img = open("error.png") return webserver.response(img, content_type="image/png") except library.NoSuchGeekException: img = open("error.png") return webserver.response(img, content_type="image/png")