tarina

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

commit 796dde25e1272255b32ba38a8d674d22c60bd896
parent 77d2eb313466a20d9b51732a34d5b708456f2a84
Author: rob <rob@tarina.org>
Date:   Tue, 23 Apr 2019 12:26:50 +0100

working youtube upload and tarina.org scp upload

Diffstat:
Amods/tarina-upload.sh | 7+++++++
Mmods/upload-mods-enabled | 3++-
Mmods/youtube-upload.sh | 6+++++-
Mtarina.py | 45++++++++++++++++++++++++---------------------
4 files changed, 38 insertions(+), 23 deletions(-)

diff --git a/mods/tarina-upload.sh b/mods/tarina-upload.sh @@ -0,0 +1,7 @@ +#!/bin/sh +# TARINA.ORG MOD +# $1 filmtitle +# $2 filename +PATH=`pwd` + +/usr/bin/scp -P 13337 $2.mp4 rob@tarina.org:/srv/www/tarina.org/public_html/videos/$1.mp4 diff --git a/mods/upload-mods-enabled b/mods/upload-mods-enabled @@ -1 +1,2 @@ -youtube-upload title filename +youtube-upload +tarina-upload diff --git a/mods/youtube-upload.sh b/mods/youtube-upload.sh @@ -1,3 +1,7 @@ #!/bin/sh +# YOUTUBE-UPLOAD MOD +# $1 filmtitle +# $2 filename +PATH=`pwd` -python3 youtube-upload/youtube_upload/__main__.py $1 $2 +/usr/bin/python3 $PATH/mods/youtube-upload/youtube_upload/__main__.py --title="$1" $2.mp4 diff --git a/tarina.py b/tarina.py @@ -991,36 +991,31 @@ def uploadfilm(filename, filmname): buttontime = time.time() holdbutton = '' mods = ['Back'] + settings = [''] writemessage('Searching for upload mods') with open(tarinafolder + '/mods/upload-mods-enabled') as m: - mods.append(m.readlines()) - mods = [x.strip() for x in mods] + mods.extend(m.read().splitlines()) + for m in mods: + settings.append('') menu = mods selected = 0 while True: header = 'Where do you want to upload?' - settings = '', '' writemenu(menu,settings,selected,header) pressed, buttonpressed, buttontime, holdbutton, event, keydelay = getbutton(pressed, buttonpressed, buttontime, holdbutton) if pressed == 'right': - if selected < (len(settings) - 1): + if selected < (len(menu) - 1): selected = selected + 1 elif pressed == 'left': if selected > 0: selected = selected - 1 - if pressed == - ##SEND TO SERVER - writemessage('Hold on, video uploading. middle button to cancel') - try: - os.system('scp -P 13337 ' + filename + '.mp4 rob@tarina.org:/srv/www/tarina.org/public_html/videos/' + filmname + '.mp4') - writemessage('Yes! Film uploaded') - time.sleep(1) - except: - writemessage('hmm.. something went wrong') - time.sleep(1) - return - #os.system('ssh -t rob@lulzcam.org "python /srv/www/lulzcam.org/newfilm.py"') - + elif pressed == 'middle' and menu[selected] == 'Back': + return + elif pressed == 'middle' and menu[selected] in mods: + cmd = tarinafolder + '/mods/' + menu[selected] + '.sh ' + filmname + ' ' + filename + print(cmd) + return cmd + time.sleep(0.02) #-------------Beeps------------------- @@ -1156,6 +1151,7 @@ def stopinterface(camera): os.system('pkill -9 startinterface') os.system('pkill -9 tarinagui') os.system('sudo systemctl stop apache2') + screen.clear() curses.nocbreak() curses.echo() curses.endwin() @@ -1198,16 +1194,15 @@ def tarinaserver(state): #-------------Start main-------------- def main(): - global tarinafolder + global tarinafolder, screen, loadfilmsettings filmfolder = "/home/pi/Videos/" if os.path.isdir(filmfolder) == False: os.makedirs(filmfolder) tarinafolder = os.getcwd() #MENUS - menu = 'FILM:', 'SCENE:', 'SHOT:', 'TAKE:', '', 'SHUTTER:', 'ISO:', 'RED:', 'BLUE:', 'BRIGHT:', 'CONT:', 'SAT:', 'FLIP:', 'BEEP:', 'LENGTH:', 'MIC:', 'PHONES:', 'DUB:', 'TIMELAPSE', 'LENS:', 'DSK:', 'SHUTDOWN', 'SRV:', 'WIFI:', 'UPDATE', 'MODS', 'LOAD', 'NEW' + menu = 'FILM:', 'SCENE:', 'SHOT:', 'TAKE:', '', 'SHUTTER:', 'ISO:', 'RED:', 'BLUE:', 'BRIGHT:', 'CONT:', 'SAT:', 'FLIP:', 'BEEP:', 'LENGTH:', 'MIC:', 'PHONES:', 'DUB:', 'TIMELAPSE', 'LENS:', 'DSK:', 'SHUTDOWN', 'SRV:', 'WIFI:', 'UPDATE', 'UPLOAD', 'LOAD', 'NEW' #STANDARD VALUES - global screen abc = '_', 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','1','2','3','4','5','6','7','8','9','0' keydelay = 0.0555 selectedaction = 0 @@ -1440,7 +1435,15 @@ def main(): if renderfilm == True: render(filmfiles, renderfilename, dub) renderfilm = False - uploadfilm(renderfilename, filmname) + cmd = uploadfilm(renderfilename, filmname) + stopinterface(camera) + try: + os.system(cmd) + except Exception as e: print(e) + time.sleep(10) + screen = startinterface() + camera = startcamera(lens) + loadfilmsettings = True selectedaction = 0 #LOAD FILM