diff --git a/API/Controllers/AccountController.cs b/API/Controllers/AccountController.cs index 483f5a8eb..e1eda477c 100644 --- a/API/Controllers/AccountController.cs +++ b/API/Controllers/AccountController.cs @@ -102,10 +102,6 @@ namespace API.Controllers .Include(u => u.UserPreferences) .SingleOrDefaultAsync(x => x.NormalizedUserName == loginDto.Username.ToUpper()); - var debugUsers = await _userManager.Users.Select(x => x.NormalizedUserName).ToListAsync(); - - _logger.LogInformation($"All Users: {string.Join(",", debugUsers)}"); - if (user == null) return Unauthorized("Invalid username"); var result = await _signInManager diff --git a/API/Parser/Parser.cs b/API/Parser/Parser.cs index dccdcf729..671699c7d 100644 --- a/API/Parser/Parser.cs +++ b/API/Parser/Parser.cs @@ -111,28 +111,28 @@ namespace API.Parser private static readonly Regex[] MangaChapterRegex = new[] { new Regex( - @"(c|ch)(\.? ?)(?\d+-?\d*)", + @"(c|ch)(\.? ?)(?\d+(?:.\d+|-\d+)?)", RegexOptions.IgnoreCase | RegexOptions.Compiled), // [Suihei Kiki]_Kasumi_Otoko_no_Ko_[Taruby]_v1.1.zip new Regex( - @"v\d+\.(?\d+-?\d*)", + @"v\d+\.(?\d+(?:.\d+|-\d+)?)", RegexOptions.IgnoreCase | RegexOptions.Compiled), - // Hinowa ga CRUSH! 018 (2019) (Digital) (LuCaZ).cbz + // Hinowa ga CRUSH! 018 (2019) (Digital) (LuCaZ).cbz,Hinowa ga CRUSH! 018.5 (2019) (Digital) (LuCaZ).cbz new Regex( - @"(?.*) (?\d+) (?:\(\d{4}\))", + @"(?.*) (?\d+(?:.\d+|-\d+)?)(?: \(\d{4}\))?", RegexOptions.IgnoreCase | RegexOptions.Compiled), // Tower Of God S01 014 (CBT) (digital).cbz new Regex( - @"(?.*) S(?\d+) (?\d+)", + @"(?.*) S(?\d+) (?\d+(?:.\d+|-\d+)?)", RegexOptions.IgnoreCase | RegexOptions.Compiled), // Beelzebub_01_[Noodles].zip new Regex( - @"^((?!v|vo|vol|Volume).)*( |_)(?\.?\d+)( |_|\[|\()", + @"^((?!v|vo|vol|Volume).)*( |_)(?\.?\d+(?:.\d+|-\d+)?)( |_|\[|\()", RegexOptions.IgnoreCase | RegexOptions.Compiled), // Yumekui-Merry_DKThias_Chapter21.zip new Regex( - @"Chapter(?\d+(-\d+)?)", + @"Chapter(?\d+(-\d+)?)", //(?:.\d+|-\d+)? RegexOptions.IgnoreCase | RegexOptions.Compiled), }; diff --git a/API/Services/ScannerService.cs b/API/Services/ScannerService.cs index 8121df16f..985141250 100644 --- a/API/Services/ScannerService.cs +++ b/API/Services/ScannerService.cs @@ -57,13 +57,16 @@ namespace API.Services _logger.LogInformation($"Beginning scan on {library.Name}. Forcing metadata update: {forceUpdate}"); var totalFiles = 0; + var skippedFolders = 0; foreach (var folderPath in library.Folders) { - if (!forceUpdate && Directory.GetLastWriteTime(folderPath.Path) <= folderPath.LastScanned) - { - _logger.LogDebug($"{folderPath.Path} hasn't been updated since last scan. Skipping."); - continue; - } + // if (!forceUpdate && Directory.GetLastWriteTime(folderPath.Path) <= folderPath.LastScanned) + // { + // // NOTE: This solution isn't the best, but it has potential. We need to handle a few other cases so it works great. + // _logger.LogDebug($"{folderPath.Path} hasn't been updated since last scan. Skipping."); + // skippedFolders += 1; + // continue; + // } try { totalFiles += DirectoryService.TraverseTreeParallelForEach(folderPath.Path, (f) => @@ -81,6 +84,17 @@ namespace API.Services catch (ArgumentException ex) { _logger.LogError(ex, $"The directory '{folderPath}' does not exist"); } + + folderPath.LastScanned = DateTime.Now; + } + + if (skippedFolders == library.Folders.Count) + { + _logger.LogInformation("All Folders were skipped due to no modifications to the directories."); + _unitOfWork.LibraryRepository.Update(library); + _scannedSeries = null; + _logger.LogInformation("Processed {0} files in {1} milliseconds for {2}", totalFiles, sw.ElapsedMilliseconds, library.Name); + return; } var filtered = _scannedSeries.Where(kvp => kvp.Value.Count != 0); @@ -92,7 +106,7 @@ namespace API.Services // Remove series that are no longer on disk RemoveSeriesNotOnDisk(allSeries, series, library); - foreach (var folder in library.Folders) folder.LastScanned = DateTime.Now; + //foreach (var folder in library.Folders) folder.LastScanned = DateTime.Now; _unitOfWork.LibraryRepository.Update(library); if (Task.Run(() => _unitOfWork.Complete()).Result) @@ -185,7 +199,7 @@ namespace API.Services if (info == null) { - _logger.LogInformation($"Could not parse series from {path}"); + _logger.LogWarning($"Could not parse from {path}"); return; }