mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
Tachiyomi + Fixes (#1481)
* Fixed a bootstrap bug * Fixed repeating images on collection detail * Fixed up some logic in library watcher which wasn't processing all of the queue. * When parsing non-epubs in Book library, use Manga parsing for Volume support to better support Light Novels * Fixed some bugs with the tachiyomi plugin api's for progress tracking
This commit is contained in:
parent
36300c538c
commit
0cd14b3efc
@ -7,6 +7,7 @@ namespace API.Tests.Parser
|
|||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("Gifting The Wonderful World With Blessings! - 3 Side Stories [yuNS][Unknown]", "Gifting The Wonderful World With Blessings!")]
|
[InlineData("Gifting The Wonderful World With Blessings! - 3 Side Stories [yuNS][Unknown]", "Gifting The Wonderful World With Blessings!")]
|
||||||
[InlineData("BBC Focus 00 The Science of Happiness 2nd Edition (2018)", "BBC Focus 00 The Science of Happiness 2nd Edition")]
|
[InlineData("BBC Focus 00 The Science of Happiness 2nd Edition (2018)", "BBC Focus 00 The Science of Happiness 2nd Edition")]
|
||||||
|
[InlineData("Faust - Volume 01 [Del Rey][Scans_Compressed]", "Faust")]
|
||||||
public void ParseSeriesTest(string filename, string expected)
|
public void ParseSeriesTest(string filename, string expected)
|
||||||
{
|
{
|
||||||
Assert.Equal(expected, API.Parser.Parser.ParseSeries(filename));
|
Assert.Equal(expected, API.Parser.Parser.ParseSeries(filename));
|
||||||
@ -14,6 +15,7 @@ namespace API.Tests.Parser
|
|||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("Harrison, Kim - Dates from Hell - Hollows Vol 2.5.epub", "2.5")]
|
[InlineData("Harrison, Kim - Dates from Hell - Hollows Vol 2.5.epub", "2.5")]
|
||||||
|
[InlineData("Faust - Volume 01 [Del Rey][Scans_Compressed]", "1")]
|
||||||
public void ParseVolumeTest(string filename, string expected)
|
public void ParseVolumeTest(string filename, string expected)
|
||||||
{
|
{
|
||||||
Assert.Equal(expected, API.Parser.Parser.ParseVolume(filename));
|
Assert.Equal(expected, API.Parser.Parser.ParseVolume(filename));
|
||||||
|
@ -49,9 +49,8 @@ public class TachiyomiController : BaseApiController
|
|||||||
// If prevChapterId is -1, this means either nothing is read or everything is read.
|
// If prevChapterId is -1, this means either nothing is read or everything is read.
|
||||||
if (prevChapterId == -1)
|
if (prevChapterId == -1)
|
||||||
{
|
{
|
||||||
var userWithProgress = await _unitOfWork.UserRepository.GetUserByIdAsync(userId, AppUserIncludes.Progress);
|
var series = await _unitOfWork.SeriesRepository.GetSeriesDtoByIdAsync(seriesId, userId);
|
||||||
var userHasProgress =
|
var userHasProgress = series.PagesRead == 0 || series.PagesRead < series.Pages;
|
||||||
userWithProgress.Progresses.Any(x => x.SeriesId == seriesId);
|
|
||||||
|
|
||||||
// If the user doesn't have progress, then return null, which the extension will catch as 204 (no content) and report nothing as read
|
// If the user doesn't have progress, then return null, which the extension will catch as 204 (no content) and report nothing as read
|
||||||
if (!userHasProgress) return null;
|
if (!userHasProgress) return null;
|
||||||
@ -75,7 +74,8 @@ public class TachiyomiController : BaseApiController
|
|||||||
// There is progress, we now need to figure out the highest volume or chapter and return that.
|
// There is progress, we now need to figure out the highest volume or chapter and return that.
|
||||||
var prevChapter = await _unitOfWork.ChapterRepository.GetChapterDtoAsync(prevChapterId);
|
var prevChapter = await _unitOfWork.ChapterRepository.GetChapterDtoAsync(prevChapterId);
|
||||||
var volumeWithProgress = await _unitOfWork.VolumeRepository.GetVolumeDtoAsync(prevChapter.VolumeId, userId);
|
var volumeWithProgress = await _unitOfWork.VolumeRepository.GetVolumeDtoAsync(prevChapter.VolumeId, userId);
|
||||||
if (volumeWithProgress.Number != 0)
|
// We only encode for single-file volumes
|
||||||
|
if (volumeWithProgress.Number != 0 && volumeWithProgress.Chapters.Count == 1)
|
||||||
{
|
{
|
||||||
// The progress is on a volume, encode it as a fake chapterDTO
|
// The progress is on a volume, encode it as a fake chapterDTO
|
||||||
return Ok(new ChapterDto()
|
return Ok(new ChapterDto()
|
||||||
|
@ -52,9 +52,9 @@ public class DefaultParser : IDefaultParser
|
|||||||
{
|
{
|
||||||
ret = new ParserInfo()
|
ret = new ParserInfo()
|
||||||
{
|
{
|
||||||
Chapters = type == LibraryType.Manga ? Parser.ParseChapter(fileName) : Parser.ParseComicChapter(fileName),
|
Chapters = type == LibraryType.Comic ? Parser.ParseComicChapter(fileName) : Parser.ParseChapter(fileName),
|
||||||
Series = type == LibraryType.Manga ? Parser.ParseSeries(fileName) : Parser.ParseComicSeries(fileName),
|
Series = type == LibraryType.Comic ? Parser.ParseComicSeries(fileName) : Parser.ParseSeries(fileName),
|
||||||
Volumes = type == LibraryType.Manga ? Parser.ParseVolume(fileName) : Parser.ParseComicVolume(fileName),
|
Volumes = type == LibraryType.Comic ? Parser.ParseComicVolume(fileName) : Parser.ParseVolume(fileName),
|
||||||
Filename = Path.GetFileName(filePath),
|
Filename = Path.GetFileName(filePath),
|
||||||
Format = Parser.ParseFormat(filePath),
|
Format = Parser.ParseFormat(filePath),
|
||||||
Title = Path.GetFileNameWithoutExtension(fileName),
|
Title = Path.GetFileNameWithoutExtension(fileName),
|
||||||
|
@ -200,7 +200,7 @@ public class LibraryWatcher : ILibraryWatcher
|
|||||||
};
|
};
|
||||||
if (!_scanQueue.Contains(queueItem, _folderScanQueueableComparer))
|
if (!_scanQueue.Contains(queueItem, _folderScanQueueableComparer))
|
||||||
{
|
{
|
||||||
_logger.LogDebug("[LibraryWatcher] Queuing job for {Folder}", fullPath);
|
_logger.LogDebug("[LibraryWatcher] Queuing job for {Folder} at {TimeStamp}", fullPath, DateTime.Now);
|
||||||
_scanQueue.Enqueue(queueItem);
|
_scanQueue.Enqueue(queueItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,12 +221,12 @@ public class LibraryWatcher : ILibraryWatcher
|
|||||||
_logger.LogDebug("[LibraryWatcher] Scheduling ScanSeriesFolder for {Folder}", item.FolderPath);
|
_logger.LogDebug("[LibraryWatcher] Scheduling ScanSeriesFolder for {Folder}", item.FolderPath);
|
||||||
BackgroundJob.Enqueue(() => _scannerService.ScanFolder(item.FolderPath));
|
BackgroundJob.Enqueue(() => _scannerService.ScanFolder(item.FolderPath));
|
||||||
_scanQueue.Dequeue();
|
_scanQueue.Dequeue();
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
break;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_scanQueue.Count > 0)
|
if (_scanQueue.Count > 0)
|
||||||
|
@ -157,18 +157,21 @@ public class ProcessSeries : IProcessSeries
|
|||||||
series.LastFolderScanned = DateTime.Now;
|
series.LastFolderScanned = DateTime.Now;
|
||||||
_unitOfWork.SeriesRepository.Attach(series);
|
_unitOfWork.SeriesRepository.Attach(series);
|
||||||
|
|
||||||
try
|
if (_unitOfWork.HasChanges())
|
||||||
{
|
{
|
||||||
await _unitOfWork.CommitAsync();
|
try
|
||||||
}
|
{
|
||||||
catch (Exception ex)
|
await _unitOfWork.CommitAsync();
|
||||||
{
|
}
|
||||||
await _unitOfWork.RollbackAsync();
|
catch (Exception ex)
|
||||||
_logger.LogCritical(ex, "[ScannerService] There was an issue writing to the for series {@SeriesName}", series);
|
{
|
||||||
|
await _unitOfWork.RollbackAsync();
|
||||||
|
_logger.LogCritical(ex, "[ScannerService] There was an issue writing to the for series {@SeriesName}", series);
|
||||||
|
|
||||||
await _eventHub.SendMessageAsync(MessageFactory.Error,
|
await _eventHub.SendMessageAsync(MessageFactory.Error,
|
||||||
MessageFactory.ErrorEvent($"There was an issue writing to the DB for Series {series}",
|
MessageFactory.ErrorEvent($"There was an issue writing to the DB for Series {series}",
|
||||||
string.Empty));
|
ex.Message));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
[filterSettings]="filterSettings"
|
[filterSettings]="filterSettings"
|
||||||
[filterOpen]="filterOpen"
|
[filterOpen]="filterOpen"
|
||||||
[parentScroll]="scrollingBlock"
|
[parentScroll]="scrollingBlock"
|
||||||
|
[trackByIdentity]="trackByIdentity"
|
||||||
[jumpBarKeys]="jumpbarKeys"
|
[jumpBarKeys]="jumpbarKeys"
|
||||||
(applyFilter)="updateFilter($event)">
|
(applyFilter)="updateFilter($event)">
|
||||||
<ng-template #cardItem let-item let-position="idx">
|
<ng-template #cardItem let-item let-position="idx">
|
||||||
|
@ -53,6 +53,7 @@ export class CollectionDetailComponent implements OnInit, OnDestroy, AfterConten
|
|||||||
jumpbarKeys: Array<JumpKey> = [];
|
jumpbarKeys: Array<JumpKey> = [];
|
||||||
|
|
||||||
filterOpen: EventEmitter<boolean> = new EventEmitter();
|
filterOpen: EventEmitter<boolean> = new EventEmitter();
|
||||||
|
trackByIdentity = (index: number, item: Series) => `${item.name}_${item.localizedName}_${item.pagesRead}`;
|
||||||
|
|
||||||
|
|
||||||
private onDestory: Subject<void> = new Subject<void>();
|
private onDestory: Subject<void> = new Subject<void>();
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
.modal {
|
|
||||||
z-index: 1056; // ngb v12 bug: https://github.com/ng-bootstrap/ng-bootstrap/issues/2686
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal-content {
|
.modal-content {
|
||||||
background-color: var(--bs-body-bg);
|
background-color: var(--bs-body-bg);
|
||||||
color: var(--body-text-color);
|
color: var(--body-text-color);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user