Fixed: Prevent renaming calibre files

This commit is contained in:
ta264 2021-03-23 21:47:42 +00:00
parent dd341ef1e1
commit e29b0c318e
2 changed files with 6 additions and 3 deletions

View file

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

View file

@ -71,7 +71,8 @@ public List<RenameBookFilePreview> GetRenamePreviews(int authorId, int bookId)
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 book = file.Edition.Value;
@ -109,7 +110,8 @@ private void RenameFiles(List<BookFile> bookFiles, Author author)
{
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;