public void SetRadioTrackInfo(TreePath path, RadioTrackInfo track) { TreeIter iter; if (GetIter(out iter, path)) { SetRadioTrackInfo(iter, track); } }
private void OnPlayerStateChanged(object o, PlayerEngineStateArgs args) { view.QueueDraw(); if (args.State == PlayerEngineState.Loaded && PlayerEngineCore.CurrentTrack is RadioTrackInfo) { last_loaded_track = PlayerEngineCore.CurrentTrack as RadioTrackInfo; } }
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) { RadioTrackInfo radio_track = model.GetRadioTrackInfo(args.Path); if (radio_track != null) { radio_track.Play(); return; } Track track = model.GetTrack(args.Path); if (track == null) { return; } radio_track = new RadioTrackInfo(track); radio_track.ParsingPlaylistEvent += OnTrackParsingPlaylistEvent; model.SetRadioTrackInfo(args.Path, radio_track); radio_track.Play(); }
private void OnCopyUri(object o, EventArgs args) { Track track = view.SelectedTrack; RadioTrackInfo radio_track = view.SelectedRadioTrackInfo; string uri = null; if (radio_track != null) { uri = radio_track.Uri.AbsoluteUri; } else if (track != null && track.Locations.Count > 0) { uri = track.Locations[0].AbsoluteUri; } else { return; } Clipboard clipboard = Clipboard.Get(Gdk.Selection.Clipboard); clipboard.Text = uri; }
public void SetRadioTrackInfo(TreeIter iter, RadioTrackInfo track) { SetValue(iter, 3, 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); }
protected override void Render(Gdk.Drawable drawable, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags) { StateType state = RendererStateToWidgetState(flags); int text_indent = 6; int text_layout_width, text_layout_height; Gdk.Pixbuf render_icon = radio_icon; Track track = null; RadioTrackInfo radio_track = null; string text = Text; if (widget is TreeView) { TreePath path; if ((widget as TreeView).GetPathAtPos(cell_area.X, cell_area.Y, out path)) { track = model.GetTrack(path); radio_track = model.GetRadioTrackInfo(path); } } FontDescription font_description = widget.PangoContext.FontDescription.Copy(); if (playing_icon != null && track != null && PlayerEngineCore.CurrentTrack is RadioTrackInfo && (PlayerEngineCore.CurrentTrack as RadioTrackInfo).XspfTrack.Title == track.Title && (PlayerEngineCore.CurrentTrack as RadioTrackInfo).XspfTrack.Annotation == track.Annotation) { render_icon = playing_icon; font_description.Style = Pango.Style.Normal; font_description.Weight = Pango.Weight.Bold; } else if (radio_track != null && radio_track.ParsingPlaylist) { render_icon = loading_icon; font_description.Style = Pango.Style.Italic; font_description.Weight = Pango.Weight.Normal; text = String.Format("{0}: {1}", Catalog.GetString("Loading"), Text); } else if (radio_track != null && radio_track.PlaybackError != TrackPlaybackError.None) { render_icon = error_icon; font_description.Style = Pango.Style.Italic; font_description.Weight = Pango.Weight.Normal; string prefix = null; switch (radio_track.PlaybackError) { case TrackPlaybackError.ResourceNotFound: prefix = Catalog.GetString("Missing"); break; case TrackPlaybackError.CodecNotFound: prefix = Catalog.GetString("No Codec"); break; case TrackPlaybackError.Unknown: prefix = Catalog.GetString("Unknown Error"); break; default: break; } if (prefix != null) { text = String.Format("({0}) {1}", prefix, Text); } if (!(CellRendererState.Selected & flags).Equals(CellRendererState.Selected)) { state = StateType.Insensitive; } if (track != null) { track.Title = String.Empty; } } else { font_description.Style = Pango.Style.Normal; font_description.Weight = Pango.Weight.Normal; } Gdk.GC main_gc = widget.Style.TextGC(state); if (track != null) { drawable.DrawPixbuf(main_gc, render_icon, 0, 0, cell_area.X - render_icon.Width, cell_area.Y + ((cell_area.Height - render_icon.Height) / 2), render_icon.Width, render_icon.Height, RgbDither.None, 0, 0); } else { text_indent = 0; } Pango.Layout text_layout = new Pango.Layout(widget.PangoContext); text_layout.FontDescription = font_description; text_layout.SetMarkup(GLib.Markup.EscapeText(text)); text_layout.GetPixelSize(out text_layout_width, out text_layout_height); drawable.DrawLayout(main_gc, cell_area.X + text_indent, cell_area.Y + ((cell_area.Height - text_layout_height) / 2), text_layout); }
private void OnViewRowActivated(object o, RowActivatedArgs args) { RadioTrackInfo radio_track = model.GetRadioTrackInfo(args.Path); if(radio_track != null) { radio_track.Play(); return; } Track track = model.GetTrack(args.Path); if(track == null) { return; } radio_track = new RadioTrackInfo(track); radio_track.ParsingPlaylistEvent += OnTrackParsingPlaylistEvent; model.SetRadioTrackInfo(args.Path, radio_track); radio_track.Play(); }
private void OnPlayerStateChanged(object o, PlayerEngineStateArgs args) { view.QueueDraw(); if(args.State == PlayerEngineState.Loaded && PlayerEngineCore.CurrentTrack is RadioTrackInfo) { last_loaded_track = PlayerEngineCore.CurrentTrack as RadioTrackInfo; } }
public void SetRadioTrackInfo(TreePath path, RadioTrackInfo track) { TreeIter iter; if(GetIter(out iter, path)) { SetRadioTrackInfo(iter, track); } }