Esempio n. 1
0
        internal static List <PossibleDuplicateEpisode> FindDoubleEps([NotNull] TVDoc doc)
        {
            doc.PreventAutoScan("Find Double Episodes");
            StringBuilder output = new StringBuilder();
            List <PossibleDuplicateEpisode> returnValue = new List <PossibleDuplicateEpisode>();

            output.AppendLine("");
            output.AppendLine("##################################################");
            output.AppendLine("DUPLICATE FINDER - Start");
            output.AppendLine("##################################################");

            DirFilesCache dfc = new DirFilesCache();

            foreach (ShowItem si in doc.Library.Values)
            {
                foreach (KeyValuePair <int, List <ProcessedEpisode> > kvp in si.SeasonEpisodes)
                {
                    //Ignore specials seasons
                    if (kvp.Key == 0)
                    {
                        continue;
                    }

                    //Ignore seasons that all aired on same date
                    DateTime?seasonMinAirDate = (from pep in kvp.Value select pep.FirstAired).Min();
                    DateTime?seasonMaxAirDate = (from pep in kvp.Value select pep.FirstAired).Max();
                    if (seasonMaxAirDate.HasValue && seasonMinAirDate.HasValue &&
                        seasonMaxAirDate == seasonMinAirDate)
                    {
                        continue;
                    }

                    //Search through each pair of episodes for the same season
                    foreach (ProcessedEpisode pep in kvp.Value)
                    {
                        SearchForDuplicates(pep, output, si, kvp.Key, kvp.Value, dfc, returnValue);
                    }
                }
            }

            output.AppendLine("##################################################");
            output.AppendLine("DUPLICATE FINDER - End");
            output.AppendLine("##################################################");

            Logger.Info(output.ToString());
            doc.AllowAutoScan();
            return(returnValue);
        }
Esempio n. 2
0
        internal static List <PossibleMergedEpisode> FindDoubleEps(TVDoc doc, [NotNull] BackgroundWorker worker)
        {
            int total   = doc.TvLibrary.Count;
            int current = 0;

            doc.PreventAutoScan("Find Double Episodes");
            StringBuilder output = new StringBuilder();
            List <PossibleMergedEpisode> returnValue = new List <PossibleMergedEpisode>();

            output.AppendLine("");
            output.AppendLine("##################################################");
            output.AppendLine("MERGED EPISODES FINDER - Start");
            output.AppendLine("##################################################");

            DirFilesCache dfc = new DirFilesCache();

            foreach (ShowConfiguration si in doc.TvLibrary.GetSortedShowItems())
            {
                worker.ReportProgress(100 * current++ / total, si.ShowName);

                foreach (KeyValuePair <int, List <ProcessedEpisode> > kvp in si.ActiveSeasons)
                {
                    //Ignore seasons that all aired on same date
                    DateTime?seasonMinAirDate = (from pep in kvp.Value select pep.FirstAired).Min();
                    DateTime?seasonMaxAirDate = (from pep in kvp.Value select pep.FirstAired).Max();
                    if (seasonMaxAirDate.HasValue && seasonMinAirDate.HasValue &&
                        seasonMaxAirDate == seasonMinAirDate)
                    {
                        continue;
                    }

                    //Search through each pair of episodes for the same season
                    foreach (ProcessedEpisode pep in kvp.Value)
                    {
                        SearchForDuplicates(pep, output, si, kvp.Key, kvp.Value, dfc, returnValue);
                    }
                }
            }

            output.AppendLine("##################################################");
            output.AppendLine("MERGED EPISODES FINDER - End");
            output.AppendLine("##################################################");

            Logger.Info(output.ToString());
            doc.AllowAutoScan();
            return(returnValue);
        }
Esempio n. 3
0
        internal static void LogShowEpisodeSizes([NotNull] TVDoc doc)
        {
            doc.PreventAutoScan("Show File Sizes");
            StringBuilder output = new StringBuilder();

            output.AppendLine("");
            output.AppendLine("##################################################");
            output.AppendLine("File Quailty FINDER - Start");
            output.AppendLine("##################################################");
            Logger.Info(output.ToString());

            DirFilesCache dfc = new DirFilesCache();

            foreach (ShowItem si in doc.Library.Values)
            {
                foreach (List <ProcessedEpisode> episodes in si.SeasonEpisodes.Values.ToList())
                {
                    foreach (ProcessedEpisode pep in episodes)
                    {
                        List <FileInfo> files = dfc.FindEpOnDisk(pep);
                        foreach (FileInfo file in files)
                        {
                            int width  = file.GetFrameWidth();
                            int height = file.GetFrameHeight();
                            int length = file.GetFilmLength();
                            Logger.Info($"{width,-10}   {height,-10}   {length,-10}    {pep.Show.ShowName,-50}  {file.Name}");
                        }
                    }
                }
            }

            output.Clear();
            output.AppendLine("##################################################");
            output.AppendLine("File Quailty FINDER - End");
            output.AppendLine("##################################################");

            Logger.Info(output.ToString());
            doc.AllowAutoScan();
        }