Integrated updates from sailplayer
This commit is contained in:
parent
969d27b98e
commit
acc3ec8f2b
|
@ -48,6 +48,9 @@ class MediaService(dbus.service.Object):
|
|||
self.player.connect('volume-changed',self.onPlayerVolumeChanged) # parameters: volume
|
||||
self.player.connect('playback-buffering',self.onPlayerBuffering) # parameters: volume
|
||||
|
||||
self.loadcount = 0;
|
||||
self.loadmax = 1;
|
||||
|
||||
@dbus.service.method(dbus_interface='nl.miqra.MediaCore.Media', in_signature='s', out_signature='')
|
||||
def QuickPlay(self, file,):
|
||||
""" Directly play back a local file
|
||||
|
@ -77,17 +80,26 @@ class MediaService(dbus.service.Object):
|
|||
def LoadFile(self, file):
|
||||
""" Load a local file for playback
|
||||
"""
|
||||
if self.loadcount < self.loadmax:
|
||||
print "Loading file {0}".format(file)
|
||||
print file
|
||||
self.player.load(file)
|
||||
self.loadcount += 1;
|
||||
self.OnLoading("file://{0}".format(file))
|
||||
else:
|
||||
print "Skipping load of file {0} because maximum simultaneous loads ({1}) was reached. Wait until ready....".format(file,self.loadmax);
|
||||
|
||||
@dbus.service.method(dbus_interface='nl.miqra.MediaCore.Media', in_signature='s', out_signature='')
|
||||
def LoadUrl(self, uri):
|
||||
""" Load an url for playback
|
||||
"""
|
||||
print "Loading url {0}".format(file)
|
||||
if self.loadcount < self.loadmax:
|
||||
print "Loading url {0}".format(uri)
|
||||
self.player.load_uri(uri)
|
||||
self.loadcount += 1;
|
||||
self.OnLoading(uri)
|
||||
else:
|
||||
print "Skipping load of url {0} because maximum simultaneous loads ({1}) was reached. Wait until ready....".format(uri,self.loadmax);
|
||||
|
||||
@dbus.service.method(dbus_interface='nl.miqra.MediaCore.Media', in_signature='d', out_signature='')
|
||||
def PlayFor(self, duration):
|
||||
|
@ -147,6 +159,11 @@ class MediaService(dbus.service.Object):
|
|||
print " {0}: {1}".format(tag,taglist[tag])
|
||||
except Exception as x:
|
||||
print "Error converting value for '{0}':\n {1}".format(tag,x)
|
||||
|
||||
# reset load counter
|
||||
self.loadcount = 0;
|
||||
|
||||
# signal ready
|
||||
self.OnReady(filename,taglist)
|
||||
|
||||
def onPlayerPlaying(self,player):
|
||||
|
|
Loading…
Reference in New Issue
Block a user