/// <summary> /// Handles the RefreshLiveRadioAction. Initiates a reload of the active source/plugin's genre list /// and resets the active child source's view /// </summary> /// <param name="o"> /// A <see cref="System.Object"/> -- not used /// </param> /// <param name="e"> /// A <see cref="EventArgs"/> -- not used /// </param> protected void OnRefreshPlugin(object o, EventArgs e) { LiveRadioPluginSource current_source = ServiceManager.SourceManager.ActiveSource as LiveRadioPluginSource; if (current_source == null) { return; } foreach (ILiveRadioPlugin plugin in plugins) { if (plugin.PluginSource != null && plugin.PluginSource.Equals(current_source)) { plugin.RetrieveGenreList(); LiveRadioPluginSourceContents source_contents = current_source.Properties.Get <ISourceContents> ("Nereid.SourceContents") as LiveRadioPluginSourceContents; if (source_contents != null) { source_contents.InitRefresh(); } return; } } }
/// <summary> /// Constructor -- creates a new temporary LiveRadio Plugin source and sets itself as the plugin's source /// Any tracks that have remained in the source from a previous (interrupted) session are purged /// </summary> /// <param name="plugin"> /// A <see cref="ILiveRadioPlugin"/> -- the plugin the source is created for /// </param> public LiveRadioPluginSource(ILiveRadioPlugin plugin) : base(AddinManager.CurrentLocalizer.GetString("LiveRadioPlugin") + plugin.Name, plugin.Name, "live-radio-plugin-" + plugin.Name.ToLower(), sort_order) { TypeUniqueId = "live-radio-" + plugin.Name; IsLocal = false; Gdk.Pixbuf icon = new Gdk.Pixbuf(System.Reflection.Assembly.GetExecutingAssembly() .GetManifestResourceStream("LiveRadioIcon.svg")); SetIcon(icon); plugin.SetLiveRadioPluginSource(this); this.plugin = plugin; AfterInitialized(); Properties.Set <bool> ("Nereid.SourceContentsPropagate", true); Properties.SetString("TrackView.ColumnControllerXml", String.Format(@" <column-controller> <!--<column modify-default=""IndicatorColumn""> <renderer type=""Banshee.Podcasting.Gui.ColumnCellPodcastStatusIndicator"" /> </column>--> <add-default column=""IndicatorColumn"" /> <add-default column=""GenreColumn"" /> <column modify-default=""GenreColumn""> <visible>false</visible> </column> <add-default column=""TitleColumn"" /> <column modify-default=""TitleColumn""> <title>{0}</title> <long-title>{0}</long-title> </column> <add-default column=""ArtistColumn"" /> <column modify-default=""ArtistColumn""> <title>{1}</title> <long-title>{1}</long-title> </column> <add-default column=""CommentColumn"" /> <column modify-default=""CommentColumn""> <title>{2}</title> <long-title>{2}</long-title> </column> <add-default column=""RatingColumn"" /> <add-default column=""PlayCountColumn"" /> <add-default column=""LastPlayedColumn"" /> <add-default column=""LastSkippedColumn"" /> <add-default column=""DateAddedColumn"" /> <add-default column=""UriColumn"" /> <sort-column direction=""asc"">genre</sort-column> </column-controller>", AddinManager.CurrentLocalizer.GetString("Station"), AddinManager.CurrentLocalizer.GetString("Creator"), AddinManager.CurrentLocalizer.GetString("Description") )); ServiceManager.PlayerEngine.TrackIntercept += OnPlayerEngineTrackIntercept; TrackEqualHandler = delegate(DatabaseTrackInfo a, TrackInfo b) { RadioTrackInfo radio_track = b as RadioTrackInfo; return(radio_track != null && DatabaseTrackInfo.TrackEqual(radio_track.ParentTrack as DatabaseTrackInfo, a)); }; source_contents = new LiveRadioPluginSourceContents(plugin); source_contents.SetSource(this); Properties.Set <ISourceContents> ("Nereid.SourceContents", source_contents); this.PurgeTracks(); }