private void LoadStreamUris()
        {
            lock (((ICollection)stream_uris).SyncRoot) {
                if (!Gnome.Vfs.Vfs.Initialized)
                {
                    Gnome.Vfs.Vfs.Initialize();
                }

                TotemPlParser.Parser parser = new TotemPlParser.Parser();
                parser.Entry += OnHavePlaylistEntry;

                foreach (Uri uri in track.Locations)
                {
                    try {
                        if (parser.Parse(uri.AbsoluteUri, false) == TotemPlParser.Result.Unhandled)
                        {
                            stream_uris.Add(new SafeUri(uri.AbsoluteUri));
                        }
                    } catch (Exception e) {
                        Console.WriteLine(e);
                    }
                }

                parser.Entry -= OnHavePlaylistEntry;
                parser        = null;

                loaded = true;
            }

            ThreadAssist.ProxyToMain(delegate {
                OnParsingPlaylistFinished();
                Play();
            });
        }
        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);
        }
        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);
        }
        private void LoadStreamUris()
        {
            lock(((ICollection)stream_uris).SyncRoot) {
                if(!Gnome.Vfs.Vfs.Initialized) {
                    Gnome.Vfs.Vfs.Initialize();
                }

                TotemPlParser.Parser parser = new TotemPlParser.Parser();
                parser.Entry += OnHavePlaylistEntry;

                foreach(Uri uri in track.Locations) {
                    try {
                        if(parser.Parse(uri.AbsoluteUri, false) == TotemPlParser.Result.Unhandled) {
                            stream_uris.Add(new SafeUri(uri.AbsoluteUri));
                        }
                    } catch(Exception e) {
                        Console.WriteLine(e);
                    }
                }

                parser.Entry -= OnHavePlaylistEntry;
                parser = null;

                loaded = true;
            }

            ThreadAssist.ProxyToMain(delegate {
                OnParsingPlaylistFinished();
                Play();
            });
        }