diff options
author | Ctibor <ctibor@brancik.cz> | 2017-03-23 13:03:55 +0100 |
---|---|---|
committer | Ctibor <ctibor@brancik.cz> | 2017-03-23 13:03:55 +0100 |
commit | e38a1dc80098746f20a20a8220e6d96cef2620b6 (patch) | |
tree | cec8fa44e7b22fdf3cc8c039980fa39ea85cef17 /cgi-bin | |
parent | fdd95d33ab7b951b907497d3e2ae2fc862a49259 (diff) | |
download | hnizdo-e38a1dc80098746f20a20a8220e6d96cef2620b6.tar.gz hnizdo-e38a1dc80098746f20a20a8220e6d96cef2620b6.tar.bz2 |
Add method to return first image in sequence
Diffstat (limited to 'cgi-bin')
-rw-r--r-- | cgi-bin/link.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cgi-bin/link.py b/cgi-bin/link.py index 6075ea2..2fe8973 100644 --- a/cgi-bin/link.py +++ b/cgi-bin/link.py @@ -1,5 +1,5 @@ # -*- coding: utf8 -*- -import os.path, datetime, config +import os, datetime, config class Link: def __init__(self, filename=""): @@ -54,6 +54,14 @@ class Link: else: #print os.path.realpath(filename) return False + + def first(self): + index=os.listdir(os.path.realpath(self.datadir)) + remove=('latest.jpeg', 'notfound.jpeg') + for r in remove: + index.remove(r) + index.sort() + return index[0] def link(self, target, link): #print target |