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)
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"""<html>
<link rel="stylesheet" type="text/css" href="../styles/main.css">
</head>
<body>
<div id="wrappper">
<header>
<img src="../images/headertr3.png" width="100%"/>
</header>
<div id="wrappper">
<header>
<img src="../images/headertr3.png" width="100%"/>
</header>
<div class="firstline">
<p> Here you can find footage of your walks.</p>
</div>
<div class="firstline">
<p> Here you can find footage of your walks.</p>
</div>
<img src="../images/camera.png" />
<div class="secondline">
<p> Steal a walk from another person's video. Download it. </p>
</div>
<img src="../images/camera.png" />
<div class="secondline">
<p> Steal a walk from another person's video. Download it. </p>
</div>
<div class="thirdline">
<p> Promise me, you're gonna start using this walk for the rest of the day. </p>
</div>
<div class="thirdline">
<p> Promise me, you're gonna start using this walk for the rest of the day. </p>
</div>
<img src="../images/cover.png" />
<img src="../images/cover.png" />
<div class="movies">
{% for i in items %}
<a href="/static/gait/{{i.mp4}}"><img src="/static/gait/{{i.jpg}}" /></a>
<p>{{i.mp4}}</p>
{% endfor %}
</div>
<div class="movies">
{% for i in items %}
<a href="/static/gait/{{i.mp4}}"><img src="/static/gait/{{i.jpg}}" /></a>
<p>{{i.mp4}}</p>
{% endfor %}
</div>
</div>
</div>
</body>
</html>""").render(items=items).encode("utf-8")

@ -1,66 +1,119 @@
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<style>
body {
margin-left: 20;
margin-right: 20;
padding: 0;
color: grey;
}
form.buttons {
}
form.buttons input {
width: 150px;
height: 150px;
/*hide the labels*/
font-size: 0;
line-height: 0;
border: 0;
margin: ;
}
</style>
</head>
<body>
<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;" />
<br>
<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;" />
<input type="submit" name="p" value="Windmill.mp3" style="background:url(images/choreology6-Windmill.svg) no-repeat;" />
<br>
<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;" />
-->
<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>
<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>
<head>
<title> Rock Step - Triple Step - Triple Step </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<style>
body {
margin-left: 0;
margin-right: 0;
padding: 0;
max-width: 800px;
}
h1 {
font-family: sans-serif, Avenir, 'Poiret One' ;
font: 8px;
/* font size and typeface not working */
text-align: center;
text-transform: capitalize;
color: rgb(61, 61, 92);
}
/*
.responsive {
padding: 0px;
float: left;
width: 12.5%;
}
@media only screen and (max-width: 700px){
.responsive {
width: 24.99999%;
margin: 6px 0;
}
}
@media only screen and (max-width: 320px){
.responsive {
width: 50%;
}
}
*/
form.buttons {
}
form.buttons input {
width: 150px;
height: 150px;
/*hide the labels*/
font-size: 0;
line-height: 0;
border: 0;
margin: 0;
padding: 0;
}
</style>
</head>
<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>
@ -68,3 +121,11 @@

Loading…
Cancel
Save