commit 8b2d710d9584961606c106c465339847c4683fd9
parent 1a6f988bfdafa691caef38318668f8eca8219567
Author: rbckman <robinbackman@gmail.com>
Date:   Fri, 31 Aug 2018 17:52:30 +0300
do not expect a list of films when there is no films
Diffstat:
2 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/install.sh b/install.sh
@@ -13,7 +13,7 @@ rpi-update
 echo "installing python-omxplayer-wrapper..."
 pip install omxplayer-wrapper
 echo "installing rwb27s openflexure microscope fork of picamera with lens shading correction..."
-pip install https://github.com/rwb27/picamera/archive/lens-shading.zip
+pip --no-cache-dir install https://github.com/rwb27/picamera/archive/lens-shading.zip
 echo "Adding to /boot/config.txt"
 cat <<'EOF' >> /boot/config.txt
 
@@ -120,6 +120,13 @@ cp extras/.vimrc /home/pi/.vimrc
     esac
 done
 
+sudo apt-get -y install wicd wicd-curses
+sudo apt-get -y purge dhcpcd5
+
+sudo systemctl disable lightdm.service --force
+sudo systemctl disable graphical.target --force
+sudo systemctl disable plymouth.service --force
+
 while true; do
     read -p "Reboot into Tarina now? (y)es or (n)o?" yn
     case $yn in
diff --git a/tarina.py b/tarina.py
@@ -428,9 +428,14 @@ def nameyourfilm(filmfolder, filmname):
                 thefuck = ''
         elif pressed == 'middle' or event == 10:
             if len(filmname) > 0:
-                if filmname in getfilms(filmfolder)[0]:
-                    thefuck = 'this filmname is already taken! chose another name!'
-                if filmname not in getfilms(filmfolder)[0]:
+                try:
+                    if filmname in getfilms(filmfolder)[0]:
+                        thefuck = 'this filmname is already taken! chose another name!'
+                    if filmname not in getfilms(filmfolder)[0]:
+                        print "New film " + filmname
+                        return(filmname)
+                except:
+                    print "New film " + filmname
                     return(filmname)
         elif event == 27:
             return oldfilmname
@@ -1209,11 +1214,10 @@ def main():
     time.sleep(1)
 
     #LOAD FILM AND SCENE SETTINGS
-    filmname = getfilms(filmfolder)[0][0]
-
-    #NEW FILM (IF NOTHING TO LOAD)
-    if filmname == '':
-        filmname = nameyourfilm(filmfolder, 'untitled')
+    try:
+        filmname = getfilms(filmfolder)[0][0]
+    except:
+        filmname = ''
 
     #THUMBNAILCHECKER
     oldscene = scene
@@ -1390,7 +1394,7 @@ def main():
             loadfilmsettings = True
 
         #NEW FILM
-        elif pressed == 'middle' and menu[selected] == 'NEW':
+        elif pressed == 'middle' and menu[selected] == 'NEW' or filmname == '':
             if recording == False:
                 oldname = filmname
                 filmname = nameyourfilm(filmfolder, '')