bug in index code

master
Michael Murtaugh 7 years ago
parent c9c498e5dd
commit 16dc5c7dba

@ -7,27 +7,31 @@ from jinja2 import Template
# Directory => ITEMS list (all files with a timestamp name, grouped) # Directory => ITEMS list (all files with a timestamp name, grouped)
path = "/var/www/static/gait" path = "/var/www/static/gait"
try: try:
ff = os.listdir(path) ff = os.listdir(path)
except OSError: except OSError:
ff = [] ff = []
tpat = re.compile(r"^(\d\d\d\d)-(\d\d)-(\d\d)-(\d\d)-(\d\d)-(\d\d)") tpat = re.compile(r"^(\d\d\d\d)-(\d\d)-(\d\d)-(\d\d)-(\d\d)-(\d\d)")
items = {} items = {}
for f in ff: for f in ff:
base, ext = os.path.splitext(f) base, ext = os.path.splitext(f)
ext = ext[1:] ext = ext[1:]
m = tpat.match(f) m = tpat.match(f)
if m: if m:
t = m.group(0) t = m.group(0)
if t not in items: if t not in items:
items[t] = {} items[t] = {}
items[t][ext] = f items[t][ext] = f
items = [items[key] for key in sorted(items, reverse=True)] items = [items[key] for key in sorted(items, reverse=True)]
for i in items[10:]: for i in items[10:]:
for f in i.items(): for f in i.items():
print "deleting ", f for ext in f:
fp = os.path.join(path, f) fp = os.path.join(path, f[ext])
os.unlink(fp) try:
os.unlink(fp)
except IOError as e:
print ("Error deleting", e)
pass
# dump the data (debugging) # dump the data (debugging)
# print "Content-type: text/plain" # print "Content-type: text/plain"
# print "" # print ""
@ -43,37 +47,37 @@ print Template(u"""<html>
<link rel="stylesheet" type="text/css" href="../styles/main.css"> <link rel="stylesheet" type="text/css" href="../styles/main.css">
</head> </head>
<body> <body>
<div id="wrappper"> <div id="wrappper">
<header> <header>
<img src="../images/headertr3.png" width="100%"/> <img src="../images/headertr3.png" width="100%"/>
</header> </header>
<div class="firstline"> <div class="firstline">
<p> Here you can find footage of your walks.</p> <p> Here you can find footage of your walks.</p>
</div> </div>
<img src="../images/camera.png" /> <img src="../images/camera.png" />
<div class="secondline"> <div class="secondline">
<p> Steal a walk from another person's video. Download it. </p> <p> Steal a walk from another person's video. Download it. </p>
</div> </div>
<div class="thirdline"> <div class="thirdline">
<p> Promise me, you're gonna start using this walk for the rest of the day. </p> <p> Promise me, you're gonna start using this walk for the rest of the day. </p>
</div> </div>
<img src="../images/cover.png" /> <img src="../images/cover.png" />
<div class="movies"> <div class="movies">
{% for i in items %} {% for i in items %}
<a href="/static/gait/{{i.mp4}}"><img src="/static/gait/{{i.jpg}}" /></a> <a href="/static/gait/{{i.mp4}}"><img src="/static/gait/{{i.jpg}}" /></a>
<p>{{i.mp4}}</p> <p>{{i.mp4}}</p>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
</body> </body>
</html>""").render(items=items).encode("utf-8") </html>""").render(items=items).encode("utf-8")

@ -1,66 +1,119 @@
<!DOCTYPE html>
<html> <html>
<head>
<title></title> <head>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <title> Rock Step - Triple Step - Triple Step </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<style>
body { <style>
margin-left: 20;
margin-right: 20; body {
padding: 0; margin-left: 0;
color: grey; margin-right: 0;
} padding: 0;
max-width: 800px;
form.buttons { }
} h1 {
font-family: sans-serif, Avenir, 'Poiret One' ;
form.buttons input { font: 8px;
width: 150px; /* font size and typeface not working */
height: 150px; text-align: center;
/*hide the labels*/ text-transform: capitalize;
font-size: 0; color: rgb(61, 61, 92);
line-height: 0; }
border: 0;
margin: ; /*
} .responsive {
</style> padding: 0px;
float: left;
</head> width: 12.5%;
<body> }
<form action="cgi-bin/play.cgi" class="buttons"> @media only screen and (max-width: 700px){
<input type="submit" name="p" value="BasicTurn.mp3" style="background:url(images/choreology1-BasicTurn.svg) no-repeat;" /> .responsive {
<input type="submit" name="p" value="Follow.mp3" style="background:url(images/choreology2-Follow.svg) no-repeat;" /> width: 24.99999%;
<br> margin: 6px 0;
<input type="submit" name="p" value="AmericanSpin.mp3" style="background:url(images/choreology3-AmericanSpin.svg) no-repeat;" /> }
<input type="submit" name="p" value="Bump.mp3" style="background:url(images/choreology4-Bump.svg) no-repeat;" /> }
<br>
<input type="submit" name="p" value="StopAndGo.mp3" style="background:url(images/choreology5-StopAndGo.svg) no-repeat;" /> @media only screen and (max-width: 320px){
<input type="submit" name="p" value="Windmill.mp3" style="background:url(images/choreology6-Windmill.svg) no-repeat;" /> .responsive {
<br> width: 50%;
<input type="submit" name="p" value="SpanishArms.mp3" style="background:url(images/choreology7-SpanishArms.svg) no-repeat;" /> }
<input type="submit" name="p" value="Hucklebuck.mp3" style="background:url(images/choreology8-Hucklebuck.svg) no-repeat;" /> }
<br> */
<!--"Whip" of "The Whip" options - needs testing with music playing in the background
<input type="submit" name="p" value="TheWhip.mp3" style="background:url(images/choreology9-Whip.svg) no-repeat;" /> form.buttons {
-->
<input type="submit" name="p" value="Whip.mp3" style="background:url(images/choreology9-Whip.svg) no-repeat;" /> }
<input type="submit" name="p" value="ChickenWalks.mp3" style="background:url(images/choreology10-ChickenWalks.svg) no-repeat;" />
<div class="tempo"> form.buttons input {
<br> width: 150px;
<br> height: 150px;
<br> /*hide the labels*/
<input id="slider3" type="range" min ="100" max="180" step ="1" style="width: 640px" /> font-size: 0;
<!-- <input id="slider3" type="range" min ="100" max="180" step ="1" orient="vertical" style="-webkit-appearance: slider-vertical; writing-mode: bt-lr" /> line-height: 0;
--> border: 0;
</div> margin: 0;
padding: 0;
</form> }
</style>
</head>
</body>
<body>
<!--
/* For devices smaller than 400px: */
body {
background-image: url('img_smallflower.jpg');
}
/* For devices 400px and larger: */
@media only screen and (min-device-width: 400px) {
body {
background-image: url('img_flowers.jpg');
}
}
-->
<h1> rock step - triple step - triple step </h1>
<br>
<br>
<form action="cgi-bin/play.cgi" class="buttons">
<input type="submit" name="p" value="BasicTurn.mp3" style="background:url(images/choreology1-BasicTurn.svg) no-repeat;" />
<input type="submit" name="p" value="Follow.mp3" style="background:url(images/choreology2-Follow.svg) no-repeat;" />
<input type="submit" name="p" value="AmericanSpin.mp3" style="background:url(images/choreology3-AmericanSpin.svg) no-repeat;" />
<input type="submit" name="p" value="Bump.mp3" style="background:url(images/choreology4-Bump.svg) no-repeat;" />
<input type="submit" name="p" value="StopAndGo.mp3" style="background:url(images/choreology5-StopAndGo.svg) no-repeat;" />
<input type="submit" name="p" value="Windmill.mp3" style="background:url(images/choreology6-Windmill.svg) no-repeat;" />
<input type="submit" name="p" value="SpanishArms.mp3" style="background:url(images/choreology7-SpanishArms.svg) no-repeat;" />
<input type="submit" name="p" value="Hucklebuck.mp3" style="background:url(images/choreology8-Hucklebuck.svg) no-repeat;" />
<!-- "Whip" of "The Whip" options - needs testing with music playing in the background
<input type="submit" name="p" value="TheWhip.mp3" style="background:url(images/choreology9-Whip.svg) no-repeat;" />
-->
<input type="submit" name="p" value="Whip.mp3" style="background:url(images/choreology9-Whip.svg) no-repeat;" />
<input type="submit" name="p" value="ChickenWalks.mp3" style="background:url(images/choreology10-ChickenWalks.svg) no-repeat;" />
<div class="tempo">
<br>
<br>
<br>
<!-- no slider for the launch day
<input id="slider3" type="range" min ="100" max="180" step ="1" style="width: 640px" />
<input id="slider3" type="range" min ="100" max="180" step ="1" orient="vertical" style="-webkit-appearance: slider-vertical; writing-mode: bt-lr" />
-->
</div>
</form>
</body>
</html> </html>
@ -68,3 +121,11 @@

Loading…
Cancel
Save