mirror of
https://github.com/Readarr/Readarr
synced 2026-02-16 11:43:58 +01:00
Fixed: Renaming multi-part books
This commit is contained in:
parent
7fda41c18b
commit
e1465f5336
2 changed files with 7 additions and 0 deletions
|
|
@ -33,6 +33,10 @@ public void Setup()
|
|||
Mocker.GetMock<IAuthorService>()
|
||||
.Setup(s => s.GetAuthor(_author.Id))
|
||||
.Returns(_author);
|
||||
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Setup(s => s.GetFilesByAuthor(_author.Id))
|
||||
.Returns(_trackFiles);
|
||||
}
|
||||
|
||||
private void GivenNoTrackFiles()
|
||||
|
|
|
|||
|
|
@ -113,12 +113,15 @@ private IEnumerable<RenameBookFilePreview> GetPreviews(Author author, List<BookF
|
|||
|
||||
private void RenameFiles(List<BookFile> bookFiles, Author author)
|
||||
{
|
||||
var allFiles = _mediaFileService.GetFilesByAuthor(author.Id);
|
||||
var counts = allFiles.GroupBy(x => x.EditionId).ToDictionary(g => g.Key, g => g.Count());
|
||||
var renamed = new List<BookFile>();
|
||||
|
||||
// Don't rename Calibre files
|
||||
foreach (var bookFile in bookFiles.Where(x => x.CalibreId == 0))
|
||||
{
|
||||
var bookFilePath = bookFile.Path;
|
||||
bookFile.PartCount = counts[bookFile.EditionId];
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue