import sys
from gi.repository import Gst
from gi.repository import GstPbutils
from gi.repository import GLib

Gst.init([])
loop = GLib.MainLoop()

def discoveredCb(discoverer, info, error):
    print "discovered %s asynchroneously" % info

def finishDiscovererCb(discoverer):
    print "discoverer finished"
    loop.quit()

discoverer = GstPbutils.Discoverer.new(Gst.SECOND)
discoverer.connect("discovered", discoveredCb)
discoverer.connect("finished", finishDiscovererCb)
discoverer.start()
print "started"
discoverer.discover_uri_async("file:///home/cymacs/disco/2012_01_08%20glas.avi")
for filename in sys.argv[1:]:
    discoverer.discover_uri_async(Gst.filename_to_uri(filename))
loop.run()
print "reached the end of the script"
