Exemplo n.º 1
0
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")
Exemplo n.º 2
0
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")
Exemplo n.º 3
0
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")
Exemplo n.º 4
0
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")
Exemplo n.º 5
0
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")
Exemplo n.º 6
0
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")
Exemplo n.º 7
0
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")
Exemplo n.º 8
0
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")
Exemplo n.º 9
0
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")
Exemplo n.º 10
0
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")
Exemplo n.º 11
0
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")
Exemplo n.º 12
0
def plays(request, param):
    import library
    try:
        fields = param.split("/")
        if len(fields) > 0:
            context = interpretRequest(request, fields[0])
            username = context.geek
            (plays, messages, year, month, day,
             args) = context.substrate.getPlaysForDescribedRange(fields[1:])
            links = []
            totals = "totals" in args
            florence = "florence" in args
            if not florence:
                if day is not None:
                    # month link
                    url = playsLink(totals, context.geek, year, month)
                    links.append(Link(url, "Plays for Month"))
                if month is not None:
                    # year link
                    url = playsLink(totals, context.geek, year)
                    links.append(Link(url, "Plays for Year"))
                    # all plays for user
                url = playsLink(totals, context.geek)
                links.append(Link(url, "All Plays for %s" % context.geek))
                if totals:
                    url = playsLink(False, context.geek, year, month, day)
                    links.append(Link(url, "Plays for this period"))
                else:
                    url = playsLink(True, context.geek, year, month, day)
                    links.append(Link(url, "Totals for this period"))
            if totals:
                plays = generate.collatePlays(plays)
                generate.addGeekData(context.geek, plays)
                return webserver.render("stats/totalplays.html", locals(),
                                        request)
            elif florence:
                data = generate.florenceData(plays)
                img = imggen.createFlorenceDiagram(context.geek, data)
                return library.imageResponse(img)
            generate.addGeekData(context.geek, plays)
            return webserver.render("stats/plays.html", locals(), request)
        else:
            return webserver.render("stats/badurl.html", {}, request)
    except library.NoSuchGeekException:
        return webserver.render("stats/geek_error.html", locals(), request)
Exemplo n.º 13
0
def plays(request, param):
    import library
    try:
        fields = param.split("/")
        if len(fields) > 0:
            context = interpretRequest(request, fields[0])
            username = context.geek
            (plays, messages, year, month, day, args) = context.substrate.getPlaysForDescribedRange(fields[1:])
            links = []
            totals = "totals" in args
            florence = "florence" in args
            if not florence:
                if day is not None:
                    # month link
                    url = playsLink(totals, context.geek, year, month)
                    links.append(Link(url, "Plays for Month"))
                if month is not None:
                    # year link
                    url = playsLink(totals, context.geek, year)
                    links.append(Link(url, "Plays for Year"))
                    # all plays for user
                url = playsLink(totals, context.geek)
                links.append(Link(url, "All Plays for %s" % context.geek))
                if totals:
                    url = playsLink(False, context.geek, year, month, day)
                    links.append(Link(url, "Plays for this period"))
                else:
                    url = playsLink(True, context.geek, year, month, day)
                    links.append(Link(url, "Totals for this period"))
            if totals:
                plays = generate.collatePlays(plays)
                generate.addGeekData(context.geek, plays)
                return webserver.render("stats/totalplays.html", locals(), request)
            elif florence:
                data = generate.florenceData(plays)
                img = imggen.createFlorenceDiagram(context.geek, data)
                return library.imageResponse(img)
            generate.addGeekData(context.geek, plays)
            return webserver.render("stats/plays.html", locals(), request)
        else:
            return webserver.render("stats/badurl.html", {}, request)
    except library.NoSuchGeekException:
        return webserver.render("stats/geek_error.html", locals(), request)