tarina

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

commit cd222a01524ab6a644c1ed206435fd51834e9292
parent b76c37321ec33454a43578c23e9741fa2899bd77
Author: rbckman <robinbackman@gmail.com>
Date:   Fri, 16 Nov 2018 10:18:38 +0200

now using apache2 for tarina server

Diffstat:
Aextras/tarina.conf | 35+++++++++++++++++++++++++++++++++++
Minstall.sh | 12+++++++++---
Msrv/tarinaserver.py | 14+++++++++-----
Asrv/tarinaserver.pyc | 0
Msrv/templates/base.html | 2+-
Msrv/templates/filmpage.html | 3+--
Msrv/templates/index.html | 4++--
Mtarina.py | 8++++----
8 files changed, 61 insertions(+), 17 deletions(-)

diff --git a/extras/tarina.conf b/extras/tarina.conf @@ -0,0 +1,35 @@ +<VirtualHost *:80> + ServerAdmin info@tarina.org + #DocumentRoot /srv/www/reikaleipa.fi/public_html + WSGIScriptAlias / /var/www/srv/tarinaserver.py + WSGIPassAuthorization On + AddType text/html .py + Alias /static /var/www/srv/static + <Directory /> + Options FollowSymLinks + AllowOverride None + </Directory> + <Directory /var/www/srv> + Options Indexes FollowSymLinks MultiViews + AllowOverride None + Order allow,deny + allow from all + </Directory> + + ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ + <Directory "/usr/lib/cgi-bin"> + AllowOverride None + Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch + Order allow,deny + Allow from all + </Directory> + + ErrorLog ${APACHE_LOG_DIR}/error.log + + # Possible values include: debug, info, notice, warn, error, crit, + # alert, emerg. + LogLevel warn + + CustomLog ${APACHE_LOG_DIR}/access.log combined + +</VirtualHost> diff --git a/install.sh b/install.sh @@ -9,7 +9,7 @@ echo "Installing all dependencies..." apt-get update apt-get upgrade -y apt-get -y install git python-picamera python-imaging python-pexpect libav-tools mediainfo gpac omxplayer sox cpufrequtils usbmount python-dbus python-webpy wicd -rpi-update +rpi-update apache2 libapache2-mod-wsgi echo "installing python-omxplayer-wrapper..." pip install omxplayer-wrapper echo "installing rwb27s openflexure microscope fork of picamera with lens shading correction..." @@ -33,7 +33,7 @@ dpi_output_format=0x6f015 hdmi_timings=480 0 16 16 24 800 0 4 2 2 0 0 0 60 0 32000000 6 display_rotate=3 start_x=1 -gpu_mem=512 +gpu_mem=256 dtoverlay=pi3-disable-bt-overlay dtoverlay=i2c-gpio,i2c_gpio_scl=24,i2c_gpio_sda=23framebuffer_height=480 disable_splash=1 @@ -105,7 +105,13 @@ EOF chmod +x /home/pi/tarina/tarina.py systemctl enable tarina.service systemctl daemon-reload -echo "Congrats everything done!" +echo "systemd configuration done!" + +echo "Installing server configuration" +cp extras/tarina.conf /etc/apache2/sites-available/ +a2dissite 000-default.conf +a2ensite tarina.conf +systemctl reload apache2 while true; do read -p "Do you wish to add rbckmans special hacking tools & configurations (y)es or (n)o?" yn diff --git a/srv/tarinaserver.py b/srv/tarinaserver.py @@ -18,7 +18,7 @@ films = [] urls = ( '/', 'index', - '/f/(.+)', 'films' + '/f/(.*)', 'films' ) render = web.template.render('templates/', base="base") @@ -35,10 +35,14 @@ class index: unrenderedfilms.append(i) return render.index(renderedfilms, unrenderedfilms) -def films: +class films: def GET(self, film): return render.filmpage(film) -if __name__== "__main__": - app = web.application(urls, globals()) - app.run() +app = web.application(urls, globals(), autoreload=False) +application = app.wsgifunc() + +#if __name__== "__main__": + #app = web.application(urls, globals()) + #app.run() + diff --git a/srv/tarinaserver.pyc b/srv/tarinaserver.pyc Binary files differ. diff --git a/srv/templates/base.html b/srv/templates/base.html @@ -3,7 +3,7 @@ $def with (content) <HEAD> <meta charset="utf-8"> <title>Tarina | video & audio recorder with glue</title> - <link rel="stylesheet" href="static/style.css" type="text/css" rel="stylesheet"/> + <link rel="stylesheet" href="/static/style.css" type="text/css" rel="stylesheet"/> </HEAD> <BODY> diff --git a/srv/templates/filmpage.html b/srv/templates/filmpage.html @@ -1,11 +1,10 @@ $def with (film) -$var film <h1>$film</h1> <p>--------------------------------------------------------------</p> <video width="80%" controls> - <source src="static/Videos/$film/${film}.mp4" type="video/mp4"> + <source src="/static/Videos/$film/${film}.mp4" type="video/mp4"> Your brower is caput </video> <p>Copy project to your destination:</p> diff --git a/srv/templates/index.html b/srv/templates/index.html @@ -9,11 +9,11 @@ $for i in renderedfilms: <h2>$i</h2> <a href="static/Videos/$i/${i}.mp4"><img width="80%" src="static/Videos/$i/scene001/shot001/take001.png"/></a><br> <p>Copy project to your destination:</p> - <pre>scp -r pi@tarina.local:~/Videos/$i /to/your/destination </pre> + <pre>scp -r pi@tarina.local:~/Videos/$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:~/Videos/$i /to/your/destination </pre> + <pre>scp -r pi@tarina.local:~/Videos/$i ~/films/$i</pre> diff --git a/tarina.py b/tarina.py @@ -1091,7 +1091,7 @@ def stopinterface(camera): os.system('pkill -9 arecord') os.system('pkill -9 startinterface') os.system('pkill -9 tarinagui') - os.system('pkill -9 tarinaserver.py') + os.system('sudo systemctl stop apache2') curses.nocbreak() curses.echo() curses.endwin() @@ -1118,16 +1118,16 @@ def startcamera(lens): def tarinaserver(state): #Tarina server if state == True: - #Try to run tarinaserver on port 8080 + #Try to run apache try: - call (['./srv/tarinaserver.py 8080 &'], shell = True) + os.system('sudo systemctl start apache2') return 'on' except: writemessage("could not run tarina server") time.sleep(2) return 'off' if state == False: - os.system('pkill -9 tarinaserver.py') + os.system('sudo systemctl stop apache2') return 'off'