Example #1
0
        private static (bool identifysuccess, int foundSeason, int foundEpisode, int maxEp) IdentifyFile([NotNull] ShowItemMissing me, [NotNull] FileInfo dce)
        {
            int season = me.MissingEpisode.AppropriateSeasonNumber;
            int epnum  = me.MissingEpisode.AppropriateEpNum;

            bool regularMatch =
                FinderHelper.FindSeasEp(dce, out int foundSeason, out int foundEpisode, out int maxEp, me.MissingEpisode.Show) &&
                foundSeason == season &&
                foundEpisode == epnum;

            if (regularMatch)
            {
                return(true, foundSeason, foundEpisode, maxEp);
            }

            if (me.MissingEpisode.Show.UseSequentialMatch)
            {
                if (FinderHelper.MatchesSequentialNumber(dce.RemoveExtension(false), me.MissingEpisode))
                {
                    return(true, season, epnum, me.MissingEpisode.EpNum2);
                }
            }

            if (me.MissingEpisode.Show.UseAirDateMatch)
            {
                if (FinderHelper.FindSeasEpDateCheck(dce.Name, out foundSeason, out foundEpisode, me.MissingEpisode.Show))
                {
                    if (foundEpisode == epnum && foundSeason == season)
                    {
                        return(true, foundSeason, foundEpisode, -1);
                    }
                }
            }

            if (me.MissingEpisode.Show.UseEpNameMatch)
            {
                if (FinderHelper.FindSeasEpNameCheck(dce, me.MissingEpisode.Show, out foundSeason, out foundEpisode))
                {
                    if (foundEpisode == epnum && foundSeason == season)
                    {
                        return(true, foundSeason, foundEpisode, -1);
                    }
                }
            }

            return(false, 0, 0, 0);
        }