diff --git a/DataLayer/DataLayer.csproj b/DataLayer/DataLayer.csproj index 179b39e8..9bf98a0a 100644 --- a/DataLayer/DataLayer.csproj +++ b/DataLayer/DataLayer.csproj @@ -32,6 +32,7 @@ PreserveNewest + true diff --git a/InternalUtilities/InternalUtilities.csproj b/InternalUtilities/InternalUtilities.csproj index 531ac0e6..7650ffef 100644 --- a/InternalUtilities/InternalUtilities.csproj +++ b/InternalUtilities/InternalUtilities.csproj @@ -4,6 +4,10 @@ netstandard2.1 + + + + diff --git a/InternalUtilities/UNTESTED/AudibleApiActions.cs b/InternalUtilities/UNTESTED/AudibleApiActions.cs index 8b12e2ea..8601734d 100644 --- a/InternalUtilities/UNTESTED/AudibleApiActions.cs +++ b/InternalUtilities/UNTESTED/AudibleApiActions.cs @@ -5,26 +5,25 @@ using System.Threading.Tasks; using AudibleApi; using AudibleApiDTOs; using FileManager; +using Polly; +using Polly.Retry; namespace InternalUtilities { public class AudibleApiActions { + private AsyncRetryPolicy policy { get; } + = Policy.Handle() + // 2 retries == 3 total + .RetryAsync(2); + public async Task> GetAllLibraryItemsAsync(ILoginCallback callback) { // bug on audible's side. the 1st time after a long absence, a query to get library will return without titles or authors. a subsequent identical query will be successful. this is true whether or tokens are refreshed // worse, this 1st dummy call doesn't seem to help: // var page = await api.GetLibraryAsync(new AudibleApi.LibraryOptions { NumberOfResultPerPage = 1, PageNumber = 1, PurchasedAfter = DateTime.Now.AddYears(-20), ResponseGroups = AudibleApi.LibraryOptions.ResponseGroupOptions.ALL_OPTIONS }); // i don't want to incur the cost of making a full dummy call every time because it fails sometimes - - try - { - return await getItemsAsync(callback); - } - catch - { - return await getItemsAsync(callback); - } + return await policy.ExecuteAsync(() => getItemsAsync(callback)); } private async Task> getItemsAsync(ILoginCallback callback) diff --git a/LibationWinForm/LibationWinForm.csproj b/LibationWinForm/LibationWinForm.csproj index 848fb6d5..6a009625 100644 --- a/LibationWinForm/LibationWinForm.csproj +++ b/LibationWinForm/LibationWinForm.csproj @@ -6,6 +6,11 @@ true libation.ico Libation + + true + true + true + win-x64 diff --git a/LibationWinForm/UNTESTED/Form1.cs b/LibationWinForm/UNTESTED/Form1.cs index 19d2706c..e97d607e 100644 --- a/LibationWinForm/UNTESTED/Form1.cs +++ b/LibationWinForm/UNTESTED/Form1.cs @@ -33,14 +33,14 @@ namespace LibationWinForm pdfsCountsLbl_Format = pdfsCountsLbl.Text; visibleCountLbl_Format = visibleCountLbl.Text; - beginBookBackupsToolStripMenuItem_format = beginBookBackupsToolStripMenuItem.Text; + beginBookBackupsToolStripMenuItem_format = beginBookBackupsToolStripMenuItem.Text; beginPdfBackupsToolStripMenuItem_format = beginPdfBackupsToolStripMenuItem.Text; } private async void Form1_Load(object sender, EventArgs e) - { - // call static ctor. There are bad race conditions if static ctor is first executed when we're running in parallel in setBackupCountsAsync() - var foo = FilePathCache.JsonFile; + { + // call static ctor. There are bad race conditions if static ctor is first executed when we're running in parallel in setBackupCountsAsync() + var foo = FilePathCache.JsonFile; // load default/missing cover images. this will also initiate the background image downloader var format = System.Drawing.Imaging.ImageFormat.Jpeg; @@ -48,6 +48,8 @@ namespace LibationWinForm PictureStorage.SetDefaultImage(PictureSize._300x300, Properties.Resources.default_cover_300x300.ToBytes(format)); PictureStorage.SetDefaultImage(PictureSize._500x500, Properties.Resources.default_cover_500x500.ToBytes(format)); + setVisibleCount(null, 0); + reloadGrid(); // also applies filter. ONLY call AFTER loading grid diff --git a/REFERENCE.txt b/REFERENCE.txt index e056c25f..1a4d3d3c 100644 --- a/REFERENCE.txt +++ b/REFERENCE.txt @@ -5,6 +5,29 @@ v3.0.1 : Legacy inAudible wire-up code is still present but is commented out. Al v3.0 : This version is fully powered by the Audible API. Legacy scraping code is still present but is commented out. All future check-ins are not guaranteed to have any scraping code -- end VERSIONING --------------------------------------------------------------------------------------------------------------------- +-- begin HOW TO PUBLISH --------------------------------------------------------------------------------------------------------------------- +OPTION 1: UI +rt-clk project > Publish... +click Publish + +OPTION 2: cmd line +change dir to folder containing project + cd C:\[full...path]\Libation\LibationWinForm +this will use the parameters specified in csproj +dotnet publish -c Release + +OPTION 3: cmd line, custom +open csproj +remove: PublishTrimmed, PublishReadyToRun, PublishSingleFile, RuntimeIdentifier +run customized publish. examples: +publish all platforms + dotnet publish -c Release +publish win64 platform only + dotnet publish -r win-x64 -c Release +publish win64 platform, single-file + dotnet publish -r win-x64 -c Release /p:PublishSingleFile=true +-- end HOW TO PUBLISH --------------------------------------------------------------------------------------------------------------------- + -- begin AUDIBLE DETAILS --------------------------------------------------------------------------------------------------------------------- alternate book id (eg BK_RAND_006061) is called 'sku' , 'sku_lite' , 'prod_id' , 'product_id' in different parts of the site -- end AUDIBLE DETAILS --------------------------------------------------------------------------------------------------------------------- diff --git a/_DB_NOTES.txt b/_DB_NOTES.txt index 5b379574..5cfdb4dd 100644 --- a/_DB_NOTES.txt +++ b/_DB_NOTES.txt @@ -29,36 +29,13 @@ since we have mult contexts, must use -context: Update-Database -context LibationContext -QUICK VIEW -========== -declare @productId nvarchar(450) = 'B075Y4SWJ8' - declare @bookId int - declare @catId int - select @bookId = b.BookId from Books b where b.AudibleProductId = @productId - select @catId = b.CategoryId from Books b where b.AudibleProductId = @productId -select * from Books b where b.AudibleProductId = @productId -select * - from BookContributor bc - join Contributors c on bc.ContributorId = c.ContributorId - where bc.BookId = @bookId order by role, [order] -select * - from SeriesBook sb - join Series s on sb.SeriesId = s.SeriesId - where sb.BookId = @bookId -select * - from Categories c1 - left join Categories c2 on c1.ParentCategoryCategoryId = c2.CategoryId - where c1.CategoryId = @catId - - ERROR ===== Add-Migration : The term 'Add-Migration' is not recognized as the name of a cmdlet, function, script file, or operable program SOLUTION -------- -dependencies > manage nuget packages -add: Microsoft.EntityFrameworkCore.Tools +add nuget pkg: Microsoft.EntityFrameworkCore.Tools SQLite diff --git a/__TODO.txt b/__TODO.txt index 03ec049c..5a6a56c8 100644 --- a/__TODO.txt +++ b/__TODO.txt @@ -1,18 +1,32 @@ -- begin BETA --------------------------------------------------------------------------------------------------------------------- OLD WEB DOWNLOADER -- download logic in DownloadPdf should look more like DownloadBook +download logic in DownloadPdf should look more like DownloadBook -TESTING -possible bug: no mdf,ldf files created in C:\Users\[username] +TESTING BUG +dbl clk. long pause. exception: +System.ComponentModel.Win32Exception (2): The system cannot find the file specified. +"continue" button allows me to keep using +bottom #s do not update +login succeeded. IdentityTokens.json successfully created +received above error again during scan. continue +stuck on scan. force quit from task manager +only files: + Images -- empty dir + IdentityTokens.json -- populated +no mdf, ldf + +REPLACE DB +need completely need db? replace LocalDb with sqlite? embedded document nosql? + +CREATE INSTALLER +see REFERENCE.txt > HOW TO PUBLISH RELEASE TO BETA -- Create release version and installer - https://dotnetcoretutorials.com/2019/06/20/publishing-a-single-exe-file-in-net-core-3-0/ -- Warn of known performance issues - - Library import - - Tag add/edit - - Grid is slow to respond loading when books aren't liberated - - get decrypt key -- unavoidable +Warn of known performance issues +- Library import +- Tag add/edit +- Grid is slow to respond loading when books aren't liberated +- get decrypt key -- unavoidable -- end BETA --------------------------------------------------------------------------------------------------------------------- -- begin ENHANCEMENT, IMPORT UI --------------------------------------------------------------------------------------------------------------------- @@ -90,8 +104,12 @@ replace complex config saving throughout with new way in my ConsoleDependencyInj all settings should be strongly typed re-create my shortcuts and bak +for appsettings.json to get copied in the single-file release, project must incl true + multiple files named "appsettings.json" will overwrite each other -libraries should avoid this generic name. ok for applications to use them +libraries should avoid this generic name. in general: ok for applications to use them +there are exceptions: datalayer has appsettings which is copied to winform. if winform uses appsettings also, it will override datalayer's + Audible API \AudibleApi\_Tests\AudibleApi.Tests\bin\Debug\netcoreapp3.0\L1