public void AddAllToEnrichedPrograms(GuideEnricherProgram program)
        {
            SuccessfulPrograms.Add(program);
            PendingPrograms.Remove(program);
            // only if SubTitle is NOT empty
            var similarPrograms = this.FindSimilarPrograms(this.PendingPrograms.FindAll(x => !string.IsNullOrEmpty(x.SubTitle) && x.SubTitle == program.OriginalSubTitle), program);

            if (similarPrograms.Count > 0)
            {
                PendingPrograms = new List <GuideEnricherProgram>(PendingPrograms.Except(similarPrograms));
                foreach (GuideEnricherProgram similarProgram in similarPrograms)
                {
                    similarProgram.SeriesNumber         = program.SeriesNumber;
                    similarProgram.EpisodeNumber        = program.EpisodeNumber;
                    similarProgram.EpisodeNumberDisplay = program.EpisodeNumberDisplay;
                    if (this.updateSubtitles)
                    {
                        similarProgram.SubTitle = program.SubTitle;
                    }

                    if (this.updateDescription)
                    {
                        similarProgram.Description = program.Description;
                    }
                }

                SuccessfulPrograms.AddRange(similarPrograms);
            }
        }
        public void AddAllToEnrichedPrograms(GuideEnricherProgram program)
        {
            SuccessfulPrograms.Add(program);
            PendingPrograms.Remove(program);
            // only if SubTitle is NOT empty
            var similarPrograms = this.FindSimilarPrograms(this.PendingPrograms.FindAll(x => !string.IsNullOrEmpty(x.SubTitle) && x.SubTitle == program.OriginalSubTitle), program);
            if (similarPrograms.Count > 0)
            {
                PendingPrograms = new List<GuideEnricherProgram>(PendingPrograms.Except(similarPrograms));
                foreach (GuideEnricherProgram similarProgram in similarPrograms)
                {
                    similarProgram.SeriesNumber = program.SeriesNumber;
                    similarProgram.EpisodeNumber = program.EpisodeNumber;
                    similarProgram.EpisodeNumberDisplay = program.EpisodeNumberDisplay;
                    if (this.updateSubtitles)
                    {
                        similarProgram.SubTitle = program.SubTitle;
                    }

                    if (this.updateDescription)
                    {
                        similarProgram.Description = program.Description;
                    }
                }

                SuccessfulPrograms.AddRange(similarPrograms);
            }
        }
        public void AddAllToFailedPrograms(GuideEnricherProgram program)
        {
            FailedPrograms.Add(program);
            PendingPrograms.Remove(program);
            List <GuideEnricherProgram> similarPrograms = PendingPrograms.FindAll(x => x.SubTitle == program.OriginalSubTitle && !(string.IsNullOrEmpty(program.OriginalSubTitle)));

            if (similarPrograms.Count > 0)
            {
                PendingPrograms = new List <GuideEnricherProgram>(PendingPrograms.Except(similarPrograms));
                FailedPrograms.AddRange(similarPrograms);
            }
        }
        public static int GetValidEpisodeNumber(this GuideEnricherProgram guideProgram)
        {
            int episodeNumber;

            if (!guideProgram.EpisodeNumber.HasValue)
            {
                int.TryParse(guideProgram.SubTitle, out episodeNumber);
            }
            else
            {
                episodeNumber = guideProgram.EpisodeNumber.Value;
            }

            return(episodeNumber);
        }
 public void AddProgram(GuideEnricherProgram program)
 {
     if (!this.updateAll && program.Matched)
     {
         if (!this.IgnoredPrograms.Contains(program, guideProgramEqualityComparer))
         {
             this.IgnoredPrograms.Add(program);  
         }
     }
     else
     {
         if (!this.PendingPrograms.Contains(program, guideProgramEqualityComparer))
         {
             this.PendingPrograms.Add(program);
         }
     }
 }
 public void AddProgram(GuideEnricherProgram program)
 {
     if (!this.updateAll && program.Matched)
     {
         if (!this.IgnoredPrograms.Contains(program, guideProgramEqualityComparer))
         {
             this.IgnoredPrograms.Add(program);
         }
     }
     else
     {
         if (!this.PendingPrograms.Contains(program, guideProgramEqualityComparer))
         {
             this.PendingPrograms.Add(program);
         }
     }
 }
 public void AddAllToFailedPrograms(GuideEnricherProgram program)
 {
     FailedPrograms.Add(program);
     PendingPrograms.Remove(program);
     List<GuideEnricherProgram> similarPrograms = PendingPrograms.FindAll(x => x.SubTitle == program.OriginalSubTitle && !(string.IsNullOrEmpty(program.OriginalSubTitle)));
     if (similarPrograms.Count > 0)
     {
         PendingPrograms = new List<GuideEnricherProgram>(PendingPrograms.Except(similarPrograms));                
         FailedPrograms.AddRange(similarPrograms);
     }
 }
 public List<GuideEnricherProgram> FindSimilarPrograms(List<GuideEnricherProgram> pendingPrograms, GuideEnricherProgram program)
 {
     List<GuideEnricherProgram> similarPrograms = pendingPrograms;
     return similarPrograms;
 }
        public List <GuideEnricherProgram> FindSimilarPrograms(List <GuideEnricherProgram> pendingPrograms, GuideEnricherProgram program)
        {
            List <GuideEnricherProgram> similarPrograms = pendingPrograms;

            return(similarPrograms);
        }