New library filtering
The new library module can filter songs
This commit is contained in:
parent
fdcbec5389
commit
85e85129f8
|
@ -44,9 +44,9 @@ def lib_get_cur_id():
|
||||||
global cur_lib_id
|
global cur_lib_id
|
||||||
return cur_lib_id
|
return cur_lib_id
|
||||||
|
|
||||||
def lib_filter(text):
|
#def lib_filter(text):
|
||||||
global library
|
# global library
|
||||||
library.filter(text)
|
# library.filter(text)
|
||||||
|
|
||||||
def lib_is_visible(text):
|
def lib_is_visible(text):
|
||||||
global library
|
global library
|
||||||
|
|
|
@ -9,6 +9,9 @@ tracks = None
|
||||||
next_id = None
|
next_id = None
|
||||||
sources = None
|
sources = None
|
||||||
size = None
|
size = None
|
||||||
|
visible = None
|
||||||
|
|
||||||
|
filtered = False
|
||||||
|
|
||||||
def reset():
|
def reset():
|
||||||
from tree import DLTree
|
from tree import DLTree
|
||||||
|
@ -30,6 +33,7 @@ def load():
|
||||||
global next_id
|
global next_id
|
||||||
global sources
|
global sources
|
||||||
global size
|
global size
|
||||||
|
global songs
|
||||||
objects = libsaria.data.load("library", ".dl_tree")
|
objects = libsaria.data.load("library", ".dl_tree")
|
||||||
if objects == None or len(objects) != 6:
|
if objects == None or len(objects) != 6:
|
||||||
reset()
|
reset()
|
||||||
|
@ -99,5 +103,23 @@ def play_id(id):
|
||||||
libsaria.music.load(filepath)
|
libsaria.music.load(filepath)
|
||||||
libsaria.music.play()
|
libsaria.music.play()
|
||||||
|
|
||||||
|
def filter(text):
|
||||||
|
global visible
|
||||||
|
global index
|
||||||
|
global filtered
|
||||||
|
|
||||||
|
if len(text) > 0:
|
||||||
|
visible = index.filter(text)
|
||||||
|
filtered = True
|
||||||
|
else:
|
||||||
|
visible = None
|
||||||
|
filtered = False
|
||||||
|
|
||||||
|
|
||||||
def is_visible(id):
|
def is_visible(id):
|
||||||
return True
|
global filtered
|
||||||
|
global visible
|
||||||
|
if filtered == False:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return id in visible
|
||||||
|
|
|
@ -104,7 +104,7 @@ class Library(Collection):
|
||||||
collection.inc_score(row[0], 1)
|
collection.inc_score(row[0], 1)
|
||||||
|
|
||||||
def filter(self, text):
|
def filter(self, text):
|
||||||
collection.lib_filter(text)
|
library.filter(text)
|
||||||
self.list.refilter()
|
self.list.refilter()
|
||||||
|
|
||||||
def refilter(self, list, iter):
|
def refilter(self, list, iter):
|
||||||
|
|
Loading…
Reference in New Issue