def wordcloud(request): eStats = EvernoteStatistics(request.user.profile) t = eStats.get_first_note_timestamp() notebooks = eStats.get_guid_map(notebookNames=True, tagNames=False).items() tags = eStats.get_guid_map(notebookNames=False, tagNames=True).items() return render_to_response('wordcloud.html', {'firstNote': t, 'EVERNOTE_HOST': settings.EVERNOTE_HOST, 'notebooks': notebooks, 'tags': tags}, context_instance=RequestContext(request))
def trends(request): eStats = EvernoteStatistics(request.user.profile) try: t = eStats.get_first_note_timestamp() #If we get an error while looking up a user's data send back to login except evernoteError.EDAMUserException: logout(request) return HttpResponseRedirect(reverse('account.views.login_page', args=[])) notebooks = eStats.get_guid_map(notebookNames=True, tagNames=False).items() tags = eStats.get_guid_map(notebookNames=False, tagNames=True).items() return render_to_response('trends.html', {'firstNote': t, 'notebooks': notebooks, 'tags': tags}, context_instance=RequestContext(request))
def notebook_count_json(request): if request.method == 'GET': GET = request.GET if GET.has_key('sDate') and GET.has_key('eDate'): eStats = EvernoteStatistics(request.user.profile) startDate = date.fromtimestamp(float(GET['sDate'])/1000) endDate = date.fromtimestamp(float(GET['eDate'])/1000) filt = eStats.create_date_filter(startDate, endDate) qStats = eStats.get_quick_stats(filt) if qStats is None: return HttpResponse({},content_type='application/json') guidToNameMap = eStats.get_guid_map(notebookNames=True) noteFrequency = qStats['notebookCounts'] notebookArray = [[k,v] for k,v in noteFrequency.iteritems()] jsonText = json.dumps({'keyToDisplayMap': guidToNameMap, 'noteArray': notebookArray, 'displayObjectName': 'Notebook', 'evernoteSearchParam' : 'b'}) return HttpResponse(jsonText,content_type='application/json')