commit 2697498ad7dc0a104aa42b2f43b3080c74d7dd28
parent 5818177d001925ab892719011206a377dc8802e0
Author: rob <rob@tarina.org>
Date: Tue, 5 Mar 2024 11:08:59 +0000
select films
Diffstat:
3 files changed, 77 insertions(+), 45 deletions(-)
diff --git a/srv/gonzopiserver.py b/srv/gonzopiserver.py
@@ -139,8 +139,6 @@ def getfilms(filmfolder):
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
@@ -187,17 +185,37 @@ def counttakes(filmname, filmfolder, scene, shot):
takes = takes + 1
return takes
+def checkpicture(thumbdir,scene,shot,take):
+ if os.path.isfile(thumbdir) == False:
+ return "/"+filmfolder+name+"/scene"+str(scene).zfill(3)+"/shot"+str(shot).zfill(3)+"/picture"+str(take).zfill(3)+".jpeg"
+ else:
+ return ''
+
+def checkvideo(video,filmfolder,film,scene,shot,take):
+ print(basedir+video+'fuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuck')
+ if os.path.islink(basedir+video) == False:
+ p = "/"+filmfolder+film+"/scene"+str(scene).zfill(3)+"/shot"+str(shot).zfill(3)+"/picture"+str(take).zfill(3)+".jpeg"
+ if os.path.isfile(basedir+p) == False:
+ return 'render'
+ else:
+ return p
+ else:
+ return 'video'
+
class index:
def GET(self):
global recording
films = getfilms(filmfolder)
renderedfilms = []
unrenderedfilms = []
+ allfilms = []
for f in films:
if os.path.isfile(filmfolder + f[0] + '/' + f[0] + '.mp4') == True:
renderedfilms.append(f[0])
+ allfilms.append(f[0])
else:
unrenderedfilms.append(f[0])
+ allfilms.append(f[0])
i=web.input(func=None,selected=None)
if i.selected != None:
sendtocamera(ip,port,'SELECTED:'+i.selected)
@@ -268,25 +286,36 @@ class index:
time.sleep(1)
session.reload = 1
raise web.seeother('/')
- thumb=filmfolder+name+"/scene"+str(scene).zfill(3)+"/shot"+str(shot).zfill(3)+"/picture"+str(take).zfill(3)+".jpeg"
+ thumb="/"+filmfolder+name+"/scene"+str(scene).zfill(3)+"/shot"+str(shot).zfill(3)+"/picture"+str(take).zfill(3)+".jpeg"
print(thumb)
if os.path.isfile(basedir+thumb) == False:
print(basedir+thumb)
thumb=''
- return render.index(renderedfilms, unrenderedfilms, session.cameras, menu, selected,name,scene,shot,take,str,session.randhash,thumb,vumetermessage,i.func,filmfolder)
+ return render.index(allfilms, session.cameras, menu, selected,name,scene,shot,take,str,session.randhash,thumb,vumetermessage,i.func,filmfolder)
class films:
def GET(self, film):
shots = 0
takes = 0
- i = web.input(page=None, scene=None, shot=None, take=None)
+ gonzopifilms = getfilms(filmfolder)
+ renderedfilms = []
+ unrenderedfilms = []
+ allfilms = []
+ for f in gonzopifilms:
+ if os.path.isfile(filmfolder + f[0] + '/' + f[0] + '.mp4') == True:
+ renderedfilms.append(f[0])
+ allfilms.append(f[0])
+ else:
+ unrenderedfilms.append(f[0])
+ allfilms.append(f[0])
+ i = web.input(page=None, scene=None, shot=None, take=None, film=None)
if i.scene != None:
shots = countshots(film, filmfolder, i.scene)
takes = counttakes(film, filmfolder, i.scene, i.shot)
if i.scene != None and i.shot != None:
shots = countshots(film, filmfolder, i.scene)
scenes = countscenes(filmfolder, film)
- return render.filmpage(film, scenes, str, filmfolder, counttakes, countshots, shots, i.scene, takes, i.shot, i.take)
+ return render.filmpage(allfilms, film, scenes, str, filmfolder, counttakes, countshots, shots, i.scene, takes, i.shot, i.take, checkvideo)
application = app.wsgifunc()
diff --git a/srv/templates/filmpage.html b/srv/templates/filmpage.html
@@ -1,39 +1,56 @@
-$def with (film, scenes, str, filmfolder, counttakes, countshots, shots, scene, takes, shot, take)
+$def with (films, film, scenes, str, filmfolder, counttakes, countshots, shots, scene, takes, shot, take, checkvideo)
$ video = ''
$if take != None:
<h1>$film | scene $scene | shot $shot | take $take</h1>
- <h2><a href='?scene=$scene&shot=$shot'>go back</a></h2><br>
- $ video = '/static/Videos/' + film + '/scene' + str(scene).zfill(3) + '/shot' + str(shot).zfill(3) + '/take' + str(take).zfill(3) + '.mp4'
+ $ video = '/'+filmfolder + film + '/scene' + str(scene).zfill(3) + '/shot' + str(shot).zfill(3) + '/take' + str(take).zfill(3) + '.mp4'
$elif shot != None:
<h1>$film | scene $scene | shot $shot</h1>
- <h2><a href='?scene=$scene'>go back</a></h2><br>
- $ video = '/static/Videos/' + film + '/scene' + str(scene).zfill(3) + '/shot' + str(shot).zfill(3) + '/take' + str(takes).zfill(3) + '.mp4'
+ $ video = '/'+filmfolder + film + '/scene' + str(scene).zfill(3) + '/shot' + str(shot).zfill(3) + '/take' + str(takes).zfill(3) + '.mp4'
+ $ take = takes
$elif scene != None:
<h1>$film | scene $scene</h1>
- <h2><a href='/f/$film'>go back</a><h2><br>
- $ video = '/static/Videos/' + film + '/scene' + str(scene).zfill(3) + '/scene.mp4'
-$elif scene == None:
+ $ video = '/'+filmfolder + film + '/scene' + str(scene).zfill(3) + '/scene.mp4'
+$elif film != '':
<h1>$film</h1>
- $ video = '/static/Videos/' + film + '/' + film + '.mp4'
-<video width="80%" controls>
-<source src="$video" type="video/mp4">
-Your brower is caput
-</video>
-<p>Copy project to your destination:</p>
-<pre>scp -r pi@tarina.local:~/Videos/$film ~/films/$film </pre>
+ $ video = '/'+filmfolder + film + '/' + film + '.mp4'
+<br>
+<a href="javascript:history.back()">Go Back</a>
+<br>
+
+$ picture = checkvideo(video,filmfolder,film,scene,shot,take)
+$if picture == 'video':
+ <video width="80%" controls>
+ <source src="$video" style="width:80%; max-width:500px;" type="video/mp4">
+ Your brower is caput
+ </video>
+$elif picture == 'render':
+ <pre>render video</pre>
+$else:
+ <img style="width:80%;" src="$picture"/>
+
+$if film == '':
+ <h1>FILMS</h1>
+ $for i in films:
+ <a href="/f/$i"><h2>$i</h2></a>
+<br>
+
+$ t=0
$if shot != None:
$for t in range(takes):
- $ thumbnail_url = '/static/Videos/' + film + '/scene' + str(scene).zfill(3) + '/shot' + str(shot).zfill(3) + '/take' + str(t+1).zfill(3) + '.jpeg'
- <a href="?scene=$scene&shot=$shot&take=${str(t+1)}"><img width="80%" src="$thumbnail_url"/></a><br>
+ $ thumbnail_url = '/'+filmfolder + film + '/scene' + str(scene).zfill(3) + '/shot' + str(shot).zfill(3) + '/take' + str(t+1).zfill(3) + '.jpeg'
+ <pre>take $str(t+1)</pre>
+ <a href="?scene=$scene&shot=$shot&take=${str(t+1)}"><img style="width:80%; max-width:500px;" src="$thumbnail_url"/></a><br>
$elif scene != None:
$for s in range(shots)
+ <pre>shot $str(s+1)</pre>
$ t = countshots(film, filmfolder, scene)
$ p = counttakes(film, filmfolder, scene, s+1)
- $ thumbnail_url = '/static/Videos/' + film + '/scene' + str(scene).zfill(3) + '/shot' + str(s+1).zfill(3) + '/take' + str(p).zfill(3) + '.jpeg'
- <a href="?scene=$scene&shot=${str(s+1)}"><img width="80%" src="$thumbnail_url"/></a><br>
+ $ thumbnail_url = '/'+filmfolder + film + '/scene' + str(scene).zfill(3) + '/shot' + str(s+1).zfill(3) + '/take' + str(p).zfill(3) + '.jpeg'
+ <a href="?scene=$scene&shot=${str(s+1)}"><img style="width:80%; max-width:500px;" src="$thumbnail_url"/></a><br>
$else:
$for s in range(scenes):
+ <pre>scene $str(s+1)</pre>
$ t = counttakes(film, filmfolder, s+1, 1)
- $ thumbnail_url = '/static/Videos/' + film + '/scene' + str(s+1).zfill(3) + '/shot001/take' + str(t).zfill(3) + '.jpeg'
- <a href="?scene=${str(s+1)}"><img width="80%" src="$thumbnail_url"/></a><br>
+ $ thumbnail_url = '/'+filmfolder + film + '/scene' + str(s+1).zfill(3) + '/shot001/take' + str(t).zfill(3) + '.jpeg'
+ <a href="?scene=${str(s+1)}"><img style="width:80%; max-width:500px;" src="$thumbnail_url"/></a><br>
diff --git a/srv/templates/index.html b/srv/templates/index.html
@@ -1,6 +1,4 @@
-$def with (renderedfilms, unrenderedfilms, cameras, menu, selected,name,scene,shot,take,str,randhash,thumb,vumetermessage,func,filmfolder)
-$var renderedfilms = renderedfilms
-$var unrenderedfilms = unrenderedfilms
+$def with (films, cameras, menu, selected,name,scene,shot,take,str,randhash,thumb,vumetermessage,func,filmfolder)
<script>
$$(document).on('keydown', function (event) {
if (event.which == 37) {
@@ -65,21 +63,9 @@ $elif selected == 1:
$elif selected > 1:
<a href='$take_link'><img width="80%" src="$picture?$randhash"/></a><br>
<br>
-$if func=='show_all_films':
- <h1>FILMS</h1>
-
- $for i in renderedfilms:
- <p>--------------------------------------------------------------</p>
- <h2>$i</h2>
- <a href="$filmfolder$i/${i}.mp4"><img width="80%" src="$filmfolder$i/scene001/shot001/take001.jpeg?$randhash"/></a><br>
- <p>Copy project to your destination:</p>
- <pre>scp -r pi@tarina.local:~$filmfolder$i ~/films/$i</pre>
- <h1>Films unrendered</h1>
-
- $for i in unrenderedfilms:
- <h2>$i </h2>
- <p>Copy project to your destination:</p>
- <pre>scp -r pi@tarina.local:$filmfolder$i ~/films/$i</pre>
+<h1>FILMS</h1>
+$for i in films:
+ <a href="/f/$i"><h2>$i </h2>
<script>
$$('#LEFT').on('click', function () { window.open('?func=left',"_self");return false; });