From 16dc5c7dba44be044dd79934ff104b16a6cf1f17 Mon Sep 17 00:00:00 2001 From: Michael Murtaugh Date: Fri, 24 Mar 2017 16:14:21 +0100 Subject: [PATCH] bug in index code --- floppies/giulia/noweb/cgi-bin/index.cgi | 80 +++++----- floppies/karina2/noweb/index.html | 185 ++++++++++++++++-------- 2 files changed, 165 insertions(+), 100 deletions(-) diff --git a/floppies/giulia/noweb/cgi-bin/index.cgi b/floppies/giulia/noweb/cgi-bin/index.cgi index 869c3b7..66ff565 100755 --- a/floppies/giulia/noweb/cgi-bin/index.cgi +++ b/floppies/giulia/noweb/cgi-bin/index.cgi @@ -7,27 +7,31 @@ from jinja2 import Template # Directory => ITEMS list (all files with a timestamp name, grouped) path = "/var/www/static/gait" try: - ff = os.listdir(path) + ff = os.listdir(path) except OSError: - ff = [] + ff = [] tpat = re.compile(r"^(\d\d\d\d)-(\d\d)-(\d\d)-(\d\d)-(\d\d)-(\d\d)") items = {} for f in ff: - base, ext = os.path.splitext(f) - ext = ext[1:] - m = tpat.match(f) - if m: - t = m.group(0) - if t not in items: - items[t] = {} - items[t][ext] = f + base, ext = os.path.splitext(f) + ext = ext[1:] + m = tpat.match(f) + if m: + t = m.group(0) + if t not in items: + items[t] = {} + items[t][ext] = f items = [items[key] for key in sorted(items, reverse=True)] for i in items[10:]: - for f in i.items(): - print "deleting ", f - fp = os.path.join(path, f) - os.unlink(fp) + for f in i.items(): + for ext in f: + fp = os.path.join(path, f[ext]) + try: + os.unlink(fp) + except IOError as e: + print ("Error deleting", e) + pass # dump the data (debugging) # print "Content-type: text/plain" # print "" @@ -43,37 +47,37 @@ print Template(u""" -
- -
- -
+
+ +
+ +
-
-

Here you can find footage of your walks.

-
+
+

Here you can find footage of your walks.

+
- - -
-

Steal a walk from another person's video. Download it.

-
+ + +
+

Steal a walk from another person's video. Download it.

+
-
-

Promise me, you're gonna start using this walk for the rest of the day.

-
+
+

Promise me, you're gonna start using this walk for the rest of the day.

+
- + -
- {% for i in items %} - -

{{i.mp4}}

- {% endfor %} -
+
+ {% for i in items %} + +

{{i.mp4}}

+ {% endfor %} +
-
+
""").render(items=items).encode("utf-8") \ No newline at end of file diff --git a/floppies/karina2/noweb/index.html b/floppies/karina2/noweb/index.html index ba4ae6c..3614ec0 100644 --- a/floppies/karina2/noweb/index.html +++ b/floppies/karina2/noweb/index.html @@ -1,66 +1,119 @@ + - - - - - - - - - -
- - -
- - -
- - -
- - -
- - - -
-
-
-
- - -
- -
- - - + + + Rock Step - Triple Step - Triple Step + + + + + + + + + +

rock step - triple step - triple step

+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ +
+ +
+ + + + @@ -68,3 +121,11 @@ + + + + + + + +