tarina

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

commit ebbb6cd8afd84d7ef32cb68206861b95addc06fb
parent 0ca8786bb9d7b88a5e7c7fb547ebeacec1814d99
Author: rob <rob@tarina.org>
Date:   Wed,  8 May 2019 23:22:51 +0300

Merge branch 'master' of https://github.com/rbckman/tarina

updates to update feature

Diffstat:
A.gitattributes | 3+++
RDEVELOPER.md -> DEVELOPERS.md | 0
MREADME.md | 2+-
MVERSION | 2+-
Mdocs/tarina-manual.md | 2+-
Mgui/src/main.c | 2+-
Mgui/tarinagui.bin | 0
Minstall.sh | 43++++++++++++++++++++++++++++++++++++++++++-
Mtarina.py | 82+++++++++++++++++++++++++++++++++++++++++++++++++------------------------------
Dvendor.yml | 2--
10 files changed, 100 insertions(+), 38 deletions(-)

diff --git a/.gitattributes b/.gitattributes @@ -0,0 +1,3 @@ +alsa-utils-1.1.3/* linguist-vendored +mods/youtube-upload/* linguist-vendored +gui/libs/* linguist-vendored diff --git a/DEVELOPER.md b/DEVELOPERS.md diff --git a/README.md b/README.md @@ -44,7 +44,7 @@ sudo ./install.sh ``` You'r ready to rumble: ``` -python tarina.py +python3 tarina.py ``` Why diff --git a/VERSION b/VERSION @@ -1,2 +1,2 @@ -0.99 +0.991 Leone diff --git a/docs/tarina-manual.md b/docs/tarina-manual.md @@ -406,7 +406,7 @@ sudo ./install.sh ``` You'r ready to rumble: ``` -python tarina.py +python3 tarina.py ``` Happy filming! diff --git a/gui/src/main.c b/gui/src/main.c @@ -192,7 +192,7 @@ int main(void) render_subtitle(img, line, text_size, row4, y_offset5, color); row4 += read * space + morespace; } - if (linenr >= 24 && linenr <= 35){ + if (linenr >= 24 && linenr <= 40){ render_subtitle(img, line, text_size, row5, y_offset6, color); row5 += read * space + morespace; } diff --git a/gui/tarinagui.bin b/gui/tarinagui.bin Binary files differ. diff --git a/install.sh b/install.sh @@ -40,7 +40,7 @@ sleep 3 echo "Installing all dependencies..." apt-get update apt-get upgrade -y -apt-get -y install git python3-pip libav-tools mediainfo gpac omxplayer sox cpufrequtils usbmount apache2 libapache2-mod-wsgi-py3 libdbus-glib-1-dev dbus libdbus-1-dev +apt-get -y install git python3-pip libav-tools mediainfo gpac omxplayer sox cpufrequtils apache2 libapache2-mod-wsgi-py3 libdbus-glib-1-dev dbus libdbus-1-dev usbmount echo "Getting the latest firmware for rpi..." SKIP_WARNING=1 rpi-update echo "installing python-omxplayer-wrapper..." @@ -158,6 +158,47 @@ a2dissite 000-default.conf a2ensite tarina.conf systemctl reload apache2 +echo 'Dont do sync while copying to usb drives, does increase speed alöt!' +sed -i '/MOUNTOPTIONS=/c\MOUNTOPTIONS="noexec,nodev,noatime,nodiratime"' /etc/usbmount/usbmount.conf + +while true; do + read -p "Do you wish to add capabilities to backup to all different harddrives like ntfs and vfat systems?" yn + case $yn in + [Yy]* ) echo "Adding harddrive tools..." +apt-get -y ntfs-3g exfat-fuse +sed -i -e 's/MountFlags=slave/MountFlags=shared/g' /lib/systemd/system/systemd-udevd.service +sed -i '/FS_MOUNTOPTIONS=/c\FS_MOUNTOPTIONS="-fstype=ntfs-3g,nls=utf8,umask=007,gid=46 -fstype=fuseblk,nls=utf8,umask=007,gid=46 -fstype=vfat,gid=1000,uid=1000,umask=007"' /etc/usbmount/usbmount.conf +sed -i '/FILESYSTEMS=/c\FILESYSTEMS="vfat ext2 ext3 ext4 hfsplus ntfs fuseblk vfat"' /etc/usbmount/usbmount.conf +echo "All this hard work to figure out how to keep NTFS mounted was done by F. Untermoser" +echo "Found it here https://raspberrypi.stackexchange.com/questions/41959/automount-various-usb-stick-file-systems-on-jessie-lite" +echo "Big props! thanks alot!" + +cat <<'EOF' > /etc/udev/rules.d/usbmount.rules +KERNEL=="sd*", DRIVERS=="sbp2", ACTION=="add", PROGRAM="/bin/systemd-escape -p --template=usbmount@.service $env{DEVNAME}", ENV{SYSTEMD_WANTS}+="%c" +KERNEL=="sd*", SUBSYSTEMS=="usb", ACTION=="add", PROGRAM="/bin/systemd-escape -p --template=usbmount@.service $env{DEVNAME}", ENV{SYSTEMD_WANTS}+="%c" +KERNEL=="ub*", SUBSYSTEMS=="usb", ACTION=="add", PROGRAM="/bin/systemd-escape -p --template=usbmount@.service $env{DEVNAME}", ENV{SYSTEMD_WANTS}+="%c" +KERNEL=="sd*", ACTION=="remove", RUN+="/usr/share/usbmount/usbmount remove" +KERNEL=="ub*", ACTION=="remove", RUN+="/usr/share/usbmount/usbmount remove" +EOF + +cat <<'EOF' > /etc/systemd/system/usbmount@.service +[Unit] +BindTo=%i.device +After=%i.device + +[Service] +Type=oneshot +TimeoutStartSec=0 +Environment=DEVNAME=%I +ExecStart=/usr/share/usbmount/usbmount add +RemainAfterExit=yes +EOF + break;; + [Nn]* ) echo "Nope, okay! who wants those shitty systems anyways!";break;; + * ) echo "Please answer yes or no.";; + esac +done + while true; do read -p "Do you wish to add rbckmans special hacking tools and configurations [y]es or [n]o?" yn case $yn in diff --git a/tarina.py b/tarina.py @@ -522,6 +522,11 @@ def timelapse(beeps,camera,foldername,filename): if recording == True: os.system('pkill arecord') camera.stop_recording() + #create thumbnail + try: + camera.capture(foldername + filename + '.jpeg', resize=(800,340), use_video_port=True) + except: + print('something wrong with camera jpeg capture') writemessage('Compiling timelapse') print('Hold on, rendering ' + str(len(files)) + ' files') #RENDER VIDEO @@ -554,7 +559,7 @@ def timelapse(beeps,camera,foldername,filename): if sound == False: audiosilence(foldername,filename) #cleanup - #os.system('rm -r ' + foldername + 'timelapse') + os.system('rm -r ' + foldername + 'timelapse') vumetermessage('timelapse done! ;)') return renderfilename time.sleep(0.0555) @@ -969,7 +974,7 @@ def audiosilence(foldername,filename): #--------------Copy to USB------------------- -def copytousb(filmfolder, filmname): +def copytousb(filmfolder): pressed = '' buttonpressed = '' buttontime = time.time() @@ -984,27 +989,27 @@ def copytousb(filmfolder, filmname): break time.sleep(0.02) if usbconnected == True: - writemessage('USB device found, copying files...') - #COUNT FILES - scenes, shots, takes = countlast(filmname, filmfolder) - scene = 1 - filmfiles = [] - while scene <= scenes: - shots = countshots(filmname, filmfolder, scene) - if shots > 0: - filmfiles.extend(renderlist(filmname, filmfolder, scene)) - scene = scene + 1 - #RENDER FILES TO MP4 ON USB STICK - os.makedirs('/media/usb0/' + filmname) - for f in filmfiles[:]: - os.system('MP4Box -add ' + f + '.mp4 -new /media/usb0/' + filmname + '/' + f[-24:] + '.mp4') - os.system('cp ' + f + '.wav /media/usb0/' + filmname + '/' + f[-24:] + '.wav') - os.system('sync') - writemessage('all files copied successfully!') - time.sleep(1) - writemessage('You can safely unplug the usb device now') - time.sleep(2) - return + #Copy new files to usb device + try: + os.makedirs('/media/usb0/tarinafilms/') + except: + pass + try: + p = subprocess.check_output('stat -f -c %T /media/usb0', shell=True) + filesystem = p.decode() + writemessage('Copying files to a ' + filesystem + ' hdd...) + os.system('rsync -avr -P ' + filmfolder + '* /media/usb0/tarinafilms/') + os.system('sync') + os.system('pumount /media/usb0') + writemessage('all files copied successfully!') + waitforanykey() + writemessage('You can safely unplug the usb device now') + time.sleep(2) + return + except: + writemessage('Nope! something wrong with ur drive :(') + waitforanykey() + return #-------------Upload film------------ @@ -1108,6 +1113,22 @@ def empty(filename): #--------------BUTTONS------------- +def waitforanykey(): + vumetermessage("press any key to continue..") + time.sleep(1) + while True: + event = screen.getch() + if onlykeyboard == False: + readbus = bus.read_byte_data(DEVICE,GPIOB) + readbus2 = bus.read_byte_data(DEVICE,GPIOA) + else: + readbus = 255 + readbus2 = 247 + if readbus != 255 or readbus2 != 247 or event != -1: + time.sleep(0.05) + vumetermessage(' ') + return + def getbutton(lastbutton, buttonpressed, buttontime, holdbutton): event = screen.getch() keydelay = 0.08 @@ -1235,7 +1256,7 @@ def main(): tarinafolder = os.getcwd() #MENUS - menu = 'FILM:', 'SCENE:', 'SHOT:', 'TAKE:', '', 'SHUTTER:', 'ISO:', 'RED:', 'BLUE:', 'BRIGHT:', 'CONT:', 'SAT:', 'FLIP:', 'BEEP:', 'LENGTH:', 'MIC:', 'PHONES:', 'COMP:', 'DUB:', 'TIMELAPSE', 'LENS:', 'DSK:', 'SHUTDOWN', 'SRV:', 'WIFI:', 'UPDATE', 'UPLOAD', 'LOAD', 'NEW' + menu = 'FILM:', 'SCENE:', 'SHOT:', 'TAKE:', '', 'SHUTTER:', 'ISO:', 'RED:', 'BLUE:', 'BRIGHT:', 'CONT:', 'SAT:', 'FLIP:', 'BEEP:', 'LENGTH:', 'MIC:', 'PHONES:', 'COMP:', 'DUB:', 'TIMELAPSE', 'LENS:', 'DSK:', 'SHUTDOWN', 'SRV:', 'WIFI:', 'UPDATE', 'UPLOAD', 'BACKUP', 'LOAD', 'NEW' #STANDARD VALUES 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 @@ -1394,10 +1415,9 @@ def main(): filename = 'take' + str(take).zfill(3) thefile = timelapse(beeps,camera,foldername,filename) if thefile != '': - #scene, shot, take, thefile = happyornothappy(camera, thefile, scene, shot, take, filmfolder, filmname, foldername, filename) #render thumbnail - writemessage('creating thumbnail') - os.system('avconv -i ' + foldername + filename + '.mp4 -frames 1 -vf scale=800:340 ' + foldername + filename + '.jpeg') + #writemessage('creating thumbnail') + #os.system('avconv -i ' + foldername + filename + '.mp4 -frames 1 -vf scale=800:340 ' + foldername + filename + '.jpeg') updatethumb = True renderscene = True renderfilm = True @@ -1460,10 +1480,10 @@ def main(): writemessage('No dubbing file found!') time.sleep(1) - #COPY TO USB - elif pressed == 'middle' and menu[selected] == 'COPY': + #BACKUP + elif pressed == 'middle' and menu[selected] == 'BACKUP': if recording == False: - copytousb(filmfolder, filmname) + copytousb(filmfolder) #UPLOAD elif pressed == 'middle' and menu[selected] == 'UPLOAD': @@ -1856,7 +1876,7 @@ def main(): #Check if menu is changed and save settings if buttonpressed == True or recording == True or rendermenu == True: - settings = filmname, str(scene), str(shot), str(take), rectime, camerashutter, cameraiso, camerared, camerablue, str(camera.brightness), str(camera.contrast), str(camera.saturation), str(flip), str(beeps), str(reclenght), str(miclevel), str(headphoneslevel), str(comp),'o' + str(round(dub[0],1)) + ' d' + str(round(dub[1],1)), '', lens, diskleft, '', serverstate, wifistate, '', '', '', '' + settings = filmname, str(scene), str(shot), str(take), rectime, camerashutter, cameraiso, camerared, camerablue, str(camera.brightness), str(camera.contrast), str(camera.saturation), str(flip), str(beeps), str(reclenght), str(miclevel), str(headphoneslevel), str(comp),'o' + str(round(dub[0],1)) + ' d' + str(round(dub[1],1)), '', lens, diskleft, '', serverstate, wifistate, '', '', '', '', '' writemenu(menu,settings,selected,'') #Rerender menu five times to be able to se picamera settings change if rerendermenu < 100000: diff --git a/vendor.yml b/vendor.yml @@ -1,2 +0,0 @@ -alsa-utils-1.1.3/* linguist-vendored -mods/youtube-upload/* linguist-vendored