summaryrefslogtreecommitdiff
path: root/cgi-bin/display.py
diff options
context:
space:
mode:
authorCtibor Brančík <ctibor@brancik.cz>2017-03-25 20:00:11 +0100
committerCtibor Brančík <ctibor@brancik.cz>2017-03-25 20:00:11 +0100
commitb57ac7909e47fabe1c9ee41bd7901641fba18027 (patch)
treea97b1d13c7e92bd0508ef893188f42e09ac4304e /cgi-bin/display.py
parent7d9464c11122b512c77768d79be55f5830f9eea5 (diff)
downloadhnizdo-b57ac7909e47fabe1c9ee41bd7901641fba18027.tar.gz
hnizdo-b57ac7909e47fabe1c9ee41bd7901641fba18027.tar.bz2
Modify link.Link methods to abstract "*.jpeg" ext
Diffstat (limited to 'cgi-bin/display.py')
-rw-r--r--cgi-bin/display.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/cgi-bin/display.py b/cgi-bin/display.py
index 990158a..72d2589 100644
--- a/cgi-bin/display.py
+++ b/cgi-bin/display.py
@@ -1,5 +1,5 @@
# -*- coding: utf8 -*-
-import link, os, config
+import link, os, config, re
from datetime import datetime
class Body:
@@ -29,15 +29,15 @@ class Body:
print ("</nav>")
print ("</header>")
print ("<article id=\"prev\">")
- print (self.a.imglink(self.a.delta('+m'),'prev'))
+ print (self.a.imglink(self.a.delta('+m'), '180', 'prev'))
print ("<p>"+self.a.timestamp(self.a.delta('+m'))+"</p>")
print ("</article>")
print ("<article id=\"now\">")
- print (self.a.imglink(self.a.img, 'now'))
+ print (self.a.imglink(self.a.img, '440', 'now'))
print ("<p>"+self.a.timestamp(self.a.img)+"</p>")
print ("</article>")
print ("<article id=\"next\">")
- print (self.a.imglink(self.a.delta('-m'), 'next'))
+ print (self.a.imglink(self.a.delta('-m'), '180', 'next'))
print ("<p>"+self.a.timestamp(self.a.delta('-m'))+"</p>")
print ("</article>")
print ("<footer>")
@@ -47,9 +47,15 @@ class Body:
def index(self, page):
index=os.listdir(os.path.realpath(self.datadir))
remove=("latest.jpeg", "notfound.jpeg")
+ #print index
+ for p in index[:]:
+ if re.match("[0-9]{12}-(180|440).jpeg", p):
+ index.remove(p)
for r in remove:
index.remove(r)
+ #print index
index.sort()
+ #print index
count=len(index)
pnum=count/config.pagination+1
if int(page) > int(pnum):
@@ -73,8 +79,8 @@ class Body:
while f <= rngend and f <= count-1:
#print f
print("<li>")
- print(self.a.imglink(index[f], ""))
- print("<p>"+self.a.link(index[f], self.a.timestamp(index[f]))+"</p>")
+ print(self.a.imglink(index[f][:12], "180"))
+ print("<p>"+self.a.link(index[f][:12], self.a.timestamp(index[f][:12]))+"</p>")
print("</li>")
f = f + 1
print ("</ul>")