Added validation and error handling
BETA READY
This commit is contained in:
parent
e319326c30
commit
b9314ac678
@ -43,19 +43,19 @@ namespace FileLiberator
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
var statusHandler = await processAsync(libraryBook, AudibleFileStorage.AAX, DownloadBook);
|
var statusHandler = await DownloadBook.TryProcessAsync(libraryBook);
|
||||||
if (statusHandler.HasErrors)
|
if (statusHandler.HasErrors)
|
||||||
return statusHandler;
|
return statusHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
var statusHandler = await processAsync(libraryBook, AudibleFileStorage.Audio, DecryptBook);
|
var statusHandler = await DecryptBook.TryProcessAsync(libraryBook);
|
||||||
if (statusHandler.HasErrors)
|
if (statusHandler.HasErrors)
|
||||||
return statusHandler;
|
return statusHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
var statusHandler = await processAsync(libraryBook, AudibleFileStorage.PDF, DownloadPdf);
|
var statusHandler = await DownloadPdf.TryProcessAsync(libraryBook);
|
||||||
if (statusHandler.HasErrors)
|
if (statusHandler.HasErrors)
|
||||||
return statusHandler;
|
return statusHandler;
|
||||||
}
|
}
|
||||||
@ -67,10 +67,5 @@ namespace FileLiberator
|
|||||||
Completed?.Invoke(this, displayMessage);
|
Completed?.Invoke(this, displayMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task<StatusHandler> processAsync(LibraryBook libraryBook, AudibleFileStorage afs, IProcessable processable)
|
|
||||||
=> !await afs.ExistsAsync(libraryBook.Book.AudibleProductId)
|
|
||||||
? await processable.ProcessAsync(libraryBook)
|
|
||||||
: new StatusHandler();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,12 +13,8 @@ namespace FileLiberator
|
|||||||
public class DownloadPdf : DownloadableBase
|
public class DownloadPdf : DownloadableBase
|
||||||
{
|
{
|
||||||
public override async Task<bool> ValidateAsync(LibraryBook libraryBook)
|
public override async Task<bool> ValidateAsync(LibraryBook libraryBook)
|
||||||
{
|
=> !string.IsNullOrWhiteSpace(getdownloadUrl(libraryBook))
|
||||||
if (string.IsNullOrWhiteSpace(getdownloadUrl(libraryBook)))
|
&& !await AudibleFileStorage.PDF.ExistsAsync(libraryBook.Book.AudibleProductId);
|
||||||
return false;
|
|
||||||
|
|
||||||
return !await AudibleFileStorage.PDF.ExistsAsync(libraryBook.Book.AudibleProductId);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string getdownloadUrl(LibraryBook libraryBook)
|
private static string getdownloadUrl(LibraryBook libraryBook)
|
||||||
=> libraryBook?.Book?.Supplements?.FirstOrDefault()?.Url;
|
=> libraryBook?.Book?.Supplements?.FirstOrDefault()?.Url;
|
||||||
|
|||||||
@ -40,5 +40,10 @@ namespace FileLiberator
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public static async Task<StatusHandler> TryProcessAsync(this IProcessable processable, LibraryBook libraryBook)
|
||||||
|
=> await processable.ValidateAsync(libraryBook)
|
||||||
|
? await processable.ProcessAsync(libraryBook)
|
||||||
|
: new StatusHandler();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
<PublishTrimmed>true</PublishTrimmed>
|
<PublishTrimmed>true</PublishTrimmed>
|
||||||
<PublishReadyToRun>true</PublishReadyToRun>
|
<PublishReadyToRun>true</PublishReadyToRun>
|
||||||
<PublishSingleFile>true</PublishSingleFile>
|
<!-- <PublishSingleFile>true</PublishSingleFile> -->
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,14 @@ namespace LibationWinForm
|
|||||||
|
|
||||||
private async void IndexLibraryDialog_Shown(object sender, System.EventArgs e)
|
private async void IndexLibraryDialog_Shown(object sender, System.EventArgs e)
|
||||||
{
|
{
|
||||||
(TotalBooksProcessed, NewBooksAdded) = await LibraryCommands.IndexLibraryAsync(new Login.WinformResponder());
|
try
|
||||||
|
{
|
||||||
|
(TotalBooksProcessed, NewBooksAdded) = await LibraryCommands.IndexLibraryAsync(new Login.WinformResponder());
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
MessageBox.Show("Error importing library. Please try again. If this happens after 2 or 3 tries, contact administrator", "Error importing library", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,17 @@
|
|||||||
-- begin VERSIONING ---------------------------------------------------------------------------------------------------------------------
|
-- begin VERSIONING ---------------------------------------------------------------------------------------------------------------------
|
||||||
https://github.com/rmcrackan/Libation/releases
|
https://github.com/rmcrackan/Libation/releases
|
||||||
|
|
||||||
v3.0.3 : Switch to SQLite
|
v3.0.3 : Switch to SQLite. No longer relies on LocalDB, which must be installed separately
|
||||||
v3.0.2 : Final using LocalDB
|
v3.0.2 : Final using LocalDB
|
||||||
v3.0.1 : Legacy inAudible wire-up code is still present but is commented out. All future check-ins are not guaranteed to have inAudible wire-up code
|
v3.0.1 : Legacy inAudible wire-up code is still present but is commented out. All future check-ins are not guaranteed to have inAudible wire-up 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
|
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
|
||||||
|
v2 : new library page scraping. still chrome cookies. all decryption is handled natively. no inAudible dependency
|
||||||
|
v1 : old library ajax scraping. wish list scraping. chrome cookies. directly call local inAudible. .net framework
|
||||||
-- end VERSIONING ---------------------------------------------------------------------------------------------------------------------
|
-- end VERSIONING ---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- begin HOW TO PUBLISH ---------------------------------------------------------------------------------------------------------------------
|
-- begin HOW TO PUBLISH ---------------------------------------------------------------------------------------------------------------------
|
||||||
OPTION 1: UI
|
OPTION 1: UI
|
||||||
rt-clk project > Publish...
|
rt-clk project project > Publish...
|
||||||
click Publish
|
click Publish
|
||||||
|
|
||||||
OPTION 2: cmd line
|
OPTION 2: cmd line
|
||||||
|
|||||||
33
__TODO.txt
33
__TODO.txt
@ -1,24 +1,17 @@
|
|||||||
-- begin BETA ---------------------------------------------------------------------------------------------------------------------
|
-- begin BETA ---------------------------------------------------------------------------------------------------------------------
|
||||||
TESTING BUG
|
FINAL PRE-BETA TEST
|
||||||
dbl clk. long pause. exception:
|
create release
|
||||||
System.ComponentModel.Win32Exception (2): The system cannot find the file specified.
|
v3.1 beta
|
||||||
"continue" button allows me to keep using
|
update REFERENCE.txt with this release
|
||||||
bottom #s do not update
|
publish exe and attach it to the beta release
|
||||||
login succeeded. IdentityTokens.json successfully created
|
start beta: contact beta members
|
||||||
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 new db? replace LocalDb with sqlite? embedded document nosql (LiteDB)?
|
|
||||||
|
|
||||||
CREATE INSTALLER
|
CREATE INSTALLER
|
||||||
see REFERENCE.txt > HOW TO PUBLISH
|
see REFERENCE.txt > HOW TO PUBLISH
|
||||||
|
|
||||||
RELEASE TO BETA
|
RELEASE TO BETA
|
||||||
|
Note: run Libation.exe -- icon is a black wine glass
|
||||||
|
I recommend making a shortcut. I'm working on a more manageable install but it's low priority
|
||||||
Warn of known performance issues
|
Warn of known performance issues
|
||||||
- Library import
|
- Library import
|
||||||
- Tag add/edit
|
- Tag add/edit
|
||||||
@ -27,6 +20,16 @@ Warn of known performance issues
|
|||||||
- images can take a bit to initially load. downloading is throttled as to not get the IP blocked by audible
|
- images can take a bit to initially load. downloading is throttled as to not get the IP blocked by audible
|
||||||
-- end BETA ---------------------------------------------------------------------------------------------------------------------
|
-- end BETA ---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- begin SINGLE FILE PUBLISH ---------------------------------------------------------------------------------------------------------------------
|
||||||
|
SINGLE FILE. FUTURE FIX
|
||||||
|
<!-- <PublishSingleFile>true</PublishSingleFile> -->
|
||||||
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
|
Runs from weird temp location
|
||||||
|
- Weird default location for files
|
||||||
|
- Can’t find json
|
||||||
|
- don't have external exe.s
|
||||||
|
-- end SINGLE FILE PUBLISH ---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- begin ENHANCEMENT, IMPORT UI ---------------------------------------------------------------------------------------------------------------------
|
-- begin ENHANCEMENT, IMPORT UI ---------------------------------------------------------------------------------------------------------------------
|
||||||
scan library in background?
|
scan library in background?
|
||||||
can include a notice somewhere that a scan is in-process
|
can include a notice somewhere that a scan is in-process
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user