Fixed the image search method

This commit is contained in:
Arjan Schrijver 2013-01-25 20:20:27 +01:00
parent 150fe6e15f
commit 965785a8e7

View File

@ -399,11 +399,9 @@ class ImageMediaItem(MediaManagerItem):
'the image file "%s" no longer exists.') % filename) 'the image file "%s" no longer exists.') % filename)
def search(self, string, showError): def search(self, string, showError):
files = Settings().value(self.settingsSection + u'/images files') files = self.manager.get_all_objects(ImageFilenames, filter_clause=ImageFilenames.filename.contains(string), order_by_ref=ImageFilenames.filename)
results = [] results = []
string = string.lower()
for file in files: for file in files:
filename = os.path.split(unicode(file))[1] filename = os.path.split(unicode(file.filename))[1]
if filename.lower().find(string) > -1: results.append([file.filename, filename])
results.append([file, filename])
return results return results