#!/usr/bin/python from mediaserver.audioplayer import AudioPlayer from mediaserver.quickplayer import QuickPlayer from gi.repository import GObject import sys 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) #print "Attempting to play {0}".format(sys.argv[1]) player.play(sys.argv[1]) loop = GObject.MainLoop() loop.run()