summaryrefslogtreecommitdiff
path: root/nop/views.py
diff options
context:
space:
mode:
authorJohannes Raggam <raggam-nl@adm.at>2011-05-10 15:50:39 (GMT)
committerJohannes Raggam <raggam-nl@adm.at>2011-05-10 15:50:39 (GMT)
commita351418394efd238daf89502fe3e8fd2c8bbe153 (patch)
treef397928ce3ff5f1f5912c65dde493763b937cf1f /nop/views.py
parente564b923dfcb7a65df89f39297ef0ca3dc5e09a0 (diff)
add nop initial app
Diffstat (limited to 'nop/views.py')
-rw-r--r--nop/views.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/nop/views.py b/nop/views.py
new file mode 100644
index 0000000..6fec3a3
--- /dev/null
+++ b/nop/views.py
@@ -0,0 +1,26 @@
+from django.http import HttpResponse
+from models import Master
+import json
+#import time
+#from datetime import date, datetime, time, timedelta
+
+def get_current(request):
+
+ #current = int(time.time())*1000000
+ #time.gmtime(Master.objects.using('nop').all()[6000].timestamp//1000000)
+ # select all where timestamp < givenTS, get most recent one -> order DESC
+
+ # reverse sorted. get the first object = last played
+ result = Master.objects.using('nop').all()[0]
+ response = json.dumps({'artist': result.artist, 'title': result.title})
+
+ #return HttpResponse(response, mimetype='application/json')
+ return HttpResponse(response, mimetype='text/plain')
+
+def get(request, year=None, month=None, day=None, hour=None, minute=None):
+ #if year is None and month is None and day is None:
+ # today = datetime.combine(date.today(), time(6, 0))
+ #else:
+ # today = datetime.strptime('%s__%s__%s__06__00' % (year, month, day), '%Y__%m__%d__%H__%M')
+ return None
+