Exemple #1
0
 private void PlayingEpisodeChanged(PodcastEpisode episode)
 {
     if (episode != null)
     {
         if (!MovingTimeSlider)
         {
             SliderPosition = episode.Progress.Progress * 100;
         }
         if (_maxValue.Ticks != episode.Progress.Length.Ticks)
         {
             MaxValue = episode.Progress.Length;
         }
     }
     else
     {
         SliderPosition = 0.0;
         MaxValue       = new TimeSpan(0, 0, 0);
     }
 }
Exemple #2
0
 public PodcastEpisodeView(KeyValuePair <string, PodcastEpisode> key)
 {
     PrimaryName = key.Key;
     Episode     = key.Value;
 }
Exemple #3
0
 public PodcastEpisodeView(string name, PodcastEpisode ep)
 {
     PrimaryName = name;
     Episode     = ep;
 }
Exemple #4
0
        public async Task FillNewEpisodes()
        {
            if (_feedCache == null)
            {
                await GetFeed();
            }

            CheckListLoaded();

            var addedNew = false;

            foreach (var f in _feedCache.Items)
            {
                var num = HelperMethods.GetEpisodeNumberFromFeed(f);
                if (!_episodes.ContainsKey(num) && num != -1 && num >= MinEpisodeCount && num <= MaxEpisodeCount)
                {
                    Uri enclosure = null;
                    if (f.Links != null)
                    {
                        enclosure = f.Links.FirstOrDefault(x => x.RelationshipType.ToLowerInvariant() == "enclosure")?.Uri;
                    }

                    List <string> keywords = null;
                    TimeSpan      duration = new TimeSpan();
                    foreach (var ext in f.ElementExtensions)
                    {
                        switch (ext.OuterName.ToLowerInvariant())
                        {
                        case "keywords":
                            keywords = HelperMethods.ReadKeywords(ext);
                            break;

                        case "duration":
                            duration = HelperMethods.ReadDuration(ext);
                            break;
                        }
                    }

                    var episode = new PodcastEpisode()
                    {
                        PodcastShortCode = ShortCode,
                        EpisodeNumber    = num,
                        Title            = f.Title?.Text ?? string.Empty,
                        Description      = f.Summary?.Text ?? string.Empty,
                        PublishDateUtc   = f.PublishDate.UtcDateTime,
                        Keywords         = keywords?.ToArray() ?? new string[0]
                    };
                    if (enclosure != null)
                    {
                        episode.FileUri = enclosure;
                    }
                    episode.Progress.Length = duration;
                    _episodes.Add(num, episode);
                    addedNew = true;
                }
            }

            if (addedNew)
            {
                Config.Instance.SaveConfig();
            }
        }