summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2010-03-26 15:46:15 -0400
committerJason A. Donenfeld <Jason@zx2c4.com>2010-03-26 15:46:15 -0400
commitb33b05ff8348a5eb00863d0b56f909cfe2dbbb0c (patch)
tree2d9fe3f1569bc25d1b6082db3c970281662263d9
parentDon't store names. Add backoffice api file. (diff)
downloadMomentSelector-b33b05ff8348a5eb00863d0b56f909cfe2dbbb0c.tar.xz
MomentSelector-b33b05ff8348a5eb00863d0b56f909cfe2dbbb0c.zip
Submit moments to api on cron job.
-rw-r--r--server-handler/app.yaml4
-rw-r--r--server-handler/cron.yaml6
-rwxr-xr-xserver-handler/momentselector.py7
3 files changed, 14 insertions, 3 deletions
diff --git a/server-handler/app.yaml b/server-handler/app.yaml
index b802bdd..35bde38 100644
--- a/server-handler/app.yaml
+++ b/server-handler/app.yaml
@@ -30,12 +30,12 @@ handlers:
- url: /adminrequest
script: momentselector.py
- login: required
+ login: admin
- url: /admin
static_files: admin.html
upload: admin.html
- login: required
+ login: admin
- url: /debugger
login: admin
diff --git a/server-handler/cron.yaml b/server-handler/cron.yaml
index ce6568a..3fc396c 100644
--- a/server-handler/cron.yaml
+++ b/server-handler/cron.yaml
@@ -1,4 +1,8 @@
cron:
- description: Load new titles from AnyClip
url: /loadnewtitles
- schedule: every 12 hours \ No newline at end of file
+ schedule: every 12 hours
+
+- description: Load new moments into DB
+ url: /adminrequest?action=submitAllMoments
+ schedule: every 5 hours \ No newline at end of file
diff --git a/server-handler/momentselector.py b/server-handler/momentselector.py
index 9f3a92a..baae7c3 100755
--- a/server-handler/momentselector.py
+++ b/server-handler/momentselector.py
@@ -155,6 +155,13 @@ class UpdateMomentCount(webapp.RequestHandler):
class Debugger(webapp.RequestHandler):
def get(self):
+ titles = set()
+ unsubmittedMoments = Moment.all().filter('submittedToAPI = ', False)
+ for moment in unsubmittedMoments:
+ titles.add(moment.title.title)
+ for title in titles:
+ self.response.out.write("%s<br>" % title)
+ return
me = Request()
self.response.out.write("Url: %s<br>lastLevel: %s<br>splitPoint: %s<br><br>" % (me.getRandomUrl(1), me.lastLevel, me.splitPoint))
self.response.out.write("Url: %s<br>lastLevel: %s<br>splitPoint: %s<br><br>" % (me.getRandomUrl(2), me.lastLevel, me.splitPoint))