diff --git a/libsaria/collection/library.py b/libsaria/collection/library.py index 815fab20..892d5288 100644 --- a/libsaria/collection/library.py +++ b/libsaria/collection/library.py @@ -39,17 +39,16 @@ def load(): reset() return (fs_tree, tag_tree, index, tracks, next_id, size) = objects -load() + libsaria.event.start("POSTLIBLOAD") def save(): libsaria.data.save( (fs_tree, tag_tree, index, tracks, next_id, size), "library", ".dl_tree") -def walk_tags(): +def walk(): for tag in tag_tree.walk_forwards(): - rec = tracks[tag[3]] - yield tag + [rec.year] + [rec.lenstr] + yield tag[3] def file_to_id(file): global fs_tree diff --git a/libsaria/collection/playlist.py b/libsaria/collection/playlist.py index adfd6602..52b933f1 100644 --- a/libsaria/collection/playlist.py +++ b/libsaria/collection/playlist.py @@ -30,7 +30,6 @@ def load(): reset() return song_set = set(song_list) -load() def save(): libsaria.data.save(song_list, "playlist", ".list") diff --git a/ocarina/collection.py b/ocarina/collection.py index 11613b8f..55c437f8 100644 --- a/ocarina/collection.py +++ b/ocarina/collection.py @@ -34,16 +34,6 @@ class Collection(gtk.ScrolledWindow): self.list.clear() def populate(self, func): - self.list.freeze() - insert = self.list.list.insert - ins_next = 0 - for track in func(): - insert(ins_next, [track[3], track[2], - track[5], track[0], track[1], track[4]]) - ins_next += 1 - self.list.thaw() - - def populate2(self, func): self.list.freeze() insert = self.list.list.insert get_attrs = library.get_attrs @@ -75,7 +65,8 @@ class Library(Collection): def populate(self): #import datetime #before = datetime.datetime.now() - Collection.populate(self, library.walk_tags) + library.load() + Collection.populate(self, library.walk) #after = datetime.datetime.now() #print "Populating took: %s" % (after - before) @@ -108,7 +99,7 @@ class Playlist(Collection): actions.show_rc_menu = menu.make_plist_menu Collection.__init__(self, actions) - libsaria.event.invite("POSTSTART", self.populate, bg=True) + libsaria.event.invite("POSTLIBLOAD", self.populate, bg=True) libsaria.event.invite("PREPLISTREFRESH", self.refresh) def refresh(self, arg=None): @@ -124,7 +115,8 @@ class Playlist(Collection): #import datetime #before = datetime.datetime.now() #Collection.populate(self, collection.walk_plist) - Collection.populate2(self, playlist.walk) + playlist.load() + Collection.populate(self, playlist.walk) #after = datetime.datetime.now() #print "Populating took: %s" % (after - before)