diff --git a/ApplicationServices/LibraryCommands.cs b/ApplicationServices/LibraryCommands.cs index 70ecefb4..3ec19cc7 100644 --- a/ApplicationServices/LibraryCommands.cs +++ b/ApplicationServices/LibraryCommands.cs @@ -13,10 +13,10 @@ namespace ApplicationServices { public static class LibraryCommands { - public static async Task<(int totalCount, int newCount, int removedCount)> ImportAccountAsync(Func loginCallbackFactoryFunc, params Account[] accounts) + public static async Task<(int totalCount, int newCount)> ImportAccountAsync(Func loginCallbackFactoryFunc, params Account[] accounts) { if (accounts is null || accounts.Length == 0) - return (0, 0, 0); + return (0, 0); try { @@ -25,13 +25,13 @@ namespace ApplicationServices var totalCount = importItems.Count; Log.Logger.Information($"GetAllLibraryItems: Total count {totalCount}"); - (var newCount, var removedCount) = await importIntoDbAsync(importItems); + var newCount = await importIntoDbAsync(importItems); Log.Logger.Information($"Import: New count {newCount}"); await Task.Run(() => SearchEngineCommands.FullReIndex()); Log.Logger.Information("FullReIndex: success"); - return (totalCount, newCount, removedCount); + return (totalCount, newCount); } catch (AudibleApi.Authentication.LoginFailedException lfEx) { @@ -90,16 +90,14 @@ namespace ApplicationServices return dtoItems.Select(d => new ImportItem { DtoItem = d, AccountId = account.AccountId, LocaleName = account.Locale?.Name }).ToList(); } - private static async Task<(ushort newCount, ushort removedCount)> importIntoDbAsync(List importItems) + private static async Task importIntoDbAsync(List importItems) { using var context = DbContexts.GetContext(); var libraryImporter = new LibraryImporter(context); - var newAndRemoved = await Task.Run(() => libraryImporter.Import(importItems)); + var newCount = await Task.Run(() => libraryImporter.Import(importItems)); context.SaveChanges(); - var newCount = (ushort)(newAndRemoved >> 0x10); - var removedCount = (ushort)(newAndRemoved & 0xffff); - return (newCount, removedCount); + return newCount; } public static int UpdateTags(this LibationContext context, Book book, string newTags) diff --git a/DtoImporterService/LibraryImporter.cs b/DtoImporterService/LibraryImporter.cs index 76e2103d..430919c3 100644 --- a/DtoImporterService/LibraryImporter.cs +++ b/DtoImporterService/LibraryImporter.cs @@ -62,7 +62,7 @@ namespace DtoImporterService var qtyNew = newItems.Count(); var qtyRemoved = removedItems.Count(); - return (qtyNew << 0x10) | (qtyRemoved & 0xffff); + return qtyNew; } } } diff --git a/LibationWinForms/Dialogs/IndexLibraryDialog.cs b/LibationWinForms/Dialogs/IndexLibraryDialog.cs index 40f5fa31..f3b6594c 100644 --- a/LibationWinForms/Dialogs/IndexLibraryDialog.cs +++ b/LibationWinForms/Dialogs/IndexLibraryDialog.cs @@ -11,7 +11,6 @@ namespace LibationWinForms.Dialogs private Account[] _accounts { get; } public int NewBooksAdded { get; private set; } - public int OldBooksRemoved { get; private set; } public int TotalBooksProcessed { get; private set; } public IndexLibraryDialog(params Account[] accounts) @@ -32,7 +31,7 @@ namespace LibationWinForms.Dialogs try { - (TotalBooksProcessed, NewBooksAdded, OldBooksRemoved) = await LibraryCommands.ImportAccountAsync((account) => new WinformResponder(account), _accounts); + (TotalBooksProcessed, NewBooksAdded) = await LibraryCommands.ImportAccountAsync((account) => new WinformResponder(account), _accounts); } catch (Exception ex) { diff --git a/LibationWinForms/Form1.cs b/LibationWinForms/Form1.cs index 1e180277..3c4fa133 100644 --- a/LibationWinForms/Form1.cs +++ b/LibationWinForms/Form1.cs @@ -284,9 +284,8 @@ namespace LibationWinForms var totalProcessed = dialog.TotalBooksProcessed; var newAdded = dialog.NewBooksAdded; - var oldRemoved = dialog.OldBooksRemoved; - MessageBox.Show($"Total processed: {totalProcessed}\r\nNew: {newAdded}\r\nRemoved: {oldRemoved}"); + MessageBox.Show($"Total processed: {totalProcessed}\r\nNew: {newAdded}"); if (totalProcessed > 0) reloadGrid();