commit 30cbdf7e396e6d5bf0502f3c52de8cac5433914b
parent 21a6b1b6c4cf94f41c6f34127903ae8741437605
Author: rbckman <rob@tarina.org>
Date: Wed, 6 Mar 2024 10:35:00 +0000
viewing films with a ease
Diffstat:
4 files changed, 66 insertions(+), 46 deletions(-)
diff --git a/srv/gonzopiserver.py b/srv/gonzopiserver.py
@@ -15,6 +15,11 @@ rundir = os.path.dirname(__file__)
if rundir != '':
os.chdir(rundir)
+urls = (
+ '/c/?', 'index',
+ '/(.*)?', 'films'
+)
+
#--------------USB filmfolder-------------------
def usbfilmfolder():
@@ -78,11 +83,6 @@ for adapter in adapters:
networks.append(ip.ip)
network=networks[0]
-urls = (
- '/?', 'index',
- '/f/(.*)?', 'films'
-)
-
app = web.application(urls, globals())
render = web.template.render('templates/', base="base")
web.config.debug=False
@@ -191,16 +191,32 @@ def checkpicture(thumbdir,scene,shot,take):
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
+def countsize(filename):
+ size = 0
+ if type(filename) is str:
+ size = os.stat(filename).st_size
else:
- return 'video'
+ return 0
+ return size/1024
+
+def checkvideo(video,filmfolder,film,scene,shot,take):
+ if take==None:
+ take=1
+ print(basedir+video)
+ p = "/"+filmfolder+film+"/scene"+str(scene).zfill(3)+"/shot"+str(shot).zfill(3)+ "/picture"+str(take).zfill(3)+".jpeg"
+ print(p)
+ v = ''
+ if video != '':
+ try:
+ if os.stat(basedir+video).st_size == 0:
+ v = ''
+ else:
+ v='video'
+ except:
+ v = ''
+ if os.path.isfile(basedir+p) == True:
+ return p, v
+ return '', v
class index:
def GET(self):
@@ -285,7 +301,7 @@ class index:
if i.func != None:
time.sleep(1)
session.reload = 1
- raise web.seeother('/')
+ raise web.seeother('/c/')
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:
diff --git a/srv/templates/base.html b/srv/templates/base.html
@@ -2,8 +2,9 @@ $def with (content)
<!doctype html>
<HEAD>
<meta charset="utf-8">
- <title>Tarina | video & audio recorder with glue</title>
- <link rel="stylesheet" href="/static/style.css?v=35" type="text/css" rel="stylesheet"/>
+ <title>Gonzo Pi | a reboot of filmmaking </title>
+ <link rel="stylesheet" href="/static/style.css?v=45" type="text/css" rel="stylesheet"/>
+ <meta name="viewport" content="width=device-width, initial-scale=1">
<script src="/static/jquery-3.7.1.min.js" type="text/javascript"></script>
</HEAD>
diff --git a/srv/templates/filmpage.html b/srv/templates/filmpage.html
@@ -13,25 +13,31 @@ $elif scene != None:
$elif film != '':
<h1>$film</h1>
$ 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>
+$if video != '':
+ <br>
+ <h3><a href="javascript:history.back()">Go Back</a></h3>
+ <br>
+ $ picture = checkvideo(video,filmfolder,film,scene,shot,take)
+ $if picture[1] == 'video':
+ <video width="80%" controls>
+ <source src="$video" style="width:80%; max-width:500px;" type="video/mp4">
+ Your brower is caput
+ </video>
+ $elif picture[0] != '':
+ <img style="width:80%;" src="$picture[0]"/>
+ $elif picture[1] == '':
+ <pre>video not rendered</pre>
+ <a href="">render now!</a>
+ <br>
$else:
- <img style="width:80%;" src="$picture"/>
+ <br>
+ <a href="/c/">camera control</a>
$if film == '':
<h1>FILMS</h1>
$for i in films:
- <a href="/f/$i"><h2>$i</h2></a>
+ <a href="$i"><h2>$i</h2></a>
<br>
$ t=0
@@ -40,17 +46,17 @@ $if shot != None:
$for t in range(takes):
$ 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>
+ <a href="?scene=$scene&shot=$shot&take=${str(t+1)}"><img style="vertical-align:middle; 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 = '/'+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>
+ <a href="?scene=$scene&shot=${str(s+1)}"><img style="vertical-align:middle; 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 = '/'+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>
+ <a href="?scene=${str(s+1)}"><img style="vertical-align:middle; width:80%; max-width:500px;" src="$thumbnail_url"/></a><br>
diff --git a/srv/templates/index.html b/srv/templates/index.html
@@ -28,11 +28,11 @@ $for i in cameras:
$i
<br>
<div id="controls" style="display:none"> >
-<a id="VIEW" href="/?func=view">VIEW</a> <a id="UP" href="/?func=up">__UP__</a> <a id="RECORD" href="/?func=record">RECORD</a><br>
-<a id="LEFT" href="/?func=left">LEFT</a> <a id="MIDDLE" href="/?func=middle">MIDDLE</a> <a id="RIGHT" href="/?func=right">RIGHT</a><br>
-<a id="DELETE" href="/?func=delete">DELETE</a> <a id="DOWN" href="/?func=down">DOWN</a> <a id="RETAKE" href="/?func=retake">RETAKE</a><br>
-<a href="/?func=picture">PICTURE</a>
-<a href="/?func=search">SEARCH</a>
+<a id="VIEW" href="?func=view">VIEW</a> <a id="UP" href="?func=up">__UP__</a> <a id="RECORD" href="?func=record">RECORD</a><br>
+<a id="LEFT" href="?func=left">LEFT</a> <a id="MIDDLE" href="?func=middle">MIDDLE</a> <a id="RIGHT" href="?func=right">RIGHT</a><br>
+<a id="DELETE" href="?func=delete">DELETE</a> <a id="DOWN" href="?func=down">DOWN</a> <a id="RETAKE" href="?func=retake">RETAKE</a><br>
+<a href="?func=picture">PICTURE</a>
+<a href="?func=search">SEARCH</a>
</div>
<div id="menu" style="margin:0 auto; width:99%">
@@ -48,14 +48,14 @@ $for m in menu[3:]:
<br>
</div>
$if thumb != '':
- $ picture=filmfolder + name + "/scene" + str(scene).zfill(3) + "/shot" + str(shot).zfill(3) + "/picture" + str(take).zfill(3) + ".jpeg"
+ $ picture= '/'+filmfolder + name + "/scene" + str(scene).zfill(3) + "/shot" + str(shot).zfill(3) + "/picture" + str(take).zfill(3) + ".jpeg"
$else:
- $ picture=filmfolder + name + "/scene" + str(scene).zfill(3) + "/shot" + str(shot).zfill(3) + "/take" + str(take).zfill(3) + ".jpeg"
+ $ picture= '/'+filmfolder + name + "/scene" + str(scene).zfill(3) + "/shot" + str(shot).zfill(3) + "/take" + str(take).zfill(3) + ".jpeg"
-$ take_link=filmfolder + name + "/scene" + str(scene).zfill(3) + "/shot" + str(shot).zfill(3) + "/take" + str(take).zfill(3) + ".mp4"
-$ scene_link=filmfolder + name + "/scene" + str(scene).zfill(3) + "/scene.mp4"
-$ film_link=filmfolder + name + "/" +name+ ".mp4"
+$ take_link='/'+filmfolder + name + "/scene" + str(scene).zfill(3) + "/shot" + str(shot).zfill(3) + "/take" + str(take).zfill(3) + ".mp4"
+$ scene_link='/'+filmfolder + name + "/scene" + str(scene).zfill(3) + "/scene.mp4"
+$ film_link='/'+filmfolder + name + "/" +name+ ".mp4"
$if selected == 0:
<a href='$film_link'><img width="80%" src="$picture?$randhash"/></a><br>
$elif selected == 1:
@@ -63,9 +63,6 @@ $elif selected == 1:
$elif selected > 1:
<a href='$take_link'><img width="80%" src="$picture?$randhash"/></a><br>
<br>
-<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; });