Scanner Bugfixes (#2818)

This commit is contained in:
Joe Milazzo 2024-03-25 16:28:10 -05:00 committed by GitHub
parent 829a610579
commit 93a8883fe4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 180 additions and 99 deletions

View file

@ -134,7 +134,11 @@ public class ReaderService : IReaderService
VolumeId = chapter.VolumeId,
SeriesId = seriesId,
ChapterId = chapter.Id,
LibraryId = series.LibraryId
LibraryId = series.LibraryId,
Created = DateTime.Now,
CreatedUtc = DateTime.UtcNow,
LastModified = DateTime.Now,
LastModifiedUtc = DateTime.UtcNow
});
}
else
@ -144,6 +148,8 @@ public class ReaderService : IReaderService
userProgress.VolumeId = chapter.VolumeId;
}
userProgress?.MarkModified();
await _eventHub.SendMessageAsync(MessageFactory.UserProgressUpdate,
MessageFactory.UserProgressUpdateEvent(user.Id, user.UserName!, seriesId, chapter.VolumeId, chapter.Id, chapter.Pages));
@ -177,6 +183,7 @@ public class ReaderService : IReaderService
userProgress.PagesRead = 0;
userProgress.SeriesId = seriesId;
userProgress.VolumeId = chapter.VolumeId;
userProgress.MarkModified();
await _eventHub.SendMessageAsync(MessageFactory.UserProgressUpdate,
MessageFactory.UserProgressUpdateEvent(user.Id, user.UserName!, userProgress.SeriesId, userProgress.VolumeId, userProgress.ChapterId, 0));
@ -266,7 +273,11 @@ public class ReaderService : IReaderService
SeriesId = progressDto.SeriesId,
ChapterId = progressDto.ChapterId,
LibraryId = progressDto.LibraryId,
BookScrollId = progressDto.BookScrollId
BookScrollId = progressDto.BookScrollId,
Created = DateTime.Now,
CreatedUtc = DateTime.UtcNow,
LastModified = DateTime.Now,
LastModifiedUtc = DateTime.UtcNow
});
_unitOfWork.UserRepository.Update(userWithProgress);
}
@ -280,6 +291,8 @@ public class ReaderService : IReaderService
_unitOfWork.AppUserProgressRepository.Update(userProgress);
}
userProgress?.MarkModified();
if (!_unitOfWork.HasChanges() || await _unitOfWork.CommitAsync())
{
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(userId);

View file

@ -31,7 +31,7 @@ public class BookParser(IDirectoryService directoryService, IBookService bookSer
{
var info2 = basicParser.Parse(filePath, rootPath, libraryRoot, LibraryType.Book, comicInfo);
info.Merge(info2);
if (type == LibraryType.LightNovel && hasVolumeInSeries && info2 != null && Parser.ParseVolume(info2.Series)
if (hasVolumeInSeries && info2 != null && Parser.ParseVolume(info2.Series)
.Equals(Parser.LooseLeafVolume))
{
// Override the Series name so it groups appropriately

View file

@ -107,11 +107,11 @@ public abstract class DefaultParser(IDirectoryService directoryService) : IDefau
{
info.Volumes = info.ComicInfo.Volume;
}
if (string.IsNullOrEmpty(info.Series) && !string.IsNullOrEmpty(info.ComicInfo.Series))
if (!string.IsNullOrEmpty(info.ComicInfo.Series))
{
info.Series = info.ComicInfo.Series.Trim();
}
if (string.IsNullOrEmpty(info.LocalizedSeries) && !string.IsNullOrEmpty(info.ComicInfo.LocalizedSeries))
if (!string.IsNullOrEmpty(info.ComicInfo.LocalizedSeries))
{
info.LocalizedSeries = info.ComicInfo.LocalizedSeries.Trim();
}

View file

@ -232,7 +232,7 @@ public static class Parser
RegexTimeout),
// Gokukoku no Brynhildr - c001-008 (v01) [TrinityBAKumA], Black Bullet - v4 c17 [batoto]
new Regex(
@"(?<Series>.*)( - )(?:v|vo|c|chapters)\d",
@"(?<Series>.+?)( - )(?:v|vo|c|chapters)\d",
MatchOptions, RegexTimeout),
// Kedouin Makoto - Corpse Party Musume, Chapter 19 [Dametrans].zip
new Regex(

View file

@ -22,6 +22,11 @@ public class PdfParser(IDirectoryService directoryService) : DefaultParser(direc
: Parser.ParseChapter(fileName)
};
if (type == LibraryType.Book)
{
ret.Chapters = Parser.DefaultChapter;
}
ret.Series = type == LibraryType.Comic ? Parser.ParseComicSeries(fileName) : Parser.ParseSeries(fileName);
ret.Volumes = type == LibraryType.Comic ? Parser.ParseComicVolume(fileName) : Parser.ParseVolume(fileName);