tarina

git clone https://git.tarina.org/tarina
Log | Files | Refs | README | LICENSE

commit 78594fac590792a869e3fc2da948feafe9e026d0
parent 5ffd19e0c722ed53bf3d1db51d3c483dcaf1fc53
Author: rbckman <rob@tarina.org>
Date:   Thu, 18 Mar 2021 00:22:11 +0000

tarina server scene page

Diffstat:
Msrv/tarinaserver.py | 51+++++++++++++++++++++++++++++++++++++++++++++++++--
Msrv/templates/filmpage.html | 9+++++++--
Msrv/templates/index.html | 2+-
3 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/srv/tarinaserver.py b/srv/tarinaserver.py @@ -18,7 +18,7 @@ films = [] urls = ( '/', 'index', - '/f/(.*)', 'films' + '/f/(.*)?', 'films' ) app = web.application(urls, globals()) @@ -38,6 +38,48 @@ def getfilms(filmfolder): print(films_sorted) return films_sorted +#------------Count scenes-------- + +def countscenes(filmfolder, filmname): + scenes = 0 + try: + allfiles = os.listdir(filmfolder + filmname) + except: + allfiles = [] + scenes = 0 + for a in allfiles: + if 'scene' in a: + scenes = scenes + 1 + return scenes + +#------------Count shots-------- + +def countshots(filmname, filmfolder, scene): + shots = 0 + try: + allfiles = os.listdir(filmfolder + filmname + '/scene' + str(scene).zfill(3)) + except: + allfiles = [] + shots = 0 + for a in allfiles: + if 'shot' in a: + shots = shots + 1 + return shots + +#------------Count takes-------- + +def counttakes(filmname, filmfolder, scene, shot): + takes = 0 + try: + allfiles = os.listdir(filmfolder + filmname + '/scene' + str(scene).zfill(3) + '/shot' + str(shot).zfill(3)) + except: + allfiles = [] + return takes + for a in allfiles: + if '.mp4' in a or '.h264' in a: + takes = takes + 1 + return takes + class index: def GET(self): films = getfilms(filmfolder) @@ -52,7 +94,12 @@ class index: class films: def GET(self, film): - return render.filmpage(film) + shots = 0 + i = web.input(page=None, scene=None, shot=None) + if i.scene != None: + shots = countshots(film, filmfolder, i.scene) + scenes = countscenes(filmfolder, film) + return render.filmpage(film, scenes, str, filmfolder, counttakes, shots) application = app.wsgifunc() diff --git a/srv/templates/filmpage.html b/srv/templates/filmpage.html @@ -1,5 +1,5 @@ -$def with (film) - +$def with (film, scenes, str, filmfolder, counttakes, shots) +$ s = 0 <h1>$film</h1> <p>--------------------------------------------------------------</p> @@ -10,3 +10,8 @@ $def with (film) <p>Copy project to your destination:</p> <pre>scp -r pi@tarina.local:~/Videos/$film ~/films/$film </pre> +$for s in range(scenes): + $ s += 1 + $ t = counttakes(film, filmfolder, 1, 1) + $ thumbnail_url = '/static/Videos/' + film + '/scene' + str(s).zfill(3) + '/shot001/take001.jpeg' + <a href="?scene=$s"><img width="80%" src="$thumbnail_url"/></a><br> diff --git a/srv/templates/index.html b/srv/templates/index.html @@ -2,7 +2,7 @@ $def with (renderedfilms, unrenderedfilms) $var renderedfilms = renderedfilms $var unrenderedfilms = unrenderedfilms -<h1>Films</h1> +<h1>FILMS</h1> $for i in renderedfilms: <p>--------------------------------------------------------------</p>