mediaserver/test_basicplayer.py

45 lines
1.0 KiB
Python
Raw Normal View History

2018-09-24 12:42:16 +02:00
#!/usr/bin/python
from mediaserver.audioplayer import AudioPlayer
from mediaserver.quickplayer import QuickPlayer
from gi.repository import GObject
import sys
2018-09-24 12:42:16 +02:00
def onReady(player, file, tags):
print "Starting {0} ...\n".format(file)
print " Tags:\n"
for tag in tags:
print " {0} : '{1}'\n".format(tag,tags[tag])
duration = player.duration()
pos = player.position()
print "Song duration is {0} seconds".format(duration)
print "Current position is {0} seconds".format(pos)
player.playfor(20)
def onPlaying(player):
print "Playing ..."
#print "Jumping to 40 seconds"
#player.seek(40)
def onStop(player):
print "Quitting...."
loop.quit()
player = QuickPlayer()
#player.connect("playback-ready",onReady)
#player.connect("playback-playing",onPlaying)
#player.connect("playback-finished",onStop)
#player.connect("playback-stopped",onStop)
2018-09-24 12:42:16 +02:00
#print "Attempting to play {0}".format(sys.argv[1])
player.play(sys.argv[1])
2018-09-24 12:42:16 +02:00
loop = GObject.MainLoop()
loop.run()