data.py: Return after deciding to scan a new library

playlist: refresh during the PREPLISTREFRESH event, not the
POSTPLISTREFRESH event
This commit is contained in:
Bryan Schumaker 2010-10-21 07:55:21 -04:00
parent bb86a70ae4
commit f1fc5caf07
3 changed files with 12 additions and 3 deletions

View File

@ -39,6 +39,7 @@ def universal_open(file):
global plugin
if path.is_dir(file):
libsaria.collection.new_source(file)
return
file = file.replace("%20", " ")
split = path.splitext(file)
ext = split[1]

View File

@ -54,7 +54,10 @@ def duration():
if get_state() == gst.STATE_NULL:
return 0
if length == None:
length = player.query_duration(time)[0]
try:
length = player.query_duration(time)[0]
except:
length = 0
return float(length)
@ -63,7 +66,10 @@ def position():
global player
if get_state() == gst.STATE_NULL:
return float(0)
pos = player.query_position(time)[0]
try:
pos = player.query_position(time)[0]
except:
pos = 0
return float(pos)

View File

@ -58,9 +58,11 @@ class Collection(gtk.ScrolledWindow):
list.set_value(list_iter, len(list_row)-1, "Played: %s"%string)
def add_selected_to_playlist(self):
print "adding selected to playlist"
self.list.for_each_selected(collection.plist_add_libid)
collection.plist_save()
collection.plist_refresh()
print "done!"
class Library(Collection):
@ -112,7 +114,7 @@ class Playlist(Collection):
Collection.__init__(self, actions)
libsaria.event.invite("POSTSTART", self.populate, bg=True)
libsaria.event.invite("POSTPLISTREFRESH", self.refresh)
libsaria.event.invite("PREPLISTREFRESH", self.refresh)
def refresh(self, arg=None):
self.clear()