- add retry logic to library get
- UI bug fix when no library yet - publishing related xml added to data and UI projects - 'how to publish' notes
This commit is contained in:
parent
5d4a97cdc4
commit
9076fae6f6
@ -32,6 +32,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="appsettings.json">
|
<None Update="appsettings.json">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,10 @@
|
|||||||
<TargetFramework>netstandard2.1</TargetFramework>
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Polly" Version="7.1.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\audible api\AudibleApi\AudibleApi\AudibleApi.csproj" />
|
<ProjectReference Include="..\..\audible api\AudibleApi\AudibleApi\AudibleApi.csproj" />
|
||||||
<ProjectReference Include="..\FileManager\FileManager.csproj" />
|
<ProjectReference Include="..\FileManager\FileManager.csproj" />
|
||||||
|
|||||||
@ -5,26 +5,25 @@ using System.Threading.Tasks;
|
|||||||
using AudibleApi;
|
using AudibleApi;
|
||||||
using AudibleApiDTOs;
|
using AudibleApiDTOs;
|
||||||
using FileManager;
|
using FileManager;
|
||||||
|
using Polly;
|
||||||
|
using Polly.Retry;
|
||||||
|
|
||||||
namespace InternalUtilities
|
namespace InternalUtilities
|
||||||
{
|
{
|
||||||
public class AudibleApiActions
|
public class AudibleApiActions
|
||||||
{
|
{
|
||||||
|
private AsyncRetryPolicy policy { get; }
|
||||||
|
= Policy.Handle<Exception>()
|
||||||
|
// 2 retries == 3 total
|
||||||
|
.RetryAsync(2);
|
||||||
|
|
||||||
public async Task<List<Item>> GetAllLibraryItemsAsync(ILoginCallback callback)
|
public async Task<List<Item>> 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
|
// 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:
|
// 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 });
|
// 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
|
// i don't want to incur the cost of making a full dummy call every time because it fails sometimes
|
||||||
|
return await policy.ExecuteAsync(() => getItemsAsync(callback));
|
||||||
try
|
|
||||||
{
|
|
||||||
return await getItemsAsync(callback);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return await getItemsAsync(callback);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<List<Item>> getItemsAsync(ILoginCallback callback)
|
private async Task<List<Item>> getItemsAsync(ILoginCallback callback)
|
||||||
|
|||||||
@ -6,6 +6,11 @@
|
|||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
<ApplicationIcon>libation.ico</ApplicationIcon>
|
<ApplicationIcon>libation.ico</ApplicationIcon>
|
||||||
<AssemblyName>Libation</AssemblyName>
|
<AssemblyName>Libation</AssemblyName>
|
||||||
|
|
||||||
|
<PublishTrimmed>true</PublishTrimmed>
|
||||||
|
<PublishReadyToRun>true</PublishReadyToRun>
|
||||||
|
<PublishSingleFile>true</PublishSingleFile>
|
||||||
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -48,6 +48,8 @@ namespace LibationWinForm
|
|||||||
PictureStorage.SetDefaultImage(PictureSize._300x300, Properties.Resources.default_cover_300x300.ToBytes(format));
|
PictureStorage.SetDefaultImage(PictureSize._300x300, Properties.Resources.default_cover_300x300.ToBytes(format));
|
||||||
PictureStorage.SetDefaultImage(PictureSize._500x500, Properties.Resources.default_cover_500x500.ToBytes(format));
|
PictureStorage.SetDefaultImage(PictureSize._500x500, Properties.Resources.default_cover_500x500.ToBytes(format));
|
||||||
|
|
||||||
|
setVisibleCount(null, 0);
|
||||||
|
|
||||||
reloadGrid();
|
reloadGrid();
|
||||||
|
|
||||||
// also applies filter. ONLY call AFTER loading grid
|
// also applies filter. ONLY call AFTER loading grid
|
||||||
|
|||||||
@ -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
|
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 ---------------------------------------------------------------------------------------------------------------------
|
-- 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 ---------------------------------------------------------------------------------------------------------------------
|
-- 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
|
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 ---------------------------------------------------------------------------------------------------------------------
|
-- end AUDIBLE DETAILS ---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -29,36 +29,13 @@ since we have mult contexts, must use -context:
|
|||||||
Update-Database -context LibationContext
|
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
|
ERROR
|
||||||
=====
|
=====
|
||||||
Add-Migration : The term 'Add-Migration' is not recognized as the name of a cmdlet, function, script file, or operable program
|
Add-Migration : The term 'Add-Migration' is not recognized as the name of a cmdlet, function, script file, or operable program
|
||||||
|
|
||||||
SOLUTION
|
SOLUTION
|
||||||
--------
|
--------
|
||||||
dependencies > manage nuget packages
|
add nuget pkg: Microsoft.EntityFrameworkCore.Tools
|
||||||
add: Microsoft.EntityFrameworkCore.Tools
|
|
||||||
|
|
||||||
|
|
||||||
SQLite
|
SQLite
|
||||||
|
|||||||
32
__TODO.txt
32
__TODO.txt
@ -1,14 +1,28 @@
|
|||||||
-- begin BETA ---------------------------------------------------------------------------------------------------------------------
|
-- begin BETA ---------------------------------------------------------------------------------------------------------------------
|
||||||
OLD WEB DOWNLOADER
|
OLD WEB DOWNLOADER
|
||||||
- download logic in DownloadPdf should look more like DownloadBook
|
download logic in DownloadPdf should look more like DownloadBook
|
||||||
|
|
||||||
TESTING
|
TESTING BUG
|
||||||
possible bug: no mdf,ldf files created in C:\Users\[username]
|
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
|
RELEASE TO BETA
|
||||||
- Create release version and installer
|
Warn of known performance issues
|
||||||
https://dotnetcoretutorials.com/2019/06/20/publishing-a-single-exe-file-in-net-core-3-0/
|
|
||||||
- Warn of known performance issues
|
|
||||||
- Library import
|
- Library import
|
||||||
- Tag add/edit
|
- Tag add/edit
|
||||||
- Grid is slow to respond loading when books aren't liberated
|
- Grid is slow to respond loading when books aren't liberated
|
||||||
@ -90,8 +104,12 @@ replace complex config saving throughout with new way in my ConsoleDependencyInj
|
|||||||
all settings should be strongly typed
|
all settings should be strongly typed
|
||||||
re-create my shortcuts and bak
|
re-create my shortcuts and bak
|
||||||
|
|
||||||
|
for appsettings.json to get copied in the single-file release, project must incl <ExcludeFromSingleFile>true
|
||||||
|
|
||||||
multiple files named "appsettings.json" will overwrite each other
|
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
|
Audible API
|
||||||
\AudibleApi\_Tests\AudibleApi.Tests\bin\Debug\netcoreapp3.0\L1
|
\AudibleApi\_Tests\AudibleApi.Tests\bin\Debug\netcoreapp3.0\L1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user