Playlist filtering
The new playlist module can be filtered again.
This commit is contained in:
parent
73de67f386
commit
a40fc0d4ec
|
@ -16,7 +16,6 @@ QUEUE = 2
|
|||
import lens
|
||||
import library
|
||||
import playlist
|
||||
#playlist = lens.Playlist()
|
||||
|
||||
file_to_id = library.file_to_id
|
||||
play_id = library.play_id
|
||||
|
@ -45,16 +44,6 @@ def lib_get_cur_id():
|
|||
global cur_lib_id
|
||||
return cur_lib_id
|
||||
|
||||
def plist_is_visible(id):
|
||||
return True
|
||||
#global playlist
|
||||
#return playlist.is_visible(id)
|
||||
|
||||
def plist_filter(text):
|
||||
return True
|
||||
#global playlist
|
||||
#return playlist.filter(text)
|
||||
|
||||
def plist_refresh():
|
||||
return call("PLISTREFRESH")
|
||||
|
||||
|
|
|
@ -115,6 +115,9 @@ def filter(text):
|
|||
visible = None
|
||||
filtered = False
|
||||
|
||||
def test_filter(text):
|
||||
return index.filter(text)
|
||||
|
||||
def is_visible(id):
|
||||
global filtered
|
||||
global visible
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
# Bryan Schumaker (11/07/2010)
|
||||
|
||||
import libsaria
|
||||
from libsaria.collection import library
|
||||
|
||||
song_list = None
|
||||
song_set = None
|
||||
|
||||
filtered = False
|
||||
visible = None
|
||||
|
||||
def add_id(id):
|
||||
global song_list
|
||||
global song_set
|
||||
|
@ -20,6 +24,7 @@ def reset():
|
|||
def load():
|
||||
global song_list
|
||||
global song_set
|
||||
global visible
|
||||
song_list = libsaria.data.load("playlist", ".list")
|
||||
if song_list == None:
|
||||
reset()
|
||||
|
@ -34,3 +39,21 @@ def walk():
|
|||
global song_list
|
||||
for id in song_list:
|
||||
yield id
|
||||
|
||||
def filter(text):
|
||||
global visible
|
||||
global song_set
|
||||
global filtered
|
||||
if len(text) > 0:
|
||||
visible = song_set.intersection(library.test_filter(text))
|
||||
filtered = True
|
||||
else:
|
||||
visible = song_set
|
||||
filtered = False
|
||||
|
||||
def is_visible(id):
|
||||
global visible
|
||||
global filtered
|
||||
if filtered == True:
|
||||
return id in visible
|
||||
return True
|
||||
|
|
|
@ -166,8 +166,8 @@ class Playlist(Collection):
|
|||
collection.inc_score(row[0], 1)
|
||||
|
||||
def filter(self, text):
|
||||
collection.plist_filter(text)
|
||||
playlist.filter(text)
|
||||
self.list.refilter()
|
||||
|
||||
def refilter(self, list, iter):
|
||||
return collection.plist_is_visible(list[iter][0])
|
||||
return playlist.is_visible(list[iter][0])
|
||||
|
|
Loading…
Reference in New Issue