Compare commits

..

7 Commits

Author SHA1 Message Date
Robert McRackan
83f538d304 Improved logging 2020-02-18 12:20:13 -05:00
Robert McRackan
9e0e06e436 Bugfix: some series indexes/sequences formats cause library not to import 2020-02-17 16:41:12 -05:00
Robert McRackan
f27ac279b2 Bugfix: some series indexes/sequences could cause library not to import 2020-02-17 15:17:59 -05:00
Robert McRackan
ed03fd2451 increment csproj version 2020-02-14 14:08:51 -05:00
Robert McRackan
ccb60ae367 Bugfix: IsAuthorNarrated was returning no books 2020-02-14 14:01:36 -05:00
Robert McRackan
6ad541c199 fix weirdness with build number 2020-01-02 09:01:04 -05:00
Robert McRackan
9606acda26 update release notes 2019-12-31 13:00:36 -05:00
8 changed files with 89 additions and 27 deletions

View File

@@ -131,7 +131,18 @@ namespace DtoImporterService
foreach (var seriesEntry in item.Series)
{
var series = DbContext.Series.Local.Single(s => seriesEntry.SeriesId == s.AudibleSeriesId);
book.UpsertSeries(series, seriesEntry.Index);
var index = 0f;
try
{
index = seriesEntry.Index;
}
catch (Exception ex)
{
Serilog.Log.Logger.Error(ex, $"Error parsing series index. Title: {item.Title}. ASIN: {item.Asin}. Series index: {seriesEntry.Sequence}");
}
book.UpsertSeries(series, index);
}
}
}

View File

@@ -18,6 +18,8 @@ namespace FileLiberator
/// </summary>
public class DownloadBook : DownloadableBase
{
private const string SERVICE_UNAVAILABLE = "Content Delivery Companion Service is not available.";
public override bool Validate(LibraryBook libraryBook)
=> !AudibleFileStorage.Audio.Exists(libraryBook.Book.AudibleProductId)
&& !AudibleFileStorage.AAX.Exists(libraryBook.Book.AudibleProductId);
@@ -48,18 +50,29 @@ namespace FileLiberator
System.Threading.Thread.Sleep(100);
// if bad file download, a 0-33 byte file will be created
// if service unavailable, a 52 byte string will be saved as file
if (new FileInfo(actualFilePath).Length < 100)
var length = new FileInfo(actualFilePath).Length;
if (length > 100)
return actualFilePath;
var contents = File.ReadAllText(actualFilePath);
File.Delete(actualFilePath);
var exMsg = contents.StartsWithInsensitive(SERVICE_UNAVAILABLE)
? SERVICE_UNAVAILABLE
: "Error downloading file";
var ex = new Exception(exMsg);
Serilog.Log.Error(ex, "Download error {@DebugInfo}", new
{
var contents = File.ReadAllText(actualFilePath);
File.Delete(actualFilePath);
var unavailable = "Content Delivery Companion Service is not available.";
if (contents.StartsWithInsensitive(unavailable))
throw new Exception(unavailable);
throw new Exception("Error downloading file");
}
return actualFilePath;
libraryBook.Book.Title,
libraryBook.Book.AudibleProductId,
tempAaxFilename,
actualFilePath,
length,
contents
});
throw ex;
}
private void moveBook(LibraryBook libraryBook, string actualFilePath)

View File

@@ -13,7 +13,7 @@
<!-- <PublishSingleFile>true</PublishSingleFile> -->
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<Version>3.1.2.0</Version>
<Version>3.1.7.5</Version>
</PropertyGroup>
<ItemGroup>

View File

@@ -244,10 +244,27 @@ namespace LibationLauncher
private static void logStartupState()
{
Log.Logger.Information("Begin Libation");
Log.Logger.Information($"Version: {BuildVersion}");
Log.Logger.Information($"LibationFiles: {Configuration.Instance.LibationFiles}");
Log.Logger.Information($"Audible locale: {Configuration.Instance.LocaleCountryCode}");
var config = Configuration.Instance;
Log.Logger.Information("Begin Libation. {@DebugInfo}", new
{
Version = BuildVersion.ToString(),
AudibleLocale = config.LocaleCountryCode,
config.LibationFiles,
AudibleFileStorage.BooksDirectory,
config.DownloadsInProgressEnum,
DownloadsInProgressDir = AudibleFileStorage.DownloadsInProgress,
DownloadsInProgressFiles = Directory.EnumerateFiles(AudibleFileStorage.DownloadsInProgress).Count(),
AudibleFileStorage.DownloadsFinal,
DownloadsFinalFiles = Directory.EnumerateFiles(AudibleFileStorage.DownloadsFinal).Count(),
config.DecryptInProgressEnum,
DecryptInProgressDir = AudibleFileStorage.DecryptInProgress,
DecryptInProgressFiles = Directory.EnumerateFiles(AudibleFileStorage.DecryptInProgress).Count(),
});
}
private static Version BuildVersion => System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

View File

@@ -105,14 +105,24 @@ namespace LibationSearchEngine
["HasPDF"] = lb => lb.Book.Supplements.Any(),
["PDFs"] = lb => lb.Book.Supplements.Any(),
["PDF"] = lb => lb.Book.Supplements.Any(),
["IsRated"] = lb => lb.Book.UserDefinedItem.Rating.OverallRating > 0f,
["Rated"] = lb => lb.Book.UserDefinedItem.Rating.OverallRating > 0f,
["IsAuthorNarrated"] = lb => lb.Book.Authors.Intersect(lb.Book.Narrators).Any(),
["AuthorNarrated"] = lb => lb.Book.Authors.Intersect(lb.Book.Narrators).Any(),
["IsAuthorNarrated"] = lb => isAuthorNarrated(lb),
["AuthorNarrated"] = lb => isAuthorNarrated(lb),
[nameof(Book.IsAbridged)] = lb => lb.Book.IsAbridged,
["Abridged"] = lb => lb.Book.IsAbridged,
});
private static bool isAuthorNarrated(LibraryBook lb)
{
var authors = lb.Book.Authors.Select(a => a.Name).ToArray();
var narrators = lb.Book.Narrators.Select(a => a.Name).ToArray();
return authors.Intersect(narrators).Any();
}
// use these common fields in the "all" default search field
private static IEnumerable<Func<LibraryBook, string>> allFieldIndexRules { get; }
= new List<Func<LibraryBook, string>>

View File

@@ -73,7 +73,7 @@
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(168, 52);
this.label4.TabIndex = 3;
this.label4.Text = "BOOL FIELDS\r\n\r\nFind books that you haven\'t rated:\r\n -IsRated";
this.label4.Text = "BOOLEAN (TRUE/FALSE) FIELDS\r\n\r\nFind books that you haven\'t rated:\r\n -IsRated";
//
// label5
//

View File

@@ -129,18 +129,21 @@ namespace LibationWinForms
// update bottom numbers
var pending = noProgress + downloadedOnly;
var text
var statusStripText
= !results.Any() ? "No books. Begin by importing your library"
: pending > 0 ? string.Format(backupsCountsLbl_Format, noProgress, downloadedOnly, fullyBackedUp)
: $"All {"book".PluralizeWithCount(fullyBackedUp)} backed up";
statusStrip1.UIThread(() => backupsCountsLbl.Text = text);
// update menu item
var menuItemText
= pending > 0
? $"{pending} remaining"
: "All books have been liberated";
Serilog.Log.Logger.Information(menuItemText);
Serilog.Log.Logger.Information("Book counts. {@DebugInfo}", new { fullyBackedUp, downloadedOnly, noProgress, pending, statusStripText, menuItemText });
// update UI
statusStrip1.UIThread(() => backupsCountsLbl.Text = statusStripText);
menuStrip1.UIThread(() => beginBookBackupsToolStripMenuItem.Enabled = pending > 0);
menuStrip1.UIThread(() => beginBookBackupsToolStripMenuItem.Text = string.Format(beginBookBackupsToolStripMenuItem_format, menuItemText));
}
@@ -155,18 +158,21 @@ namespace LibationWinForms
var notDownloaded = boolResults.Count(r => !r);
// update bottom numbers
var text
var statusStripText
= !boolResults.Any() ? ""
: notDownloaded > 0 ? string.Format(pdfsCountsLbl_Format, notDownloaded, downloaded)
: $"| All {downloaded} PDFs downloaded";
statusStrip1.UIThread(() => pdfsCountsLbl.Text = text);
// update menu item
var menuItemText
= notDownloaded > 0
? $"{notDownloaded} remaining"
: "All PDFs have been downloaded";
Serilog.Log.Logger.Information(menuItemText);
Serilog.Log.Logger.Information("PDF counts. {@DebugInfo}", new { downloaded, notDownloaded, statusStripText, menuItemText });
// update UI
statusStrip1.UIThread(() => pdfsCountsLbl.Text = statusStripText);
menuStrip1.UIThread(() => beginPdfBackupsToolStripMenuItem.Enabled = notDownloaded > 0);
menuStrip1.UIThread(() => beginPdfBackupsToolStripMenuItem.Text = string.Format(beginPdfBackupsToolStripMenuItem_format, menuItemText));
}

View File

@@ -1,7 +1,12 @@
-- begin VERSIONING ---------------------------------------------------------------------------------------------------------------------
https://github.com/rmcrackan/Libation/releases
v3.1.2 : null checks
v3.1.7 : Improved logging
v3.1.6 : Bugfix: some series indexes/sequences formats cause library not to import
v3.1.5 : Bugfix: some series indexes/sequences could cause library not to import
v3.1.4 : Bugfix: IsAuthorNarrated was returning no books
v3.1.3 : fix weirdness with build number
v3.1.2 : minor bug fixes
v3.1.1 : Check if upgrade available on github
v3.1.0 : FIRST PUBLIC RELEASE
v3.1-beta.11 : Improved configuration and settings file management. Configurable logging