public static Episode GetEpisodeByUri(string enclosure) { try { return(Podcasts.SelectMany(p => p.Episodes).FirstOrDefault(e => !string.IsNullOrEmpty(e.Enclosure) && new Uri(e.Enclosure).ToString() == enclosure)); } catch { return(null); } }
public static async Task LoadCastFile(StorageFile libraryFile, bool merge) { SuccessfullyLoaded = false; Debug.WriteLine("> Deserialize podcasts"); Notifier.BlockUpdates = true; Debug.WriteLine("> Load json file"); var json = await FileIO.ReadTextAsync(libraryFile); var temp = JsonConvert.DeserializeObject <List <Podcast> >(json); Notifier.BlockUpdates = false; Debug.WriteLine("> Check downloads and local image"); if (temp != null) { if (!merge) { Clear(); } foreach (var podcast in temp) { if (GetPodcastByFeedUrl(podcast.FeedUrl) != null) { continue; } Podcasts.Add(podcast); podcast.Clean(); podcast.CheckDownloads(); podcast.GetLocalImage(); } } Debug.WriteLine("> Loaded episodes: " + Podcasts.SelectMany(p => p.Episodes).Count()); Debug.WriteLine("> CheckZombieFolders"); CheckZombieFolders(); Debug.WriteLine("> Loading done"); SuccessfullyLoaded = true; }
public static Episode GetEpisodeByEnclosure(string enclosure) { return(Podcasts.SelectMany(p => p.Episodes).FirstOrDefault(e => e.Enclosure == enclosure)); }