libsaria: Fix seeking through gui buttons

This commit is contained in:
Bryan Schumaker 2011-04-30 13:17:28 -04:00
parent e59243e51b
commit 3cb39f3fcd
3 changed files with 16 additions and 14 deletions

View File

@ -6,6 +6,7 @@ import threading
import pipeline
from libsaria import callbacks
from libsaria import prefs
from libsaria import controls
timedelta = datetime.timedelta
audio_lock = threading.Lock()
@ -96,7 +97,7 @@ def get_progress():
return position() / dur
return 0.0
#def bus_message(bus, message):
# if message.type == gst.MESSAGE_EOS:
# source_proc.next()
#pipeline.bus.connect("message", bus_message)
def bus_message(bus, message):
if message.type == gst.MESSAGE_EOS:
controls.catch_eos()
pipeline.bus.connect("message", bus_message)

View File

@ -46,8 +46,9 @@ def duration():
return float(dur)
def seek_to(new_spot):
if new_spot >= 0:
player.seek_simple(time, gst.SEEK_FLAG_FLUSH, new_spot)
if new_spot < 0:
new_spot = 0
player.seek_simple(time, gst.SEEK_FLAG_FLUSH, new_spot)
def seek(amount):
pos = position()

View File

@ -9,8 +9,8 @@ library = None
playlist = None
queue = None
call = None
invite = None
#call = None
#invite = None
expand = None
exists = None
@ -22,8 +22,8 @@ def init():
import libsaria
def init2():
global call
global invite
#global call
#global invite
global sources
global library
global playlist
@ -57,10 +57,10 @@ def pick_next():
def catch_eos(*args):
library.inc_count()
return call("NEXT", pick_next)
pick_next()
def next():
return call("NEXT", pick_next)
pick_next()
def play():
audio.play()
@ -85,10 +85,10 @@ def stop():
audio.stop()
def seek_forward():
libsaria.audio.seek_sec(5)
libsaria.audio.seek(5)
def seek_backward():
libsaria.audio.seek_sec(-5)
libsaria.audio.seek(-5)
def set_volume(prcnt):
audio.set_volume(prcnt)