commit 48f00e188369b8e34056bedab45a953b6c51acf2
parent fe1544983e1180f626452bd4d9eaa6e3bcdcdc02
Author: rbckman <robinbackman@gmai.com>
Date: Wed, 8 May 2019 20:42:06 +0100
make a backup of all films to harddrive now works with ntfs and ext systems
Diffstat:
6 files changed, 96 insertions(+), 38 deletions(-)
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/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
echo "Getting the latest firmware for rpi..."
SKIP_WARNING=1 rpi-update
echo "installing python-omxplayer-wrapper..."
@@ -151,9 +151,6 @@ systemctl enable tarina.service
systemctl daemon-reload
echo "systemd configuration done!"
-echo "Enable USB HDD auto mount"
-sudo sed -i -e 's/MountFlags=slave/MountFlags=shared/g' /lib/systemd/system/systemd-udevd.service
-
echo "Installing tarina apache server configuration"
cp extras/tarina.conf /etc/apache2/sites-available/
ln -s -t /var/www/ /home/pi/tarina/srv/
@@ -162,6 +159,47 @@ a2ensite tarina.conf
systemctl reload apache2
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..."
+echo "Adding ntfs to usbmount"
+apt-get -y usbmount ntfs-3g exfat-fuse
+echo "Enable usb hdd automount, ntfs, fat and ext drives hopefully should all work."
+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
+sed -i '/MOUNTOPTIONS=/c\MOUNTOPTIONS="noexec,nodev,noatime,nodiratime"' /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
[Yy]* ) echo "Adding hacking tools..."
diff --git a/tarina.py b/tarina.py
@@ -521,6 +521,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
@@ -553,7 +558,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)
@@ -968,7 +973,7 @@ def audiosilence(foldername,filename):
#--------------Copy to USB-------------------
-def copytousb(filmfolder, filmname):
+def copytousb(filmfolder):
pressed = ''
buttonpressed = ''
buttontime = time.time()
@@ -983,27 +988,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------------
@@ -1107,6 +1112,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
@@ -1234,7 +1255,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
@@ -1393,10 +1414,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
@@ -1459,10 +1479,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':
@@ -1855,7 +1875,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: