MainLoop loop;

public async void parse_all ()
{
    var file = File.new_for_path (".");
    var it = file.enumerate_children (FILE_ATTRIBUTE_STANDARD_NAME, FileQueryInfoFlags.NONE, null);
    var parser = new GUPnP.DIDLLiteParser();

    parser.item_available.connect (() => {
        Idle.add (parse_all.callback);
    });

    var info = it.next_file (null);
    while (info != null) {
        var name = info.get_name ();
        if (name.has_prefix ("DIDL-Item")) {
            uint8[] content;
            //string content;
            var xml = file.get_child (name);
            xml.load_contents (null, out content, null);
            parser.parse_didl ((string) content);
            yield;
        }
        info = it.next_file (null);
    }

    loop.quit ();
}

int main()
{

    parse_all ();
    loop = new MainLoop (null);
    loop.run ();

    return 0;
}
