internal static void QueuePodcastDownload(PodcastInfo pi) { if (pi == null || pi.DownloadInfo != null) { return; } DownloadInfo dif; if (pi.CanDownload) { try { dif = GetDownloadInfo(pi); pi.DownloadInfo = dif; pi.DownloadFailed = false; } catch { pi.DownloadFailed = true; return; } lock (downloads.SyncRoot) { downloads.Add(dif, pi); } DownloadCore.QueueDownload(dif); } }
public bool RemovePodcast(PodcastInfo pi, bool update) { if (podcasts == null) { throw new ArgumentNullException("podcasts"); } bool removed = false; if (pi != null) { lock (PodcastSync) { removed = RemovePodcastFromLibrary(pi, true); } if (update && removed) { PodcastEventArgs args = new PodcastEventArgs(pi); pi.Feed.UpdateCounts(); EmitPodcastRemoved(args); } } return(false); }
private static void DownloadDropped(DownloadInfo dif) { if (downloads.Contains(dif)) { PodcastInfo pi = downloads [dif] as PodcastInfo; if (pi == null) { return; } pi.DownloadFailed = (dif.State == DownloadState.Failed); if (pi.DownloadFailed) { PodcastErrorsSource.Instance.AddError( dif.RemoteUri.ToString(), Catalog.GetString("Download Failed"), null ); } pi.DownloadInfo = null; pi.IsQueued = false; downloads.Remove(dif); } }
public bool AddPodcast(PodcastInfo pi, bool update) { if (pi == null) { throw new ArgumentNullException("pi"); } bool new_podcast = false; if (pi != null) { lock (PodcastSync) { new_podcast = AddPodcastToLibrary(pi); } if (update && new_podcast) { PodcastEventArgs args = new PodcastEventArgs(pi); EmitPodcastAdded(args); } } return(false); }
public void Add(PodcastInfo pi) { if (pi == null) { throw new ArgumentNullException("pi"); } AddPodcast(pi, true); }
public int CompareTo(object o) { if (!(o is PodcastInfo)) { return(0); } PodcastInfo rhs = o as PodcastInfo; return(DateTime.Compare(rhs.pub_date, this.pub_date)); }
public PodcastPropertiesDialog(PodcastInfo pi) : base(pi.Title, InterfaceElements.MainWindow, DialogFlags.DestroyWithParent) { if (pi == null) { throw new ArgumentNullException ("pi"); } this.pi = pi; BuildWindow (); IconThemeUtils.SetWindowIcon (this); }
public static int Commit(PodcastInfo pi) { int ret = 0; if (pi.ID != 0) { ret = Globals.Library.Db.Execute(new DbCommand( @"UPDATE Podcasts SET PodcastFeedID=:feed_id, Title=:title, Link=:link, PubDate=:pubdate, Description=:description, Author=:author, LocalPath=:local_path, Url=:url, MimeType=:mimetype, Length=:length, Downloaded=:downloaded, Active=:active WHERE PodcastID=:podcast_id", "feed_id", pi.Feed.ID, "title", pi.Title, "link", pi.Link, "pubdate", pi.PubDate.ToString(), "description", pi.Description, "author", pi.Author, "local_path", pi.LocalPath, "url", pi.Url.ToString(), "mimetype", pi.MimeType, "length", pi.Length, "downloaded", Convert.ToInt32(pi.IsDownloaded), "active", Convert.ToInt32(pi.IsActive), "podcast_id", pi.ID )); } else { ret = Globals.Library.Db.Execute(new DbCommand( @"INSERT INTO Podcasts VALUES (NULL, :feed_id, :title, :link, :pubdate, :description, :author, :local_path, :url, :mimetype, :length, :downloaded, :active)", "feed_id", pi.Feed.ID, "title", pi.Title, "link", pi.Link, "pubdate", pi.PubDate.ToString(), "description", pi.Description, "author", pi.Author, "local_path", pi.LocalPath, "url", pi.Url.ToString(), "mimetype", pi.MimeType, "length", pi.Length, "downloaded", Convert.ToInt32(pi.IsDownloaded), "active", Convert.ToInt32(pi.IsActive) )); } return(ret); }
private static void DownloadRegistered(DownloadInfo dif) { if (downloads.Contains(dif)) { PodcastInfo pi = downloads [dif] as PodcastInfo; if (pi == null) { return; } pi.IsQueued = true; } }
public static void Deactivate(PodcastInfo pi) { if (pi == null) { throw new ArgumentNullException("pi"); } DbCommand query = new DbCommand( String.Format(@"{0} PodcastID = :id", base_podcast_deactivate_query), "id", pi.ID ); Globals.Library.Db.Execute(query); }
public bool AddTrack(TrackInfo ti, PodcastInfo pi, bool raiseUpdate) { bool ret = false; if (ti == null) { throw new ArgumentNullException("ti"); } else if (pi == null) { throw new ArgumentNullException("pi"); } if (ti.Album == null || ti.Album == String.Empty) { ti.Album = pi.Feed.Title; } else if (ti.Artist == null || ti.Artist == String.Empty) { ti.Artist = pi.Feed.Title; } else if (ti.Title == null || ti.Title == String.Empty) { ti.Title = pi.Title; } lock (TrackSync) { if (!tracks_keyed.ContainsKey(ti)) { tracks_keyed.Add(ti, pi); ret = true; } } if (ret && raiseUpdate) { TrackEventArgs args = new TrackEventArgs(); args.Track = ti; EmitTrackAdded(args); } return(ret); }
private void RemovePodcast(PodcastInfo pi, bool update) { if (pi == null) { throw new ArgumentNullException("pi"); } lock (podcasts.SyncRoot) { podcasts.Remove(pi); if (update) { PodcastDBManager.Delete(pi); UpdateCounts(); } } }
private void AddPodcast(PodcastInfo pi, bool update) { if (pi == null) { throw new ArgumentNullException("pi"); } lock (podcasts.SyncRoot) { podcasts.Add(pi); if (update) { podcasts.Sort(); UpdateCounts(); } } }
private bool AddPodcastToLibrary(PodcastInfo pi) { if (pi == null) { throw new ArgumentNullException("pi"); } bool ret = false; if (pi == null) { return(ret); } if (!podcasts.ContainsKey(pi.Key) && pi.IsActive) { //bool commit = false; podcasts.Add(pi.Key, pi); /*if (pi.ID == 0) { * commit = true; * }*/ if (pi.Track != null) { AddTrack(pi.Track, pi, true); } /*else if (pi.Track == null && pi.IsDownloaded) { * pi.IsDownloaded = false; * commit = true; * }*/ // TODO move this into PodcastInfo if (pi.ID == 0) { pi.ID = PodcastDBManager.Commit(pi); } ret = true; } return(ret); }
internal static void CancelPodcastDownload(PodcastInfo pi) { if (pi == null || pi.DownloadInfo == null) { return; } DownloadInfo dif = pi.DownloadInfo; if (dif != null) { lock (downloads.SyncRoot) { if (!downloads.Contains(dif)) { return; } DownloadCore.Cancel(dif); } } }
private static void DownloadTaskStartedOrStopped(DownloadInfo dif, bool started) { lock (downloads.SyncRoot) { if (downloads.Contains(dif)) { PodcastInfo pi = downloads [dif] as PodcastInfo; if (pi != null) { if (started) { pi.IsDownloading = true; } else { pi.IsDownloading = false; } } } } source.Update(); }
private void SyncPodcasts() { if (sync_preference == SyncPreference.None) { return; } lock (podcasts.SyncRoot) { if (sync_preference == SyncPreference.One) { if (podcasts.Count > 0) { PodcastInfo pi = podcasts [0] as PodcastInfo; QueuePodcastDownload(pi); } } else if (sync_preference == SyncPreference.All) { PodcastCore.QueuePodcastDownload(podcasts); } } }
private bool RemovePodcastFromLibrary(PodcastInfo pi, bool commit_podcast) { if (pi == null) { throw new ArgumentNullException("pi"); } if (pi.IsQueued) { return(false); } podcasts.Remove(pi.Key); if (pi.Track != null) { ThreadAssist.ProxyToMain(delegate { RemoveTrack(pi.Track, true); }); } if (!pi.IsActive) { return(true); } else { pi.IsActive = false; } if (commit_podcast) { PodcastDBManager.Deactivate(pi); } return(true); }
public bool AddPodcast(PodcastInfo pi, bool update) { if (pi == null) { throw new ArgumentNullException ("pi"); } bool new_podcast = false; if (pi != null) { lock (PodcastSync) { new_podcast = AddPodcastToLibrary (pi); } if (update && new_podcast) { PodcastEventArgs args = new PodcastEventArgs (pi); EmitPodcastAdded (args); } } return false; }
//--------------------------------------------------------- public bool AddPodcast(PodcastInfo pi) { return AddPodcast (pi, true); }
private bool RemovePodcastFromLibrary(PodcastInfo pi, bool commit_podcast) { if (pi == null) { throw new ArgumentNullException ("pi"); } if (pi.IsQueued) { return false; } podcasts.Remove (pi.Key); if (pi.Track != null) { ThreadAssist.ProxyToMain (delegate { RemoveTrack (pi.Track, true); }); } if (!pi.IsActive) { return true; } else { pi.IsActive = false; } if (commit_podcast) { PodcastDBManager.Deactivate (pi); } return true; }
private bool AddPodcastToLibrary(PodcastInfo pi) { if (pi == null) { throw new ArgumentNullException ("pi"); } bool ret = false; if (pi == null) { return ret; } if (!podcasts.ContainsKey (pi.Key) && pi.IsActive) { //bool commit = false; podcasts.Add (pi.Key, pi); /*if (pi.ID == 0) { commit = true; }*/ if (pi.Track != null) { AddTrack (pi.Track, pi, true); } /*else if (pi.Track == null && pi.IsDownloaded) { pi.IsDownloaded = false; commit = true; }*/ // TODO move this into PodcastInfo if (pi.ID == 0) { pi.ID = PodcastDBManager.Commit (pi); } ret = true; } return ret; }
// Adapted from Monopod private void LoadPodcastsFromXml() { string enc_url; string mime_type; string pubDate; Hashtable tmp_podcast_hash = new Hashtable (); PodcastInfo tmpPi; XmlNodeList items = xml_doc.SelectNodes ("//item"); foreach (XmlNode item in items) { try { enc_url = FeedUtil.GetXmlNodeText (item, "enclosure/@url").Trim (); if (enc_url == String.Empty) { continue; } mime_type = FeedUtil.GetXmlNodeText (item, "enclosure/@type").Trim (); if (!FeedUtil.KnownType (mime_type)) { continue; } tmpPi = new PodcastInfo (feed, enc_url); tmpPi.MimeType = mime_type; try { tmpPi.Length = Convert.ToInt64( FeedUtil.GetXmlNodeText (item, "enclosure/@length").Trim() ); } catch { tmpPi.Length = 0; } tmpPi.Title = StringUtils.StripHTML (FeedUtil.GetXmlNodeText (item, "title").Trim()); tmpPi.Author = StringUtils.StripHTML (FeedUtil.GetXmlNodeText (item, "author").Trim()); tmpPi.Link = FeedUtil.GetXmlNodeText (item, "link").Trim(); tmpPi.Description = StringUtils.StripHTML (FeedUtil.GetXmlNodeText (item, "description").Trim()); pubDate = FeedUtil.GetXmlNodeText (item, "pubDate").Trim(); try { tmpPi.PubDate = RFC822DateTime.Parse (pubDate); } catch { tmpPi.PubDate = DateTime.MinValue; } // Some feeds actually release multiple episodes w\ the same file name. Gah! if (tmp_podcast_hash.Contains (enc_url)) { continue; } tmp_podcast_hash.Add (enc_url, tmpPi); } catch { continue; } } if (tmp_podcast_hash.Values.Count > 0) { PodcastInfo[] tmp_podcasts = new PodcastInfo [tmp_podcast_hash.Values.Count]; tmp_podcast_hash.Values.CopyTo (tmp_podcasts, 0); Array.Sort (tmp_podcasts); podcasts = tmp_podcasts; } }
private void EmitFeedUpdated(PodcastInfo[] newPodcasts, PodcastInfo[] removedPodcasts) { FeedPodcastsUpdatedEventHandler handler = PodcastsUpdated; if (handler != null) { handler (this, new FeedPodcastsUpdatedEventArgs (newPodcasts, removedPodcasts)); } }
public PodcastEventArgs(PodcastInfo podcast) : this(podcast, null) { }
public bool RemovePodcast(PodcastInfo pi) { return RemovePodcast (pi, true); }
public static int Commit(PodcastInfo pi) { int ret = 0; if (pi.ID != 0) { ret = Globals.Library.Db.Execute(new DbCommand( @"UPDATE Podcasts SET PodcastFeedID=:feed_id, Title=:title, Link=:link, PubDate=:pubdate, Description=:description, Author=:author, LocalPath=:local_path, Url=:url, MimeType=:mimetype, Length=:length, Downloaded=:downloaded, Active=:active WHERE PodcastID=:podcast_id", "feed_id", pi.Feed.ID, "title", pi.Title, "link", pi.Link, "pubdate", pi.PubDate.ToString (), "description", pi.Description, "author", pi.Author, "local_path", pi.LocalPath, "url", pi.Url.ToString (), "mimetype", pi.MimeType, "length", pi.Length, "downloaded", Convert.ToInt32(pi.IsDownloaded), "active", Convert.ToInt32(pi.IsActive), "podcast_id", pi.ID )); } else { ret = Globals.Library.Db.Execute(new DbCommand( @"INSERT INTO Podcasts VALUES (NULL, :feed_id, :title, :link, :pubdate, :description, :author, :local_path, :url, :mimetype, :length, :downloaded, :active)", "feed_id", pi.Feed.ID, "title", pi.Title, "link", pi.Link, "pubdate", pi.PubDate.ToString (), "description", pi.Description, "author", pi.Author, "local_path", pi.LocalPath, "url", pi.Url.ToString (), "mimetype", pi.MimeType, "length", pi.Length, "downloaded", Convert.ToInt32(pi.IsDownloaded), "active", Convert.ToInt32(pi.IsActive) )); } return ret; }
private void RemovePodcast(PodcastInfo pi, bool update) { if (pi == null) { throw new ArgumentNullException ("pi"); } lock (podcasts.SyncRoot) { podcasts.Remove (pi); if (update) { PodcastDBManager.Delete (pi); UpdateCounts (); } } }
public bool AddTrack(TrackInfo ti, PodcastInfo pi, bool raiseUpdate) { bool ret = false; if (ti == null) { throw new ArgumentNullException ("ti"); } else if (pi == null) { throw new ArgumentNullException ("pi"); } if (ti.Album == null || ti.Album == String.Empty) { ti.Album = pi.Feed.Title; } else if (ti.Artist == null || ti.Artist == String.Empty) { ti.Artist = pi.Feed.Title; } else if (ti.Title == null || ti.Title == String.Empty) { ti.Title = pi.Title; } lock (TrackSync) { if (!tracks_keyed.ContainsKey (ti)) { tracks_keyed.Add (ti, pi); ret = true; } } if (ret && raiseUpdate) { TrackEventArgs args = new TrackEventArgs (); args.Track = ti; EmitTrackAdded (args); } return ret; }
public bool RemovePodcast(PodcastInfo pi) { return(RemovePodcast(pi, true)); }
private bool IsStreaming(PodcastInfo pi) { // TODO: Change this, not safe if (pi.Url == null || PlayerEngineCore.CurrentSafeUri == null) { return false; } try { return (pi.Url.ToString () == PlayerEngineCore.CurrentSafeUri.ToString ()); } catch { return false; } }
private static DownloadInfo GetDownloadInfo(PodcastInfo pi) { return(DownloadCore.CreateDownloadInfo(pi.Url.ToString(), pi.LocalDirectoryPath, pi.Length)); }
public static void Delete(PodcastInfo pi) { if (pi == null) { throw new ArgumentNullException ("pi"); } DbCommand query = new DbCommand( String.Format(@"{0} PodcastID = :id", base_podcast_remove_query), "id", pi.ID ); Globals.Library.Db.Execute(query); }
private void UpdatePodcasts(PodcastInfo[] remotePodcasts) { PodcastInfo[] new_podcasts = null; PodcastInfo[] zombie_podcasts = null; bool updated = false; ICollection tmp_new = null; ICollection tmp_remove = null; lock (podcasts.SyncRoot) { if (podcasts.Count > 0) { tmp_new = Diff (podcasts, remotePodcasts); tmp_remove = Diff (remotePodcasts, podcasts); } else { tmp_new = remotePodcasts; } } if (tmp_remove != null) { ArrayList double_killed_zombies = new ArrayList (); foreach (PodcastInfo zombie in tmp_remove) { if ((!zombie.IsDownloaded || !zombie.IsActive) && !zombie.IsQueued) { zombie.IsActive = false; double_killed_zombies.Add (zombie); } } if (double_killed_zombies.Count > 0) { zombie_podcasts = double_killed_zombies.ToArray ( typeof(PodcastInfo)) as PodcastInfo[]; } } if (tmp_new != null) { ICollection add_list = PodcastCore.Library.AddPodcasts (tmp_new); if (add_list.Count > 0) { Add (add_list); NewPodcasts = add_list.Count; updated = true; } if (updated) { new_podcasts = new PodcastInfo [add_list.Count]; add_list.CopyTo (new_podcasts, 0); } } if (zombie_podcasts != null) { Remove (zombie_podcasts); PodcastCore.Library.RemovePodcasts (zombie_podcasts); updated = true; } if (updated) { EmitFeedUpdated (new_podcasts, zombie_podcasts); } }
//--------------------------------------------------------- public bool AddPodcast(PodcastInfo pi) { return(AddPodcast(pi, true)); }
private PodcastEventArgs(PodcastInfo podcast, ICollection podcasts) { this.podcast = podcast; this.podcasts = podcasts; }
private void UpdatePodcasts(PodcastInfo[] remotePodcasts) { PodcastInfo[] new_podcasts = null; PodcastInfo[] zombie_podcasts = null; bool updated = false; ICollection tmp_new = null; ICollection tmp_remove = null; lock (podcasts.SyncRoot) { if (podcasts.Count > 0) { tmp_new = Diff(podcasts, remotePodcasts); tmp_remove = Diff(remotePodcasts, podcasts); } else { tmp_new = remotePodcasts; } } if (tmp_remove != null) { ArrayList double_killed_zombies = new ArrayList(); foreach (PodcastInfo zombie in tmp_remove) { if ((!zombie.IsDownloaded || !zombie.IsActive) && !zombie.IsQueued) { zombie.IsActive = false; double_killed_zombies.Add(zombie); } } if (double_killed_zombies.Count > 0) { zombie_podcasts = double_killed_zombies.ToArray( typeof(PodcastInfo)) as PodcastInfo[]; } } if (tmp_new != null) { ICollection add_list = PodcastCore.Library.AddPodcasts(tmp_new); if (add_list.Count > 0) { Add(add_list); NewPodcasts = add_list.Count; updated = true; } if (updated) { new_podcasts = new PodcastInfo [add_list.Count]; add_list.CopyTo(new_podcasts, 0); } } if (zombie_podcasts != null) { Remove(zombie_podcasts); PodcastCore.Library.RemovePodcasts(zombie_podcasts); updated = true; } if (updated) { EmitFeedUpdated(new_podcasts, zombie_podcasts); } }
private void Remove(PodcastInfo pi) { lock (podcasts.SyncRoot) { RemovePodcast (pi, true); } }
private void AddPodcast(PodcastInfo pi, bool update) { if (pi == null) { throw new ArgumentNullException ("pi"); } lock (podcasts.SyncRoot) { podcasts.Add (pi); if (update) { podcasts.Sort (); UpdateCounts (); } } }
private static void OnDownloadCompletedHandler(object sender, DownloadCompletedEventArgs args) { DownloadInfo dif = args.DownloadInfo; SafeUri local_uri = new SafeUri(args.LocalUri); if (dif == null || local_uri == null) { return; } PodcastInfo pi = null; lock (downloads.SyncRoot) { if (downloads.Contains(dif)) { pi = downloads [args.DownloadInfo] as PodcastInfo; } } if (pi != null) { TrackInfo ti = null; try { try { ti = new LibraryTrackInfo(local_uri.LocalPath); } catch (ApplicationException) { ti = Globals.Library.TracksFnKeyed [PathUtil.MakeFileNameKey(local_uri)] as TrackInfo; } } catch (Exception e) { PodcastErrorsSource.Instance.AddError( local_uri.ToString(), Catalog.GetString("Unable to add file to library"), e ); } pi.IsDownloaded = true; if (ti != null) { pi.Track = ti; } else { pi.DownloadFailed = true; PodcastDBManager.Commit(pi); return; } pi.LocalPath = local_uri.ToString(); PodcastDBManager.Commit(pi); pi.Feed.UpdateCounts(); ThreadAssist.ProxyToMain(delegate { Library.AddTrack(ti, pi, true); }); } source.Update(); }
internal static void CancelPodcastDownload(PodcastInfo pi) { if (pi == null || pi.DownloadInfo == null) { return; } DownloadInfo dif = pi.DownloadInfo; if (dif != null) { lock (downloads.SyncRoot) { if (!downloads.Contains (dif)) { return; } DownloadCore.Cancel (dif); } } }
// Adapted from Monopod private void LoadPodcastsFromXml() { string enc_url; string mime_type; string pubDate; Hashtable tmp_podcast_hash = new Hashtable(); PodcastInfo tmpPi; XmlNodeList items = xml_doc.SelectNodes("//item"); foreach (XmlNode item in items) { try { enc_url = FeedUtil.GetXmlNodeText(item, "enclosure/@url").Trim(); if (enc_url == String.Empty) { continue; } mime_type = FeedUtil.GetXmlNodeText(item, "enclosure/@type").Trim(); if (!FeedUtil.KnownType(mime_type)) { continue; } tmpPi = new PodcastInfo(feed, enc_url); tmpPi.MimeType = mime_type; try { tmpPi.Length = Convert.ToInt64( FeedUtil.GetXmlNodeText(item, "enclosure/@length").Trim() ); } catch { tmpPi.Length = 0; } tmpPi.Title = StringUtils.StripHTML(FeedUtil.GetXmlNodeText(item, "title").Trim()); tmpPi.Author = StringUtils.StripHTML(FeedUtil.GetXmlNodeText(item, "author").Trim()); tmpPi.Link = FeedUtil.GetXmlNodeText(item, "link").Trim(); tmpPi.Description = StringUtils.StripHTML(FeedUtil.GetXmlNodeText(item, "description").Trim()); pubDate = FeedUtil.GetXmlNodeText(item, "pubDate").Trim(); try { tmpPi.PubDate = RFC822DateTime.Parse(pubDate); } catch { tmpPi.PubDate = DateTime.MinValue; } // Some feeds actually release multiple episodes w\ the same file name. Gah! if (tmp_podcast_hash.Contains(enc_url)) { continue; } tmp_podcast_hash.Add(enc_url, tmpPi); } catch { continue; } } if (tmp_podcast_hash.Values.Count > 0) { PodcastInfo[] tmp_podcasts = new PodcastInfo [tmp_podcast_hash.Values.Count]; tmp_podcast_hash.Values.CopyTo(tmp_podcasts, 0); Array.Sort(tmp_podcasts); podcasts = tmp_podcasts; } }
internal static void QueuePodcastDownload(PodcastInfo pi) { if (pi == null || pi.DownloadInfo != null) { return; } DownloadInfo dif; if (pi.CanDownload) { try { dif = GetDownloadInfo (pi); pi.DownloadInfo = dif; pi.DownloadFailed = false; } catch { pi.DownloadFailed = true; return; } lock (downloads.SyncRoot) { downloads.Add (dif, pi); } DownloadCore.QueueDownload (dif); } }
private void QueuePodcastDownload(PodcastInfo pi) { if (pi.CanDownload) { PodcastCore.QueuePodcastDownload (pi); } }
private static DownloadInfo GetDownloadInfo(PodcastInfo pi) { return DownloadCore.CreateDownloadInfo ( pi.Url.ToString (), pi.LocalDirectoryPath, pi.Length); }
public FeedPodcastsUpdatedEventArgs(PodcastInfo[] newPodcasts, PodcastInfo[] removedPodcasts) { new_podcasts = newPodcasts; zombie_podcasts = removedPodcasts; }
public bool RemovePodcast(PodcastInfo pi, bool update) { if (podcasts == null) { throw new ArgumentNullException ("podcasts"); } bool removed = false; if (pi != null) { lock (PodcastSync) { removed = RemovePodcastFromLibrary (pi, true); } if (update && removed) { PodcastEventArgs args = new PodcastEventArgs (pi); pi.Feed.UpdateCounts (); EmitPodcastRemoved (args); } } return false; }
private void OnLibraryTrackRemoved(object sender, LibraryTrackRemovedArgs args) { if (args.Track != null) { PodcastInfo pi = null; TrackInfo ti = args.Track; if (BadTrackHash(ti)) { return; } lock (TrackSync) { if (tracks_keyed.ContainsKey(ti)) { pi = tracks_keyed [ti] as PodcastInfo; } else { return; } } if (pi != null) { Console.WriteLine(pi); RemovePodcast(pi); } } else if (args.Tracks != null) { ArrayList podcast_remove_list = new ArrayList(); lock (TrackSync) { PodcastInfo tmpPi; foreach (TrackInfo ti in args.Tracks) { if (ti != null) { tmpPi = null; if (BadTrackHash(ti)) { continue; } if (tracks_keyed.ContainsKey(ti)) { tmpPi = tracks_keyed [ti] as PodcastInfo; } if (tmpPi != null) { podcast_remove_list.Add(tmpPi); } } } } if (podcast_remove_list.Count > 0) { RemovePodcasts(podcast_remove_list); UpdateParentFeeds(podcast_remove_list); } } }
public void Add(PodcastInfo pi) { if (pi == null) { throw new ArgumentNullException ("pi"); } AddPodcast (pi, true); }