mirror of
https://github.com/fergalmoran/Readarr.git
synced 2026-02-11 10:26:57 +00:00
Fixed: Renaming multi-part books
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user