From 5fee94c7f9dab8f14960a103cca88794ca3106e1 Mon Sep 17 00:00:00 2001 From: bjschuma Date: Mon, 7 Sep 2009 15:59:58 +0000 Subject: [PATCH] Added installer/uninstaller scripts git-svn-id: file:///home/anna/Desktop/ocarina-legacy/mithos/ocarina@62 1daee41c-8060-4895-b1f0-2197c00d777a --- trunk/install.sh | 40 ++++++++++++++++++++++++++++++++++++++++ trunk/src/list.py | 33 ++++++++++++++++++++++++++------- trunk/uninstall.sh | 17 +++++++++++++++++ 3 files changed, 83 insertions(+), 7 deletions(-) create mode 100755 trunk/install.sh create mode 100644 trunk/uninstall.sh diff --git a/trunk/install.sh b/trunk/install.sh new file mode 100755 index 00000000..98e87bf7 --- /dev/null +++ b/trunk/install.sh @@ -0,0 +1,40 @@ +# This script is called to install ocarina to INSTALLDIR +# Default install location is /opt/ocarina + +INSTALLDIR=/opt/ocarina/ +LAUNCHER=$INSTALLDIR/ocarina +RSYNC="rsync -aqz --progress" + +# We need root access to install to /opt/ +if [ "$(id -u)" != "0" ]; then + echo "Attempting to run script as root" + sudo sh $0 + exit 1 +fi + +# if $INSTALLDIR doesn't exist, create it +if [ ! -d $INSTALLDIR ];then + echo "Creating directory $INSTALLDIR" + mkdir $INSTALLDIR +fi + + +# Rsync over all files +echo "Copying program to $INSTALLDIR" +$RSYNC src/ $INSTALLDIR/src/ +echo "Copying examples to $INSTALLDIR" +$RSYNC images/ $INSTALLDIR/images/ +$RSYNC uninstall.sh $INSTALLDIR/ + + +# Create launcher +echo "#/bin/bash" > $LAUNCHER +echo "cd $INSTALLDIR && \`which python\` src/ocarina.py $*" >> $LAUNCHER +chmod +x $LAUNCHER + + +echo "" +echo "" +echo "Ocarina has been installed to $INSTALLDIR" +echo "To uninstall, remove $INSTALLDIR" +echo "Don't forget to add $INSTALLDIR to your path" diff --git a/trunk/src/list.py b/trunk/src/list.py index 416fc434..425b63cc 100644 --- a/trunk/src/list.py +++ b/trunk/src/list.py @@ -183,10 +183,13 @@ class List(gtk.ScrolledWindow): for line in split: line = line.strip() if len(line) > 0: - self.search+=[line] + self.search+=[line.split()] + # Returns true if the row is visible + # False otherwise def hideRows(self,list,iter,string): + #return True if list: file = self.data.library.files[list[iter][0]] else: @@ -195,13 +198,29 @@ class List(gtk.ScrolledWindow): # return True if len(self.search) == 0: return True - for term in self.search: - if re.search(term,file.titlel): - return True - elif re.search(term,file.artistl): - return True - elif re.search(term,file.albuml): + #print self.search + for terms in self.search: + foundAll = True + for substr in terms: + foundSS = False + if re.search(substr,file.titlel): + foundSS = True + elif re.search(substr,file.artistl): + foundSS = True + elif re.search(substr,file.albuml): + foundSS = True + if foundSS == False: + foundAll = False + if foundAll == True: return True + + + #if re.search(term,file.titlel): + # return True + #elif re.search(term,file.artistl): + # return True + #elif re.search(term,file.albuml): + # return True return False diff --git a/trunk/uninstall.sh b/trunk/uninstall.sh new file mode 100644 index 00000000..3a71a58d --- /dev/null +++ b/trunk/uninstall.sh @@ -0,0 +1,17 @@ +# Short script to uninstall Ocarina + +INSTALLDIR=/opt/ocarina + +if [ "$(id -u)" != "0" ]; then + #echo "This script must be run as root" + echo "Attempting to run script as root" + sudo sh $0 + exit 1 +fi + +if [ -d $INSTALLDIR ]; then + echo "Removing $INSTALLDIR" + rm -rf $INSTALLDIR +else + echo "$INSTALLDIR does not seem to exist..." +fi