private void InitializeInterface() { source = new PodcastSource(); ServiceManager.SourceManager.AddSource(source); actions = new PodcastActions(source); }
private void addPodcastButton_Click(object sender, RoutedEventArgs e) { try { var parent = GetSelectedSource(); var source = new PodcastSource { Name = "New Podcast", Path = "unknown", Parent = parent }; if (parent != null) { parent.AddChild(source); } else { boundSources.Add(source); } } catch (Exception ex) { log.Error("SourceView.addPodcastButton_Click", ex); MessageBox.Show("There was an error trying to add a podcast.\n\n" + ex.Message, "Could Not Add Podcast"); } }
private void SetTableView() { var source = new PodcastSource(_tableView, ViewModel.Podcast.Channel, ViewModel.LocationResources); _tableView.Source = source; _tableView.SeparatorStyle = UITableViewCellSeparatorStyle.None; _tableView.TableHeaderView = new UIView(new CGRect(0, 0, 0, PodcastHeaderView.Height)); //_tableView.RowHeight = UITableView.AutomaticDimension; //_tableView.EstimatedRowHeight = 50f; var podcastTableHeader = PodcastHeaderView.Create(); podcastTableHeader.Configure(ViewModel.Podcast.ArtworkLarge); podcastTableHeader.Frame = _tableView.TableHeaderView.Frame; _tableView.TableHeaderView.AddSubview(podcastTableHeader); source.OnPlayPressEvent -= OnSource_PlayPressEvent; source.OnPlayPressEvent += OnSource_PlayPressEvent; source.OnWebSiteClickEvent -= OnSource_WebSiteClickEvent; source.OnWebSiteClickEvent += OnSource_WebSiteClickEvent; _tableView.ReloadData(); }
private static void DestroySource() { if (source != null) { PlayerEngineCore.StateChanged -= OnPlayerEngineStateChanged; SourceManager.RemoveSource(source); source.Dispose(); source = null; } }
private static void InitSource() { if (source == null) { PlayerEngineCore.StateChanged += OnPlayerEngineStateChanged; source = new PodcastSource(); SourceManager.AddSource(source); source.Load(); } }
public void DelayedInitialize() { download_manager = new DownloadManager(2, tmp_download_path); download_manager_iface = new DownloadManagerInterface(download_manager); download_manager_iface.Initialize(); feeds_manager = new FeedsManager(ServiceManager.DbConnection, download_manager, null); // Migrate data from 0.13.2 podcast tables, if they exist MigrateLegacyIfNeeded(); // Move incomplete downloads to the new cache location try { MigrateDownloadCache(); } catch (Exception e) { Hyena.Log.Exception("Couldn't migrate podcast download cache", e); } source = new PodcastSource(); ServiceManager.SourceManager.AddSource(source); InitializeInterface(); var preference = source.PreferencesPage["library-location"]["library-location"] as SchemaPreference <string>; preference.ValueChanged += delegate(Root obj) { feeds_manager.PodcastStorageDirectory = preference.Value; }; ThreadAssist.SpawnFromMain(delegate { feeds_manager.PodcastStorageDirectory = source.BaseDirectory; feeds_manager.FeedManager.ItemAdded += OnItemAdded; feeds_manager.FeedManager.ItemChanged += OnItemChanged; feeds_manager.FeedManager.ItemRemoved += OnItemRemoved; feeds_manager.FeedManager.FeedsChanged += OnFeedsChanged; if (DatabaseConfigurationClient.Client.Get <int> ("Podcast", "Version", 0) < 7) { Banshee.Library.LibrarySource music_lib = ServiceManager.SourceManager.MusicLibrary; if (music_lib != null) { string old_path = Path.Combine(music_lib.BaseDirectory, "Podcasts"); string new_path = source.BaseDirectory; SafeUri old_uri = new SafeUri(old_path); SafeUri new_uri = new SafeUri(new_path); if (old_path != null && new_path != null && old_path != new_path && Banshee.IO.Directory.Exists(old_path) && !Banshee.IO.Directory.Exists(new_path)) { Banshee.IO.Directory.Move(new SafeUri(old_path), new SafeUri(new_path)); ServiceManager.DbConnection.Execute(String.Format( "UPDATE {0} SET LocalPath = REPLACE(LocalPath, ?, ?) WHERE LocalPath IS NOT NULL", FeedEnclosure.Provider.TableName), old_path, new_path); ServiceManager.DbConnection.Execute(String.Format( "UPDATE CoreTracks SET Uri = REPLACE ({0}, ?, ?)" + "WHERE {0} LIKE 'file://%' AND PrimarySourceId = ?", Banshee.Query.BansheeQuery.UriField.Column), old_uri.AbsoluteUri, new_uri.AbsoluteUri, source.DbId); Hyena.Log.DebugFormat("Moved Podcasts from {0} to {1}", old_path, new_path); } } DatabaseConfigurationClient.Client.Set <int> ("Podcast", "Version", 7); } ServiceManager.PlayerEngine.ConnectEvent(OnPlayerEvent, PlayerEvent.StateChange); ServiceManager.Get <DBusCommandService> ().ArgumentPushed += OnCommandLineArgument; RefreshFeeds(); // Every 10 minutes try to refresh again refresh_timeout_id = Application.RunTimeout(1000 * 60 * 10, RefreshFeeds); ServiceManager.Get <Network> ().StateChanged += OnNetworkStateChanged; }); source.UpdateFeedMessages(); }
public PodcastImportManager(PodcastSource source) : base(source) { ForceCopy = false; }