import gobject
gobject.threads_init()

import pygst
pygst.require('0.10')
import gst

from os.path import abspath
import sys
import threading

from mopidy.utils.path import path_to_uri, find_files

class Scanner(object):
    def __init__(self, folder, callback):
        self.uris = [path_to_uri(f) for f in find_files(folder)]
        self.callback = callback
        self.loop = gobject.MainLoop()

        self.pipe = gst.element_factory_make('playbin2')

        bus = self.pipe.get_bus()
        bus.add_signal_watch()
        bus.connect('message::tag', self.process_tags)
        bus.connect('message::error', self.process_error)

        self.next_uri()

    def process_tags(self, bus, message):
        data = message.parse_tag()
        self.callback(dict([(k, data[k]) for k in data.keys()]))
        self.next_uri()

    def process_error(self, bus, message):
        print message.parse_error()

    def next_uri(self):
        if not self.uris:
            return self.stop()

        self.pipe.set_state(gst.STATE_NULL)
        self.pipe.set_property('uri', self.uris.pop())
        self.pipe.set_state(gst.STATE_PAUSED)

    def start(self):
        self.loop.run()

    def stop(self):
        self.loop.quit()

@@ -245,24 +245,29 @@
 folder, 
+data_
 callback
 ):%0A     
@@ -258,16 +258,37 @@
 callback
+, error_callback=None
 ):%0A     
@@ -352,32 +352,37 @@
 )%5D%0A        self.
+data_
 callback = callb
@@ -376,16 +376,66 @@
 lback = 
+data_callback%0A        self.error_callback = error_
 callback
@@ -492,50 +492,148 @@
 elf.
-pipe = gst.element_factory_make('play
+uribin = gst.element_factory_make('uridecodebin')%0A        self.pipe = gst.element_factory_make('pipeline')%0A        self.pipe.add(self.uri
 bin
-2'
 )%0A%0A 
@@ -925,16 +925,21 @@
    self.
+data_
 callback
@@ -1062,33 +1062,190 @@
     
-print message.parse_error
+if self.error_callback:%0A            uri = self.uribin.get_property('uri')%0A            error = message.parse_error()%0A            self.error_callback(uri, *error)%0A        self.next_uri
 ()%0A%0A
@@ -1379,28 +1379,30 @@
        self.
-pipe
+uribin
 .set_propert

Add error callback and switch to using uridecodebin