private Widget RenderTrack(XmlNode node, int rank) { Button track_button = new Button(); track_button.Relief = ReliefStyle.None; HBox box = new HBox(); Label label = new Label(); label.Ellipsize = Pango.EllipsizeMode.End; label.Xalign = 0; label.Markup = String.Format("{0}. {1}", rank, GLib.Markup.EscapeText(node.SelectSingleNode("name").InnerText).Trim()); if (node.SelectSingleNode("track_id") != null) { box.PackEnd(new Image(Gdk.Pixbuf.LoadFromResource("play.png")), false, false, 0); track_button.Clicked += delegate(object o, EventArgs args) { PlayerEngineCore.OpenPlay(Globals.Library.GetTrack(Convert.ToInt32(node.SelectSingleNode("track_id").InnerText))); }; } else { track_button.Clicked += delegate(object o, EventArgs args) { Gnome.Url.Show(node.SelectSingleNode("url").InnerText); }; } box.PackStart(label, true, true, 0); track_button.Add(box); return(track_button); }
public void Play() { if (!loaded) { OnParsingPlaylistStarted(); ThreadAssist.Spawn(delegate { LoadStreamUris(); }); return; } Title = track.Title; Artist = track.Creator; Album = null; Duration = TimeSpan.Zero; CoverArtFileName = null; lock (((ICollection)stream_uris).SyncRoot) { if (stream_uris.Count > 0) { Uri = stream_uris[stream_index]; PlayerEngineCore.OpenPlay(this); } } }
private void Play(TrackInfo ti) { if (ti.CanPlay) { PlayerEngineCore.OpenPlay(ti); } }
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); }