Exemple #1
0
 public static void LoadHighestEpisode(this Filter filter, List <Torrent> downloadsByFilter)
 {
     if (downloadsByFilter.Count > 0)
     {
         Torrent highestEpisodeYet = downloadsByFilter.FindHighestEpisode();
         filter.Season  = highestEpisodeYet.GetSeason();
         filter.Episode = highestEpisodeYet.GetEpisode() + 1;
     }
 }
Exemple #2
0
 public static bool IsHigherThan(this Torrent torrent, Torrent compareTo)
 {
     return(torrent.GetSeason() > compareTo.GetSeason() || (torrent.GetSeason() == compareTo.GetSeason() && torrent.GetEpisode() > compareTo.GetEpisode()));
 }
Exemple #3
0
        public static bool HasHigher(this Filter filter, List <Torrent> torrents)
        {
            Torrent highest = torrents.FindHighestEpisode();

            if (!highest.IsTvShow())
            {
                return(false);
            }

            return(highest.GetSeason() > filter.Season || (highest.GetSeason() == filter.Season && highest.GetEpisode() + 1 > filter.Episode));
        }
Exemple #4
0
 public static bool EpisodeHasDownloadedBefore(this List <Torrent> downloaded, Torrent torrent)
 {
     return(downloaded.Any(download => download.IsTvShow() && download.GetSeason() == torrent.GetSeason() && download.GetEpisode() == torrent.GetEpisode()));
 }
Exemple #5
0
        public static bool ShouldDownloadEpisode(this Filter filter, Torrent torrent, List <Torrent> downloaded)
        {
            if (!(torrent.GetSeason() > filter.Season || (torrent.GetSeason() == filter.Season && torrent.GetEpisode() >= filter.Episode)))
            {
                return(false);
            }
            if (filter.MatchOnce && downloaded.EpisodeHasDownloadedBefore(torrent))
            {
                return(false);
            }

            return(true);
        }