Added validation and error handling
BETA READY
This commit is contained in:
parent
e319326c30
commit
b9314ac678
@ -43,19 +43,19 @@ namespace FileLiberator
|
||||
try
|
||||
{
|
||||
{
|
||||
var statusHandler = await processAsync(libraryBook, AudibleFileStorage.AAX, DownloadBook);
|
||||
var statusHandler = await DownloadBook.TryProcessAsync(libraryBook);
|
||||
if (statusHandler.HasErrors)
|
||||
return statusHandler;
|
||||
}
|
||||
|
||||
{
|
||||
var statusHandler = await processAsync(libraryBook, AudibleFileStorage.Audio, DecryptBook);
|
||||
var statusHandler = await DecryptBook.TryProcessAsync(libraryBook);
|
||||
if (statusHandler.HasErrors)
|
||||
return statusHandler;
|
||||
}
|
||||
|
||||
{
|
||||
var statusHandler = await processAsync(libraryBook, AudibleFileStorage.PDF, DownloadPdf);
|
||||
var statusHandler = await DownloadPdf.TryProcessAsync(libraryBook);
|
||||
if (statusHandler.HasErrors)
|
||||
return statusHandler;
|
||||
}
|
||||
@ -67,10 +67,5 @@ namespace FileLiberator
|
||||
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 override async Task<bool> ValidateAsync(LibraryBook libraryBook)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(getdownloadUrl(libraryBook)))
|
||||
return false;
|
||||
|
||||
return !await AudibleFileStorage.PDF.ExistsAsync(libraryBook.Book.AudibleProductId);
|
||||
}
|
||||
=> !string.IsNullOrWhiteSpace(getdownloadUrl(libraryBook))
|
||||
&& !await AudibleFileStorage.PDF.ExistsAsync(libraryBook.Book.AudibleProductId);
|
||||
|
||||
private static string getdownloadUrl(LibraryBook libraryBook)
|
||||
=> libraryBook?.Book?.Supplements?.FirstOrDefault()?.Url;
|
||||
|
||||
@ -40,5 +40,10 @@ namespace FileLiberator
|
||||
|
||||
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>
|
||||
<PublishReadyToRun>true</PublishReadyToRun>
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<!-- <PublishSingleFile>true</PublishSingleFile> -->
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@ -15,8 +15,15 @@ namespace LibationWinForm
|
||||
}
|
||||
|
||||
private async void IndexLibraryDialog_Shown(object sender, System.EventArgs e)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
@ -1,15 +1,17 @@
|
||||
-- begin VERSIONING ---------------------------------------------------------------------------------------------------------------------
|
||||
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.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
|
||||
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 ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- begin HOW TO PUBLISH ---------------------------------------------------------------------------------------------------------------------
|
||||
OPTION 1: UI
|
||||
rt-clk project > Publish...
|
||||
rt-clk project project > Publish...
|
||||
click Publish
|
||||
|
||||
OPTION 2: cmd line
|
||||
|
||||
33
__TODO.txt
33
__TODO.txt
@ -1,24 +1,17 @@
|
||||
-- begin BETA ---------------------------------------------------------------------------------------------------------------------
|
||||
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 new db? replace LocalDb with sqlite? embedded document nosql (LiteDB)?
|
||||
FINAL PRE-BETA TEST
|
||||
create release
|
||||
v3.1 beta
|
||||
update REFERENCE.txt with this release
|
||||
publish exe and attach it to the beta release
|
||||
start beta: contact beta members
|
||||
|
||||
CREATE INSTALLER
|
||||
see REFERENCE.txt > HOW TO PUBLISH
|
||||
|
||||
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
|
||||
- Library import
|
||||
- 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
|
||||
-- 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 ---------------------------------------------------------------------------------------------------------------------
|
||||
scan library in background?
|
||||
can include a notice somewhere that a scan is in-process
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user