Some code cleanup
This commit is contained in:
parent
585e965a85
commit
d73bd22db2
34 changed files with 814 additions and 383 deletions
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using API.Entities.Enums;
|
||||
using API.Extensions;
|
||||
|
@ -55,7 +54,7 @@ namespace API.Services.Tasks
|
|||
|
||||
var files = maxRollingFiles > 0
|
||||
? _directoryService.GetFiles(Directory.GetCurrentDirectory(), $@"{fi.Name}{multipleFileRegex}\.log")
|
||||
: new string[] {"kavita.log"};
|
||||
: new[] {"kavita.log"};
|
||||
return files;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,14 +11,12 @@ namespace API.Services.Tasks
|
|||
public class CleanupService : ICleanupService
|
||||
{
|
||||
private readonly ICacheService _cacheService;
|
||||
private readonly IDirectoryService _directoryService;
|
||||
private readonly ILogger<CleanupService> _logger;
|
||||
private readonly IBackupService _backupService;
|
||||
|
||||
public CleanupService(ICacheService cacheService, IDirectoryService directoryService, ILogger<CleanupService> logger, IBackupService backupService)
|
||||
public CleanupService(ICacheService cacheService, ILogger<CleanupService> logger, IBackupService backupService)
|
||||
{
|
||||
_cacheService = cacheService;
|
||||
_directoryService = directoryService;
|
||||
_logger = logger;
|
||||
_backupService = backupService;
|
||||
}
|
||||
|
|
|
@ -284,7 +284,7 @@ namespace API.Services.Tasks
|
|||
AddOrUpdateFileForChapter(chapter, info);
|
||||
chapter.Number = Parser.Parser.MinimumNumberFromRange(info.Chapters) + "";
|
||||
chapter.Range = info.Chapters;
|
||||
chapter.Pages = chapter.Files.Sum(f => f.NumberOfPages);
|
||||
chapter.Pages = chapter.Files.Sum(f => f.Pages);
|
||||
_metadataService.UpdateMetadata(chapter, _forceUpdate);
|
||||
}
|
||||
|
||||
|
@ -350,7 +350,7 @@ namespace API.Services.Tasks
|
|||
{
|
||||
FilePath = info.FullFilePath,
|
||||
Format = info.Format,
|
||||
NumberOfPages = _archiveService.GetNumberOfPagesFromArchive(info.FullFilePath)
|
||||
Pages = _archiveService.GetNumberOfPagesFromArchive(info.FullFilePath)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -361,7 +361,7 @@ namespace API.Services.Tasks
|
|||
if (existingFile != null)
|
||||
{
|
||||
existingFile.Format = info.Format;
|
||||
existingFile.NumberOfPages = _archiveService.GetNumberOfPagesFromArchive(info.FullFilePath);
|
||||
existingFile.Pages = _archiveService.GetNumberOfPagesFromArchive(info.FullFilePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue