def get_chart(id, url): sources = details.getSources(request) source = sources.get(id, None) if source is None: return make_response("No such source", 404) url = urllib.unquote_plus(url) chart = source.get_chart(url) if chart is None: return make_response("No such chart", 404) response = make_response(jsonify(chart)) response = cache.appendCacheHeader(source, response) return response
print "Source error: %s" % e # No geo in rdio, pre 0.6.99 if not details.backwardComp(request.args) and "rdio" in id: charts = details.filterChart({"geo" : "US", "version" : request.args.get("version")}, charts); # filter? charts = details.filterChart(request.args, charts); # Append details? detailed = details.getDetail(request, id); if detailed: charts.update(detailed); response = make_response(jsonify(charts)) response = cache.appendCacheHeader(source, response) return response @charts.route('/charts/<id>/<regex(".*"):url>') def get_chart(id, url): sources = details.getSources(request) source = sources.get(id, None) if source is None: return make_response("No such source", 404) url = urllib.unquote_plus(url) chart = source.get_chart(url) if chart is None:
charts = details.filterChart( { "geo": "US", "version": request.args.get("version") }, charts) # filter? charts = details.filterChart(request.args, charts) # Append details? detailed = details.getDetail(request, id) if detailed: charts.update(detailed) response = make_response(jsonify(charts)) response = cache.appendCacheHeader(source, response) return response @charts.route('/charts/<id>/<regex(".*"):url>') def get_chart(id, url): sources = details.getSources(request) source = sources.get(id, None) if source is None: return make_response("No such source", 404) url = urllib.unquote_plus(url) chart = source.get_chart(url)