commit 020dab5be80fc97f800391ee23890daf9a6e6b80
parent d930aeabd24a56c6a550ca4c7dee53c115b31412
Author: rbckman <rob@tarina.org>
Date: Thu, 18 Apr 2019 12:40:37 +0100
server updated to python3
Diffstat:
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/install.sh b/install.sh
@@ -44,7 +44,7 @@ apt-get -y install git python3-pip libav-tools mediainfo gpac omxplayer sox cpuf
echo "Getting the latest firmware for rpi..."
rpi-update
echo "installing python-omxplayer-wrapper..."
-pip3 install omxplayer-wrapper --upgrade
+pip3 install omxplayer-wrapper
echo "installing rwb27s openflexure microscope fork of picamera with lens shading correction..."
pip3 --no-cache-dir install https://github.com/rwb27/picamera/archive/lens-shading.zip --upgrade
echo "installing web.py for the tarina webserver..."
@@ -131,7 +131,7 @@ Conflicts=getty@tty1.service
[Service]
Type=simple
RemainAfterExit=yes
-ExecStart=/usr/bin/python /home/pi/tarina/tarina.py
+ExecStart=/usr/bin/python3 /home/pi/tarina/tarina.py
User=pi
Restart=on-failure
StandardInput=tty-force
diff --git a/srv/tarinaserver.py b/srv/tarinaserver.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
import web
import os
@@ -23,9 +23,23 @@ urls = (
render = web.template.render('templates/', base="base")
+def getfilms(filmfolder):
+ #get a list of films, in order of settings.p file last modified
+ films_sorted = []
+ films = next(os.walk(filmfolder))[1]
+ for i in films:
+ if os.path.isfile(filmfolder + i + '/' + 'settings.p') == True:
+ lastupdate = os.path.getmtime(filmfolder + i + '/' + 'settings.p')
+ films_sorted.append((i,lastupdate))
+ else:
+ films_sorted.append((i,0))
+ films_sorted = sorted(films_sorted, key=lambda tup: tup[1], reverse=True)
+ print(films_sorted)
+ return films_sorted
+
class index:
def GET(self):
- films = os.walk('static/Videos/').next()[1]
+ films = getfilms(filmfolder)
renderedfilms = []
unrenderedfilms = []
for i in films: