Fixed: Renaming multi-part books

pull/1064/head
ta264 3 years ago
parent 7fda41c18b
commit e1465f5336

@ -33,6 +33,10 @@ namespace NzbDrone.Core.Test.MediaFiles
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 @@ namespace NzbDrone.Core.MediaFiles
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…
Cancel
Save