Comment 8 for bug 1121254

Revision history for this message
Michael Schwendt (mschwendt) wrote :

Surprise, surprise! :) With the latest fixes for gstreamer.py bug 1123410, it becomes possible to wait for all TagReader tasks to complete before starting conversion.

As I currently still use the forwarded ConverterQueueFoo exceptions, which work extremely well so far, what I do is similar to this in ui.py:

in read_tags():
        self.tag_reader_tasks.append(tagreader) # maintain list of TagReader tasks

in tags_read() callback:
        self.tag_reader_tasks.remove(tagreader) # maintain list of TagReader tasks
       # only add files where TagReader was successful
        if sound_file.tags_read: # or if not True, alternatively store an error to be found by do_convert() before converter.start
            self.converter.add(sound_file)

in do_convert():
        self.tag_reader_tasks = []
        self.converter.abort() # to start with empty queues

and at the end of the enumerate(files) loop, when all TagReader tasks have been started (but may not have completed yet):

            while len(self.tag_reader_tasks)>0 and len(self.converter.waiting_tasks) < total:
                gtk_sleep(1)

Of course, in that loop I check the forwarded exceptions, too. So far, this even seems to be a work-around for Fedora 19 development.