public TotemPlParser.Result Parse(string url, bool fallback) { IntPtr url_as_native = GLib.Marshaller.StringToPtrGStrdup(url); int raw_ret = totem_pl_parser_parse(Handle, url_as_native, fallback); TotemPlParser.Result ret = (TotemPlParser.Result)raw_ret; GLib.Marshaller.Free(url_as_native); return(ret); }
private void OnViewRowActivated(object o, RowActivatedArgs args) { Station station = store.GetNode(args.Path) as Station; if (station == null || station is StationGroup) { return; } Link link = station.SelectedStream; if (link == null) { return; } string uri = link.Href; try { if (!Gnome.Vfs.Vfs.Initialized) { Gnome.Vfs.Vfs.Initialize(); } ArrayList uris = new ArrayList(); TotemPlParser.Parser parser = new TotemPlParser.Parser(); parser.Entry += delegate(object o, TotemPlParser.EntryArgs args) { uris.Add(args.Uri); }; TotemPlParser.Result result = parser.Parse(uri, false); if (result == TotemPlParser.Result.Success && uris.Count > 0) { uri = uris[0] as string; } } catch (Exception e) { Console.WriteLine("Could not parse URI with totem-plparser: " + e.Message); Console.WriteLine(e.StackTrace); } RadioTrackInfo track = new RadioTrackInfo(station, uri); PlayerEngineCore.OpenPlay(track); }