Fixed: Prevent renaming calibre files

pull/965/head
ta264 4 years ago
parent dd341ef1e1
commit e29b0c318e

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using Moq; using Moq;
@ -26,6 +26,7 @@ namespace NzbDrone.Core.Test.MediaFiles
_trackFiles = Builder<BookFile>.CreateListOfSize(2) _trackFiles = Builder<BookFile>.CreateListOfSize(2)
.All() .All()
.With(e => e.Author = _author) .With(e => e.Author = _author)
.With(e => e.CalibreId = 0)
.Build() .Build()
.ToList(); .ToList();

@ -71,7 +71,8 @@ namespace NzbDrone.Core.MediaFiles
private IEnumerable<RenameBookFilePreview> GetPreviews(Author author, List<BookFile> files) private IEnumerable<RenameBookFilePreview> GetPreviews(Author author, List<BookFile> files)
{ {
foreach (var f in files) // Don't rename Calibre files
foreach (var f in files.Where(x => x.CalibreId == 0))
{ {
var file = f; var file = f;
var book = file.Edition.Value; var book = file.Edition.Value;
@ -109,7 +110,8 @@ namespace NzbDrone.Core.MediaFiles
{ {
var renamed = new List<BookFile>(); var renamed = new List<BookFile>();
foreach (var bookFile in bookFiles) // Don't rename Calibre files
foreach (var bookFile in bookFiles.Where(x => x.CalibreId == 0))
{ {
var bookFilePath = bookFile.Path; var bookFilePath = bookFile.Path;

Loading…
Cancel
Save