Skip to content

Commit

Permalink
Fixed Scanning problem
Browse files Browse the repository at this point in the history
  • Loading branch information
SirSparkles committed Jan 16, 2019
1 parent e1ff710 commit c59ff7f
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions TVRename/Finders/LibraryFolderFileFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,25 @@ protected override void Check(SetProgressDelegate prog, ICollection<ShowItem> sh

string baseFolder = me.Episode.Show.AutoAddFolderBase;
LOGGER.Info($"Starting to look for {me.Filename} in the library: {baseFolder}");

List<FileInfo> matchedFiles;

List<FileInfo> matchedFiles = string.IsNullOrWhiteSpace(baseFolder)
? new List<FileInfo>()
: dfc.GetFilesIncludeSubDirs(baseFolder).Where(testFile =>
ReviewFile(me, thisRound, testFile, settings, false, false, false)).ToList();
if (string.IsNullOrWhiteSpace(baseFolder))
{
matchedFiles = new List<FileInfo>();
}
else
{
FileInfo[] testFiles = dfc.GetFilesIncludeSubDirs(baseFolder);
if (testFiles is null)
{
matchedFiles = new List<FileInfo>();
}
else
{
matchedFiles = testFiles.Where(testFile => ReviewFile(me, thisRound, testFile, settings, false, false, false)).ToList();
}
}

foreach (KeyValuePair<int, List<string>> seriesFolders in me.Episode.Show.AllFolderLocationsEpCheck(
false))
Expand All @@ -61,7 +75,10 @@ protected override void Check(SetProgressDelegate prog, ICollection<ShowItem> sh
{
if (string.IsNullOrWhiteSpace(folderName)) continue;
LOGGER.Info($"Starting to look for {me.Filename} in the library folder: {folderName}");
foreach (FileInfo testFile in dfc.GetFiles(folderName))
FileInfo[] files = dfc.GetFiles(folderName);
if (files is null) continue;

foreach (FileInfo testFile in files)
{
if (!ReviewFile(me, thisRound, testFile, settings, false, false, false)) continue;

Expand Down

0 comments on commit c59ff7f

Please sign in to comment.