diff --git a/ApplicationServices/LibraryCommands.cs b/ApplicationServices/LibraryCommands.cs index 2c438d2a..7fd373b1 100644 --- a/ApplicationServices/LibraryCommands.cs +++ b/ApplicationServices/LibraryCommands.cs @@ -67,7 +67,7 @@ namespace ApplicationServices static System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); record timeLogEntry(string msg, long totalElapsed, long delta); - static List __log { get; } = new List { new("begin", 0, 0) }; + static List __log { get; } = new List(); static void logTime(string s) { var totalElapsed = sw.ElapsedMilliseconds; @@ -81,7 +81,9 @@ namespace ApplicationServices #region FULL LIBRARY scan and import public static async Task<(int totalCount, int newCount)> ImportAccountAsync(Func loginCallbackFactoryFunc, params Account[] accounts) { - sw.Start(); + __log.Clear(); + __log.Add(new("begin", 0, 0)); + sw.Restart(); if (accounts is null || accounts.Length == 0) return (0, 0); diff --git a/DataLayer/EfClasses/Book.cs b/DataLayer/EfClasses/Book.cs index 4334023d..8f2d85c1 100644 --- a/DataLayer/EfClasses/Book.cs +++ b/DataLayer/EfClasses/Book.cs @@ -30,8 +30,6 @@ namespace DataLayer public string Description { get; private set; } public int LengthInMinutes { get; private set; } public ContentType ContentType { get; private set; } - - // immutable-ish. should be immutable. mutability is necessary for v3 => v4 upgrades public string Locale { get; private set; } // mutable @@ -78,7 +76,8 @@ namespace DataLayer ContentType contentType, IEnumerable authors, IEnumerable narrators, - Category category, string localeName) + Category category, + string localeName) { // validate ArgumentValidator.EnsureNotNull(audibleProductId, nameof(audibleProductId)); @@ -260,10 +259,6 @@ namespace DataLayer Category = category; } - // needed for v3 => v4 upgrade - public void UpdateLocale(string localeName) - => Locale ??= localeName; - public override string ToString() => $"[{AudibleProductId}] {Title}"; } } diff --git a/DataLayer/EfClasses/LibraryBook.cs b/DataLayer/EfClasses/LibraryBook.cs index e58e3929..45f9f584 100644 --- a/DataLayer/EfClasses/LibraryBook.cs +++ b/DataLayer/EfClasses/LibraryBook.cs @@ -9,8 +9,6 @@ namespace DataLayer public Book Book { get; private set; } public DateTime DateAdded { get; private set; } - - // immutable-ish. should be immutable. mutability is necessary for v3 => v4 upgrades public string Account { get; private set; } private LibraryBook() { } @@ -24,10 +22,6 @@ namespace DataLayer Account = account; } - // needed for v3 => v4 upgrade - public void UpdateAccount(string account) - => Account ??= account; - public override string ToString() => $"{DateAdded:d} {Book}"; } } diff --git a/DtoImporterService/BookImporter.cs b/DtoImporterService/BookImporter.cs index bb0a874f..6e7b96a1 100644 --- a/DtoImporterService/BookImporter.cs +++ b/DtoImporterService/BookImporter.cs @@ -155,9 +155,6 @@ namespace DtoImporterService book.PictureId = item.PictureId; book.UpdateProductRating(item.Product_OverallStars, item.Product_PerformanceStars, item.Product_StoryStars); - // needed during v3 => v4 migration - book.UpdateLocale(importItem.LocaleName); - // important to update user-specific info. this will have changed if user has rated/reviewed the book since last library import book.UserDefinedItem.UpdateRating(item.MyUserRating_Overall, item.MyUserRating_Performance, item.MyUserRating_Story); diff --git a/DtoImporterService/LibraryBookImporter.cs b/DtoImporterService/LibraryBookImporter.cs index b416db4c..673a1988 100644 --- a/DtoImporterService/LibraryBookImporter.cs +++ b/DtoImporterService/LibraryBookImporter.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using AudibleApi.Common; using DataLayer; using InternalUtilities; @@ -28,7 +27,8 @@ namespace DtoImporterService // - what to show in the grid // - which to consider liberated // - // sqlite cannot alter pk. the work around is an extensive headache. it'll be fixed in pre .net5/efcore5 + // sqlite cannot alter pk. the work around is an extensive headache + // - update: now possible in .net5/efcore5 // // currently, inserting LibraryBook will throw error if the same book is in multiple accounts for the same region. // @@ -46,15 +46,6 @@ namespace DtoImporterService DbContext.LibraryBooks.Add(libraryBook); } - // needed for v3 => v4 upgrade - var toUpdate = DbContext.LibraryBooks.Where(l => l.Account == null); - foreach (var u in toUpdate) - { - var item = importItems.FirstOrDefault(ii => ii.DtoItem.ProductId == u.Book.AudibleProductId); - if (item != null) - u.UpdateAccount(item.AccountId); - } - var qtyNew = newItems.Count; return qtyNew; } diff --git a/LibationLauncher/LibationLauncher.csproj b/LibationLauncher/LibationLauncher.csproj index 675b4d8d..9213d30f 100644 --- a/LibationLauncher/LibationLauncher.csproj +++ b/LibationLauncher/LibationLauncher.csproj @@ -13,7 +13,7 @@ win-x64 - 5.6.3.6 + 5.6.3.10