Browse Source

Resolve indetation issue

master
Luke Murphy 5 years ago
parent
commit
2435c49968
No known key found for this signature in database GPG Key ID: 5E2EF5A63E3718CC
  1. 26
      stream/stream.py

26
stream/stream.py

@ -7,20 +7,20 @@ import time
from datetime import datetime from datetime import datetime
def getCreationTime(img): def getCreationTime(img):
creationtime = time.ctime(path.getctime(img)) creationtime = time.ctime(path.getctime(img))
date = datetime(creationtime).strftime('%y%m%d') date = datetime(creationtime).strftime('%y%m%d')
print('creationtime', date) print('creationtime', date)
return date return date
def getStream(generator): def getStream(generator):
for page in generator.pages: for page in generator.pages:
dir = "/var/www/stream" dir = "/var/www/stream"
if path.exists(dir): if path.exists(dir):
images = [(getCreationTime(dir+'/'+f), f) for f in listdir(dir) if path.isfile(path.join(dir, f))] images = [(getCreationTime(dir+'/'+f), f) for f in listdir(dir) if path.isfile(path.join(dir, f))]
else: # if the website is generated locally else: # if the website is generated locally
images = ['placeholder.png'] images = ['placeholder.png']
print('>>> The stream is streaming!', images) print('>>> The stream is streaming!', images)
page.stream = images page.stream = images
def register(): def register():
signals.page_generator_finalized.connect(getStream) signals.page_generator_finalized.connect(getStream)

Loading…
Cancel
Save