New filtering system, recognizing a ',' as an or

git-svn-id: file:///home/anna/Desktop/ocarina-legacy/mithos/ocarina@61 1daee41c-8060-4895-b1f0-2197c00d777a
This commit is contained in:
bjschuma 2009-08-15 02:20:20 +00:00
parent 47317b24b9
commit 072f5e38a9
7 changed files with 47 additions and 9 deletions

View File

@ -17,6 +17,9 @@ compile:
count:
cat src/*.py | grep -v '[[:space:]]*\#' | cat -b
tar:
cd ../../ && tar -czf ocarina.tar.gz ocarina/
install:
# mkdir ~/bin/ocarina-bin
rsync -avz src/ ~/bin/ocarina-bin/src

5
trunk/bugs Normal file
View File

@ -0,0 +1,5 @@
- Cannot scan library twice in same session
- One song doesn't get added to list when scanning (probably last song)
- What happens when songs are selected to be added to library?
- Error updating liblist while scanning if library tab is visible
-

4
trunk/dependencies Normal file
View File

@ -0,0 +1,4 @@
- tagpy
- gstreamer-plugins-*
- pygst

View File

@ -31,7 +31,10 @@ class ContentPane(gtk.HBox):
self.show()
# Load up the last saved song
self.library.loadSong(self.data.library.files[self.data.curSong])
try:
self.library.loadSong(self.data.library.files[self.data.curSong])
except:
True == True
self.gotoCurSong()

8
trunk/src/cythonize Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
for file in `ls *.py | cut -d '.' -f 1`
do
echo $file
cython $file.py
gcc -c -fPIC -O3 -I/usr/include/python2.6 $file.c
gcc -shared $file.o -o $file.so
done

View File

@ -3,7 +3,7 @@ import re
import tagpy
#import cPickle as pickle
from songInfo import SongInfo
import thread
#import thread
class Library:

View File

@ -38,6 +38,7 @@ class List(gtk.ScrolledWindow):
self.timeText()
self.string = ""
self.search = []
self.filter = self.list.filter_new()
self.filter.set_visible_func(self.hideRows,"")
self.sort = gtk.TreeModelSort(self.filter)
@ -152,6 +153,7 @@ class List(gtk.ScrolledWindow):
def filterRows(self,string):
self.string = string
self.formatSearch(self.string)
self.seconds = 0
self.count = 0
self.filter.refilter()
@ -167,6 +169,7 @@ class List(gtk.ScrolledWindow):
self.count = 0
self.seconds = 0
self.string = string
self.formatSearch(self.string)
for file in list:
if self.hideRows(None,file,string) == True:
self.count+=1
@ -174,19 +177,31 @@ class List(gtk.ScrolledWindow):
self.makeLabel()
def formatSearch(self,string):
self.search = []
split = string.split(",")
for line in split:
line = line.strip()
if len(line) > 0:
self.search+=[line]
def hideRows(self,list,iter,string):
if list:
file = self.data.library.files[list[iter][0]]
else:
file = iter
if self.string == "":
return True
if re.search(self.string,file.titlel):
return True
elif re.search(self.string,file.artistl):
return True
elif re.search(self.string,file.albuml):
#if self.string == "":
# 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):
return True
return False