Address #625 comments and refactor
This commit is contained in:
parent
b4aa220051
commit
2c4705de6e
@ -10,7 +10,7 @@ namespace ApplicationServices
|
|||||||
{
|
{
|
||||||
public class BulkSetDownloadStatus
|
public class BulkSetDownloadStatus
|
||||||
{
|
{
|
||||||
private List<(string message, LiberatedStatus newStatus, IEnumerable<Book> Books)> actionSets { get; } = new();
|
private List<(string message, LiberatedStatus newStatus, IEnumerable<LibraryBook> LibraryBooks)> actionSets { get; } = new();
|
||||||
|
|
||||||
public int Count => actionSets.Count;
|
public int Count => actionSets.Count;
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ namespace ApplicationServices
|
|||||||
var bookExistsList = _libraryBooks
|
var bookExistsList = _libraryBooks
|
||||||
.Select(libraryBook => new
|
.Select(libraryBook => new
|
||||||
{
|
{
|
||||||
libraryBook.Book,
|
LibraryBook = libraryBook,
|
||||||
FileExists = AudibleFileStorage.Audio.GetPath(libraryBook.Book.AudibleProductId) is not null
|
FileExists = AudibleFileStorage.Audio.GetPath(libraryBook.Book.AudibleProductId) is not null
|
||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
@ -41,8 +41,8 @@ namespace ApplicationServices
|
|||||||
if (_setDownloaded)
|
if (_setDownloaded)
|
||||||
{
|
{
|
||||||
var books2change = bookExistsList
|
var books2change = bookExistsList
|
||||||
.Where(a => a.FileExists && a.Book.UserDefinedItem.BookStatus != LiberatedStatus.Liberated)
|
.Where(a => a.FileExists && a.LibraryBook.Book.UserDefinedItem.BookStatus != LiberatedStatus.Liberated)
|
||||||
.Select(a => a.Book)
|
.Select(a => a.LibraryBook)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
if (books2change.Any())
|
if (books2change.Any())
|
||||||
@ -55,8 +55,8 @@ namespace ApplicationServices
|
|||||||
if (_setNotDownloaded)
|
if (_setNotDownloaded)
|
||||||
{
|
{
|
||||||
var books2change = bookExistsList
|
var books2change = bookExistsList
|
||||||
.Where(a => !a.FileExists && a.Book.UserDefinedItem.BookStatus != LiberatedStatus.NotLiberated)
|
.Where(a => !a.FileExists && a.LibraryBook.Book.UserDefinedItem.BookStatus != LiberatedStatus.NotLiberated)
|
||||||
.Select(a => a.Book)
|
.Select(a => a.LibraryBook)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
if (books2change.Any())
|
if (books2change.Any())
|
||||||
@ -72,7 +72,7 @@ namespace ApplicationServices
|
|||||||
public void Execute()
|
public void Execute()
|
||||||
{
|
{
|
||||||
foreach (var a in actionSets)
|
foreach (var a in actionSets)
|
||||||
a.Books.UpdateBookStatus(a.newStatus);
|
a.LibraryBooks.UpdateBookStatus(a.newStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -446,25 +446,25 @@ namespace ApplicationServices
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when the size of the library does not change but book(s) details do. Especially when <see cref="UserDefinedItem.Tags"/>, <see cref="UserDefinedItem.BookStatus"/>, or <see cref="UserDefinedItem.PdfStatus"/> changed values are successfully persisted.
|
/// Occurs when the size of the library does not change but book(s) details do. Especially when <see cref="UserDefinedItem.Tags"/>, <see cref="UserDefinedItem.BookStatus"/>, or <see cref="UserDefinedItem.PdfStatus"/> changed values are successfully persisted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static event EventHandler<IEnumerable<Book>> BookUserDefinedItemCommitted;
|
public static event EventHandler<IEnumerable<LibraryBook>> BookUserDefinedItemCommitted;
|
||||||
|
|
||||||
#region Update book details
|
#region Update book details
|
||||||
public static int UpdateUserDefinedItem(
|
public static int UpdateUserDefinedItem(
|
||||||
this Book book,
|
this LibraryBook lb,
|
||||||
string tags = null,
|
string tags = null,
|
||||||
LiberatedStatus? bookStatus = null,
|
LiberatedStatus? bookStatus = null,
|
||||||
LiberatedStatus? pdfStatus = null,
|
LiberatedStatus? pdfStatus = null,
|
||||||
Rating rating = null)
|
Rating rating = null)
|
||||||
=> new[] { book }.UpdateUserDefinedItem(tags, bookStatus, pdfStatus, rating);
|
=> new[] { lb }.UpdateUserDefinedItem(tags, bookStatus, pdfStatus, rating);
|
||||||
|
|
||||||
public static int UpdateUserDefinedItem(
|
public static int UpdateUserDefinedItem(
|
||||||
this IEnumerable<Book> books,
|
this IEnumerable<LibraryBook> lb,
|
||||||
string tags = null,
|
string tags = null,
|
||||||
LiberatedStatus? bookStatus = null,
|
LiberatedStatus? bookStatus = null,
|
||||||
LiberatedStatus? pdfStatus = null,
|
LiberatedStatus? pdfStatus = null,
|
||||||
Rating rating = null)
|
Rating rating = null)
|
||||||
=> updateUserDefinedItem(
|
=> updateUserDefinedItem(
|
||||||
books,
|
lb,
|
||||||
udi => {
|
udi => {
|
||||||
// blank tags are expected. null tags are not
|
// blank tags are expected. null tags are not
|
||||||
if (tags is not null)
|
if (tags is not null)
|
||||||
@ -480,66 +480,52 @@ namespace ApplicationServices
|
|||||||
udi.UpdateRating(rating.OverallRating, rating.PerformanceRating, rating.StoryRating);
|
udi.UpdateRating(rating.OverallRating, rating.PerformanceRating, rating.StoryRating);
|
||||||
});
|
});
|
||||||
|
|
||||||
public static int UpdateBookStatus(this Book book, LiberatedStatus bookStatus, Version libationVersion)
|
public static int UpdateBookStatus(this LibraryBook lb, LiberatedStatus bookStatus, Version libationVersion)
|
||||||
=> book.UpdateUserDefinedItem(udi => { udi.BookStatus = bookStatus; udi.SetLastDownloaded(libationVersion); });
|
=> lb.UpdateUserDefinedItem(udi => { udi.BookStatus = bookStatus; udi.SetLastDownloaded(libationVersion); });
|
||||||
public static int UpdateBookStatus(this Book book, LiberatedStatus bookStatus)
|
|
||||||
=> book.UpdateUserDefinedItem(udi => udi.BookStatus = bookStatus);
|
|
||||||
public static int UpdateBookStatus(this IEnumerable<Book> books, LiberatedStatus bookStatus)
|
|
||||||
=> books.UpdateUserDefinedItem(udi => udi.BookStatus = bookStatus);
|
|
||||||
public static int UpdateBookStatus(this LibraryBook libraryBook, LiberatedStatus bookStatus)
|
public static int UpdateBookStatus(this LibraryBook libraryBook, LiberatedStatus bookStatus)
|
||||||
=> libraryBook.UpdateUserDefinedItem(udi => udi.BookStatus = bookStatus);
|
=> libraryBook.UpdateUserDefinedItem(udi => udi.BookStatus = bookStatus);
|
||||||
public static int UpdateBookStatus(this IEnumerable<LibraryBook> libraryBooks, LiberatedStatus bookStatus)
|
public static int UpdateBookStatus(this IEnumerable<LibraryBook> libraryBooks, LiberatedStatus bookStatus)
|
||||||
=> libraryBooks.UpdateUserDefinedItem(udi => udi.BookStatus = bookStatus);
|
=> libraryBooks.UpdateUserDefinedItem(udi => udi.BookStatus = bookStatus);
|
||||||
|
|
||||||
public static int UpdatePdfStatus(this Book book, LiberatedStatus pdfStatus)
|
|
||||||
=> book.UpdateUserDefinedItem(udi => udi.SetPdfStatus(pdfStatus));
|
|
||||||
public static int UpdatePdfStatus(this IEnumerable<Book> books, LiberatedStatus pdfStatus)
|
|
||||||
=> books.UpdateUserDefinedItem(udi => udi.SetPdfStatus(pdfStatus));
|
|
||||||
public static int UpdatePdfStatus(this LibraryBook libraryBook, LiberatedStatus pdfStatus)
|
public static int UpdatePdfStatus(this LibraryBook libraryBook, LiberatedStatus pdfStatus)
|
||||||
=> libraryBook.UpdateUserDefinedItem(udi => udi.SetPdfStatus(pdfStatus));
|
=> libraryBook.UpdateUserDefinedItem(udi => udi.SetPdfStatus(pdfStatus));
|
||||||
public static int UpdatePdfStatus(this IEnumerable<LibraryBook> libraryBooks, LiberatedStatus pdfStatus)
|
public static int UpdatePdfStatus(this IEnumerable<LibraryBook> libraryBooks, LiberatedStatus pdfStatus)
|
||||||
=> libraryBooks.UpdateUserDefinedItem(udi => udi.SetPdfStatus(pdfStatus));
|
=> libraryBooks.UpdateUserDefinedItem(udi => udi.SetPdfStatus(pdfStatus));
|
||||||
|
|
||||||
public static int UpdateTags(this Book book, string tags)
|
|
||||||
=> book.UpdateUserDefinedItem(udi => udi.Tags = tags);
|
|
||||||
public static int UpdateTags(this IEnumerable<Book> books, string tags)
|
|
||||||
=> books.UpdateUserDefinedItem(udi => udi.Tags = tags);
|
|
||||||
public static int UpdateTags(this LibraryBook libraryBook, string tags)
|
public static int UpdateTags(this LibraryBook libraryBook, string tags)
|
||||||
=> libraryBook.UpdateUserDefinedItem(udi => udi.Tags = tags);
|
=> libraryBook.UpdateUserDefinedItem(udi => udi.Tags = tags);
|
||||||
public static int UpdateTags(this IEnumerable<LibraryBook> libraryBooks, string tags)
|
public static int UpdateTags(this IEnumerable<LibraryBook> libraryBooks, string tags)
|
||||||
=> libraryBooks.UpdateUserDefinedItem(udi => udi.Tags = tags);
|
=> libraryBooks.UpdateUserDefinedItem(udi => udi.Tags = tags);
|
||||||
|
|
||||||
public static int UpdateUserDefinedItem(this LibraryBook libraryBook, Action<UserDefinedItem> action)
|
public static int UpdateUserDefinedItem(this LibraryBook libraryBook, Action<UserDefinedItem> action)
|
||||||
=> libraryBook.Book.updateUserDefinedItem(action);
|
=> libraryBook.updateUserDefinedItem(action);
|
||||||
public static int UpdateUserDefinedItem(this IEnumerable<LibraryBook> libraryBooks, Action<UserDefinedItem> action)
|
public static int UpdateUserDefinedItem(this IEnumerable<LibraryBook> libraryBooks, Action<UserDefinedItem> action)
|
||||||
=> libraryBooks.Select(lb => lb.Book).updateUserDefinedItem(action);
|
=> libraryBooks.updateUserDefinedItem(action);
|
||||||
|
|
||||||
public static int UpdateUserDefinedItem(this Book book, Action<UserDefinedItem> action) => book.updateUserDefinedItem(action);
|
private static int updateUserDefinedItem(this LibraryBook libraryBook, Action<UserDefinedItem> action) => new[] { libraryBook }.updateUserDefinedItem(action);
|
||||||
public static int UpdateUserDefinedItem(this IEnumerable<Book> books, Action<UserDefinedItem> action) => books.updateUserDefinedItem(action);
|
private static int updateUserDefinedItem(this IEnumerable<LibraryBook> libraryBooks, Action<UserDefinedItem> action)
|
||||||
|
|
||||||
private static int updateUserDefinedItem(this Book book, Action<UserDefinedItem> action) => new[] { book }.updateUserDefinedItem(action);
|
|
||||||
private static int updateUserDefinedItem(this IEnumerable<Book> books, Action<UserDefinedItem> action)
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (books is null || !books.Any())
|
if (libraryBooks is null || !libraryBooks.Any())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
foreach (var book in books)
|
foreach (var book in libraryBooks)
|
||||||
action?.Invoke(book.UserDefinedItem);
|
action?.Invoke(book.Book.UserDefinedItem);
|
||||||
|
|
||||||
using var context = DbContexts.GetContext();
|
using var context = DbContexts.GetContext();
|
||||||
|
|
||||||
// Attach() NoTracking entities before SaveChanges()
|
// Attach() NoTracking entities before SaveChanges()
|
||||||
foreach (var book in books)
|
foreach (var book in libraryBooks)
|
||||||
{
|
{
|
||||||
context.Attach(book.UserDefinedItem).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
|
context.Attach(book.Book.UserDefinedItem).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
|
||||||
context.Attach(book.UserDefinedItem.Rating).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
|
context.Attach(book.Book.UserDefinedItem.Rating).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
|
||||||
}
|
}
|
||||||
|
|
||||||
var qtyChanges = context.SaveChanges();
|
var qtyChanges = context.SaveChanges();
|
||||||
if (qtyChanges > 0)
|
if (qtyChanges > 0)
|
||||||
BookUserDefinedItemCommitted?.Invoke(null, books);
|
BookUserDefinedItemCommitted?.Invoke(null, libraryBooks);
|
||||||
|
|
||||||
return qtyChanges;
|
return qtyChanges;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@ namespace ApplicationServices
|
|||||||
#region Update
|
#region Update
|
||||||
private static bool isUpdating;
|
private static bool isUpdating;
|
||||||
|
|
||||||
public static void UpdateBooks(IEnumerable<Book> books)
|
public static void UpdateBooks(IEnumerable<LibraryBook> books)
|
||||||
{
|
{
|
||||||
// Semi-arbitrary. At some point it's more worth it to do a full re-index than to do one offs.
|
// Semi-arbitrary. At some point it's more worth it to do a full re-index than to do one offs.
|
||||||
// I did not benchmark before choosing the number here
|
// I did not benchmark before choosing the number here
|
||||||
@ -49,10 +49,10 @@ namespace ApplicationServices
|
|||||||
|
|
||||||
public static void FullReIndex() => performSafeCommand(fullReIndex);
|
public static void FullReIndex() => performSafeCommand(fullReIndex);
|
||||||
|
|
||||||
internal static void UpdateUserDefinedItems(Book book) => performSafeCommand(e =>
|
internal static void UpdateUserDefinedItems(LibraryBook book) => performSafeCommand(e =>
|
||||||
{
|
{
|
||||||
e.UpdateLiberatedStatus(book);
|
e.UpdateLiberatedStatus(book);
|
||||||
e.UpdateTags(book.AudibleProductId, book.UserDefinedItem.Tags);
|
e.UpdateTags(book.Book.AudibleProductId, book.Book.UserDefinedItem.Tags);
|
||||||
e.UpdateUserRatings(book);
|
e.UpdateUserRatings(book);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@ -80,7 +80,7 @@ namespace FileLiberator
|
|||||||
{
|
{
|
||||||
Task.Run(() => downloadCoverArt(libraryBook)),
|
Task.Run(() => downloadCoverArt(libraryBook)),
|
||||||
Task.Run(() => moveFilesToBooksDir(libraryBook, entries)),
|
Task.Run(() => moveFilesToBooksDir(libraryBook, entries)),
|
||||||
Task.Run(() => libraryBook.Book.UpdateBookStatus(LiberatedStatus.Liberated, Configuration.LibationVersion)),
|
Task.Run(() => libraryBook.UpdateBookStatus(LiberatedStatus.Liberated, Configuration.LibationVersion)),
|
||||||
Task.Run(() => WindowsDirectory.SetCoverAsFolderIcon(libraryBook.Book.PictureId, finalStorageDir))
|
Task.Run(() => WindowsDirectory.SetCoverAsFolderIcon(libraryBook.Book.PictureId, finalStorageDir))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ namespace FileLiberator
|
|||||||
var actualDownloadedFilePath = await downloadPdfAsync(libraryBook, proposedDownloadFilePath);
|
var actualDownloadedFilePath = await downloadPdfAsync(libraryBook, proposedDownloadFilePath);
|
||||||
var result = verifyDownload(actualDownloadedFilePath);
|
var result = verifyDownload(actualDownloadedFilePath);
|
||||||
|
|
||||||
libraryBook.Book.UpdatePdfStatus(result.IsSuccess ? LiberatedStatus.Liberated : LiberatedStatus.NotLiberated);
|
libraryBook.UpdatePdfStatus(result.IsSuccess ? LiberatedStatus.Liberated : LiberatedStatus.NotLiberated);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,7 +48,7 @@ namespace LibationAvalonia.Dialogs
|
|||||||
|
|
||||||
protected override void SaveAndClose()
|
protected override void SaveAndClose()
|
||||||
{
|
{
|
||||||
LibraryBook.Book.UpdateUserDefinedItem(NewTags, bookStatus: BookLiberatedStatus, pdfStatus: PdfLiberatedStatus);
|
LibraryBook.UpdateUserDefinedItem(NewTags, bookStatus: BookLiberatedStatus, pdfStatus: PdfLiberatedStatus);
|
||||||
base.SaveAndClose();
|
base.SaveAndClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -390,7 +390,7 @@ $@" Title: {libraryBook.Book.Title}
|
|||||||
|
|
||||||
if (dialogResult == SkipResult)
|
if (dialogResult == SkipResult)
|
||||||
{
|
{
|
||||||
libraryBook.Book.UpdateBookStatus(LiberatedStatus.Error);
|
libraryBook.UpdateBookStatus(LiberatedStatus.Error);
|
||||||
|
|
||||||
Logger.Info($"Error. Skip: [{libraryBook.Book.AudibleProductId}] {libraryBook.Book.Title}");
|
Logger.Info($"Error. Skip: [{libraryBook.Book.AudibleProductId}] {libraryBook.Book.Title}");
|
||||||
|
|
||||||
|
|||||||
@ -223,7 +223,7 @@ namespace LibationAvalonia.ViewModels
|
|||||||
else if (result == ProcessBookResult.FailedAbort)
|
else if (result == ProcessBookResult.FailedAbort)
|
||||||
Queue.ClearQueue();
|
Queue.ClearQueue();
|
||||||
else if (result == ProcessBookResult.FailedSkip)
|
else if (result == ProcessBookResult.FailedSkip)
|
||||||
nextBook.LibraryBook.Book.UpdateBookStatus(LiberatedStatus.Error);
|
nextBook.LibraryBook.UpdateBookStatus(LiberatedStatus.Error);
|
||||||
else if (result == ProcessBookResult.LicenseDeniedPossibleOutage && !shownServiceOutageMessage)
|
else if (result == ProcessBookResult.LicenseDeniedPossibleOutage && !shownServiceOutageMessage)
|
||||||
{
|
{
|
||||||
await MessageBox.Show(@$"
|
await MessageBox.Show(@$"
|
||||||
|
|||||||
@ -112,7 +112,7 @@ namespace LibationAvalonia.Views
|
|||||||
if (entry.Liberate.IsSeries)
|
if (entry.Liberate.IsSeries)
|
||||||
setDownloadMenuItem.Click += (_, __) => ((ISeriesEntry)entry).Children.Select(c => c.LibraryBook).UpdateBookStatus(LiberatedStatus.Liberated);
|
setDownloadMenuItem.Click += (_, __) => ((ISeriesEntry)entry).Children.Select(c => c.LibraryBook).UpdateBookStatus(LiberatedStatus.Liberated);
|
||||||
else
|
else
|
||||||
setDownloadMenuItem.Click += (_, __) => entry.Book.UpdateBookStatus(LiberatedStatus.Liberated);
|
setDownloadMenuItem.Click += (_, __) => entry.LibraryBook.UpdateBookStatus(LiberatedStatus.Liberated);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
#region Set Download status to Not Downloaded
|
#region Set Download status to Not Downloaded
|
||||||
@ -128,7 +128,7 @@ namespace LibationAvalonia.Views
|
|||||||
if (entry.Liberate.IsSeries)
|
if (entry.Liberate.IsSeries)
|
||||||
setNotDownloadMenuItem.Click += (_, __) => ((ISeriesEntry)entry).Children.Select(c => c.LibraryBook).UpdateBookStatus(LiberatedStatus.NotLiberated);
|
setNotDownloadMenuItem.Click += (_, __) => ((ISeriesEntry)entry).Children.Select(c => c.LibraryBook).UpdateBookStatus(LiberatedStatus.NotLiberated);
|
||||||
else
|
else
|
||||||
setNotDownloadMenuItem.Click += (_, __) => entry.Book.UpdateBookStatus(LiberatedStatus.NotLiberated);
|
setNotDownloadMenuItem.Click += (_, __) => entry.LibraryBook.UpdateBookStatus(LiberatedStatus.NotLiberated);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
#region Remove from library
|
#region Remove from library
|
||||||
|
|||||||
@ -1,21 +0,0 @@
|
|||||||
using DataLayer;
|
|
||||||
using System;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
|
|
||||||
namespace LibationSearchEngine;
|
|
||||||
|
|
||||||
public class BookRule : IIndexRule
|
|
||||||
{
|
|
||||||
public FieldType FieldType { get; }
|
|
||||||
public Func<Book, string> ValueGetter { get; }
|
|
||||||
public ReadOnlyCollection<string> FieldNames { get; }
|
|
||||||
|
|
||||||
public BookRule(FieldType fieldType, Func<Book, string> valueGetter, params string[] fieldNames)
|
|
||||||
{
|
|
||||||
ValueGetter = valueGetter;
|
|
||||||
FieldType = fieldType;
|
|
||||||
FieldNames = new ReadOnlyCollection<string>(fieldNames);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetValue(LibraryBook libraryBook) => ValueGetter(libraryBook.Book);
|
|
||||||
}
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
using DataLayer;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
|
|
||||||
namespace LibationSearchEngine;
|
|
||||||
|
|
||||||
public enum FieldType
|
|
||||||
{
|
|
||||||
Bool,
|
|
||||||
String,
|
|
||||||
Number,
|
|
||||||
ID,
|
|
||||||
Raw
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IIndexRule
|
|
||||||
{
|
|
||||||
/// <summary> This rule's value type. </summary>
|
|
||||||
FieldType FieldType { get; }
|
|
||||||
/// <summary> All aliases of this search index rule </summary>
|
|
||||||
ReadOnlyCollection<string> FieldNames { get; }
|
|
||||||
string GetValue(LibraryBook libraryBook);
|
|
||||||
}
|
|
||||||
42
Source/LibationSearchEngine/IndexRule.cs
Normal file
42
Source/LibationSearchEngine/IndexRule.cs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
using DataLayer;
|
||||||
|
using Dinah.Core;
|
||||||
|
using System;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace LibationSearchEngine;
|
||||||
|
|
||||||
|
public enum FieldType
|
||||||
|
{
|
||||||
|
Bool,
|
||||||
|
String,
|
||||||
|
Number,
|
||||||
|
ID,
|
||||||
|
Raw
|
||||||
|
}
|
||||||
|
|
||||||
|
public class IndexRule
|
||||||
|
{
|
||||||
|
public FieldType FieldType { get; }
|
||||||
|
public Func<LibraryBook, string> GetValue { get; }
|
||||||
|
public ReadOnlyCollection<string> FieldNames { get; }
|
||||||
|
|
||||||
|
public IndexRule(FieldType fieldType, Func<LibraryBook, string> valueGetter, params string[] fieldNames)
|
||||||
|
{
|
||||||
|
ArgumentValidator.EnsureNotNull(valueGetter, nameof(valueGetter));
|
||||||
|
ArgumentValidator.EnsureNotNull(fieldNames, nameof(fieldNames));
|
||||||
|
ArgumentValidator.EnsureGreaterThan(fieldNames.Length, $"{nameof(fieldNames)}.{nameof(fieldNames.Length)}", 0);
|
||||||
|
var fieldNamesValidated
|
||||||
|
= fieldNames
|
||||||
|
.Select((n, i) => ArgumentValidator.EnsureNotNullOrWhiteSpace(n, $"{nameof(fieldNames)}[{i}]")
|
||||||
|
.Trim());
|
||||||
|
|
||||||
|
GetValue = valueGetter;
|
||||||
|
FieldType = fieldType;
|
||||||
|
FieldNames = new ReadOnlyCollection<string>(fieldNamesValidated.ToList());
|
||||||
|
}
|
||||||
|
public override string ToString()
|
||||||
|
=> FieldNames.Count == 1
|
||||||
|
? $"{FieldNames.First()}"
|
||||||
|
: $"{FieldNames.First()} ({string.Join(", ", FieldNames.Skip(1))})";
|
||||||
|
}
|
||||||
@ -2,27 +2,26 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace LibationSearchEngine;
|
namespace LibationSearchEngine;
|
||||||
|
|
||||||
public class IndexRuleCollection : IEnumerable<IIndexRule>
|
[DebuggerDisplay("Count = {rules.Count,nq}")]
|
||||||
|
public class IndexRuleCollection : IEnumerable<IndexRule>
|
||||||
{
|
{
|
||||||
private readonly List<IIndexRule> rules = new();
|
private readonly List<IndexRule> rules = new();
|
||||||
public IEnumerable<string> IdFieldNames => rules.Where(x => x.FieldType is FieldType.ID).SelectMany(r => r.FieldNames);
|
public IEnumerable<string> IdFieldNames => rules.Where(x => x.FieldType is FieldType.ID).SelectMany(r => r.FieldNames);
|
||||||
public IEnumerable<string> BoolFieldNames => rules.Where(x => x.FieldType is FieldType.Bool).SelectMany(r => r.FieldNames);
|
public IEnumerable<string> BoolFieldNames => rules.Where(x => x.FieldType is FieldType.Bool).SelectMany(r => r.FieldNames);
|
||||||
public IEnumerable<string> StringFieldNames => rules.Where(x => x.FieldType is FieldType.String).SelectMany(r => r.FieldNames);
|
public IEnumerable<string> StringFieldNames => rules.Where(x => x.FieldType is FieldType.String).SelectMany(r => r.FieldNames);
|
||||||
public IEnumerable<string> NumberFieldNames => rules.Where(x => x.FieldType is FieldType.Number).SelectMany(r => r.FieldNames);
|
public IEnumerable<string> NumberFieldNames => rules.Where(x => x.FieldType is FieldType.Number).SelectMany(r => r.FieldNames);
|
||||||
|
|
||||||
public void Add(FieldType fieldType, Func<LibraryBook, string> getter, params string[] fieldNames)
|
public void Add(FieldType fieldType, Func<LibraryBook, string> getter, params string[] fieldNames)
|
||||||
=> rules.Add(new LibraryBookRule(fieldType, getter, fieldNames));
|
=> rules.Add(new IndexRule(fieldType, getter, fieldNames));
|
||||||
|
|
||||||
public void Add(FieldType fieldType, Func<Book, string> getter, params string[] fieldNames)
|
|
||||||
=> rules.Add(new BookRule(fieldType, getter, fieldNames));
|
|
||||||
|
|
||||||
public T GetRuleByFieldName<T>(string fieldName) where T : IIndexRule
|
public IndexRule GetRuleByFieldName(string fieldName)
|
||||||
=> (T)rules.SingleOrDefault(r => r.FieldNames.Any(n => n.Equals(fieldName, StringComparison.OrdinalIgnoreCase)));
|
=> rules.SingleOrDefault(r => r.FieldNames.Any(n => n.Equals(fieldName, StringComparison.OrdinalIgnoreCase)));
|
||||||
|
|
||||||
public IEnumerator<IIndexRule> GetEnumerator() => rules.GetEnumerator();
|
public IEnumerator<IndexRule> GetEnumerator() => rules.GetEnumerator();
|
||||||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,21 +0,0 @@
|
|||||||
using DataLayer;
|
|
||||||
using System;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
|
|
||||||
namespace LibationSearchEngine;
|
|
||||||
|
|
||||||
public class LibraryBookRule : IIndexRule
|
|
||||||
{
|
|
||||||
public FieldType FieldType { get; }
|
|
||||||
public Func<LibraryBook, string> ValueGetter { get; }
|
|
||||||
public ReadOnlyCollection<string> FieldNames { get; }
|
|
||||||
|
|
||||||
public LibraryBookRule(FieldType fieldType, Func<LibraryBook, string> valueGetter, params string[] fieldNames)
|
|
||||||
{
|
|
||||||
ValueGetter = valueGetter;
|
|
||||||
FieldType = fieldType;
|
|
||||||
FieldNames = new ReadOnlyCollection<string>(fieldNames);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetValue(LibraryBook libraryBook) => ValueGetter(libraryBook);
|
|
||||||
}
|
|
||||||
@ -17,7 +17,7 @@ namespace LibationSearchEngine
|
|||||||
document.Add(new Field(name.ToLowerInvariant(), value, Field.Store.YES, Field.Index.ANALYZED));
|
document.Add(new Field(name.ToLowerInvariant(), value, Field.Store.YES, Field.Index.ANALYZED));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void RemoveRule(this Document document, IIndexRule rule)
|
internal static void RemoveRule(this Document document, IndexRule rule)
|
||||||
{
|
{
|
||||||
// fields are key value pairs. MULTIPLE FIELDS CAN POTENTIALLY HAVE THE SAME KEY.
|
// fields are key value pairs. MULTIPLE FIELDS CAN POTENTIALLY HAVE THE SAME KEY.
|
||||||
// ie: must remove old before adding new else will create unwanted duplicates.
|
// ie: must remove old before adding new else will create unwanted duplicates.
|
||||||
@ -25,20 +25,9 @@ namespace LibationSearchEngine
|
|||||||
document.RemoveFields(name.ToLowerInvariant());
|
document.RemoveFields(name.ToLowerInvariant());
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void AddIndexRule(this Document document, IIndexRule rule, LibraryBook libraryBook)
|
internal static void AddIndexRule(this Document document, IndexRule rule, LibraryBook libraryBook)
|
||||||
{
|
{
|
||||||
string value = rule.GetValue(libraryBook);
|
string value = rule.GetValue(libraryBook);
|
||||||
|
|
||||||
addIndexRule(document, rule, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static void AddIndexRule(this Document document, BookRule rule, Book libraryBook)
|
|
||||||
{
|
|
||||||
addIndexRule(document, rule, rule.ValueGetter(libraryBook));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void addIndexRule(Document document, IIndexRule rule, string value)
|
|
||||||
{
|
|
||||||
if (value is null) return;
|
if (value is null) return;
|
||||||
|
|
||||||
foreach (var name in rule.FieldNames)
|
foreach (var name in rule.FieldNames)
|
||||||
|
|||||||
@ -33,34 +33,34 @@ namespace LibationSearchEngine
|
|||||||
// use these common fields in the "all" default search field
|
// use these common fields in the "all" default search field
|
||||||
public static IndexRuleCollection FieldIndexRules { get; } = new IndexRuleCollection
|
public static IndexRuleCollection FieldIndexRules { get; } = new IndexRuleCollection
|
||||||
{
|
{
|
||||||
{ FieldType.ID, Book => Book.AudibleProductId.ToLowerInvariant(), nameof(Book.AudibleProductId), "ProductId", "Id", "ASIN" },
|
{ FieldType.ID, lb => lb.Book.AudibleProductId.ToLowerInvariant(), nameof(Book.AudibleProductId), "ProductId", "Id", "ASIN" },
|
||||||
{ FieldType.Raw, Book => Book.AudibleProductId, _ID_ },
|
{ FieldType.Raw, lb => lb.Book.AudibleProductId, _ID_ },
|
||||||
{ FieldType.String, Book => Book.Title, nameof(Book.Title), "ProductId", "Id", "ASIN" },
|
{ FieldType.String, lb => lb.Book.Title, nameof(Book.Title), "ProductId", "Id", "ASIN" },
|
||||||
{ FieldType.String, Book => Book.AuthorNames(), "AuthorNames", "Author", "Authors" },
|
{ FieldType.String, lb => lb.Book.AuthorNames(), "AuthorNames", "Author", "Authors" },
|
||||||
{ FieldType.String, Book => Book.NarratorNames(), "NarratorNames", "Narrator", "Narrators" },
|
{ FieldType.String, lb => lb.Book.NarratorNames(), "NarratorNames", "Narrator", "Narrators" },
|
||||||
{ FieldType.String, Book => Book.Publisher, nameof(Book.Publisher) },
|
{ FieldType.String, lb => lb.Book.Publisher, nameof(Book.Publisher) },
|
||||||
{ FieldType.String, Book => Book.SeriesNames(), "SeriesNames", "Narrator", "Series" },
|
{ FieldType.String, lb => lb.Book.SeriesNames(), "SeriesNames", "Narrator", "Series" },
|
||||||
{ FieldType.String, Book => string.Join(", ", Book.SeriesLink.Select(s => s.Series.AudibleSeriesId)), "SeriesId" },
|
{ FieldType.String, lb => string.Join(", ", lb.Book.SeriesLink.Select(s => s.Series.AudibleSeriesId)), "SeriesId" },
|
||||||
{ FieldType.String, Book => Book.CategoriesIds() is null ? null : string.Join(", ", Book.CategoriesIds()), nameof(Book.Category), "Categories", "CategoriesId", "CategoryId", "CategoriesNames" },
|
{ FieldType.String, lb => lb.Book.CategoriesIds() is null ? null : string.Join(", ", lb.Book.CategoriesIds()), nameof(Book.Category), "Categories", "CategoriesId", "CategoryId", "CategoriesNames" },
|
||||||
{ FieldType.String, Book => Book.UserDefinedItem.Tags, TAGS.FirstCharToUpper() },
|
{ FieldType.String, lb => lb.Book.UserDefinedItem.Tags, TAGS.FirstCharToUpper() },
|
||||||
{ FieldType.String, Book => Book.Locale, "Locale", "Region" },
|
{ FieldType.String, lb => lb.Book.Locale, "Locale", "Region" },
|
||||||
{ FieldType.String, lb => lb.Account, "Account", "Email" },
|
{ FieldType.String, lb => lb.Account, "Account", "Email" },
|
||||||
{ FieldType.Bool, Book => Book.HasPdf().ToString(), "HasDownloads", "HasDownload", "Downloads" , "Download", "HasPDFs", "HasPDF" , "PDFs", "PDF" },
|
{ FieldType.Bool, lb => lb.Book.HasPdf().ToString(), "HasDownloads", "HasDownload", "Downloads" , "Download", "HasPDFs", "HasPDF" , "PDFs", "PDF" },
|
||||||
{ FieldType.Bool, Book => (Book.UserDefinedItem.Rating.OverallRating > 0f).ToString(), "IsRated", "Rated" },
|
{ FieldType.Bool, lb => (lb.Book.UserDefinedItem.Rating.OverallRating > 0f).ToString(), "IsRated", "Rated" },
|
||||||
{ FieldType.Bool, Book => isAuthorNarrated(Book).ToString(), "IsAuthorNarrated", "AuthorNarrated" },
|
{ FieldType.Bool, lb => isAuthorNarrated(lb.Book).ToString(), "IsAuthorNarrated", "AuthorNarrated" },
|
||||||
{ FieldType.Bool, Book => Book.IsAbridged.ToString(), nameof(Book.IsAbridged), "Abridged" },
|
{ FieldType.Bool, lb => lb.Book.IsAbridged.ToString(), nameof(Book.IsAbridged), "Abridged" },
|
||||||
{ FieldType.Bool, Book => (Book.UserDefinedItem.BookStatus == LiberatedStatus.Liberated).ToString(), "IsLiberated", "Liberated" },
|
{ FieldType.Bool, lb => (lb.Book.UserDefinedItem.BookStatus == LiberatedStatus.Liberated).ToString(), "IsLiberated", "Liberated" },
|
||||||
{ FieldType.Bool, Book => (Book.UserDefinedItem.BookStatus == LiberatedStatus.Error).ToString(), "LiberatedError" },
|
{ FieldType.Bool, lb => (lb.Book.UserDefinedItem.BookStatus == LiberatedStatus.Error).ToString(), "LiberatedError" },
|
||||||
{ FieldType.Bool, Book => Book.IsEpisodeChild().ToString(), "Podcast", "Podcasts", "IsPodcast", "Episode", "Episodes", "IsEpisode" },
|
{ FieldType.Bool, lb => lb.Book.IsEpisodeChild().ToString(), "Podcast", "Podcasts", "IsPodcast", "Episode", "Episodes", "IsEpisode" },
|
||||||
{ FieldType.Bool, lb => lb.AbsentFromLastScan.ToString(), "AbsentFromLastScan", "Absent" },
|
{ FieldType.Bool, lb => lb.AbsentFromLastScan.ToString(), "AbsentFromLastScan", "Absent" },
|
||||||
// all numbers are padded to 8 char.s
|
// all numbers are padded to 8 char.s
|
||||||
// This will allow a single method to auto-pad numbers. The method will match these as well as date: yyyymmdd
|
// This will allow a single method to auto-pad numbers. The method will match these as well as date: yyyymmdd
|
||||||
{ FieldType.Number, Book => Book.LengthInMinutes.ToLuceneString(), nameof(Book.LengthInMinutes), "Length", "Minutes" },
|
{ FieldType.Number, lb => lb.Book.LengthInMinutes.ToLuceneString(), nameof(Book.LengthInMinutes), "Length", "Minutes" },
|
||||||
{ FieldType.Number, Book => (Book.LengthInMinutes / 60).ToLuceneString(), "Hours" },
|
{ FieldType.Number, lb => (lb.Book.LengthInMinutes / 60).ToLuceneString(), "Hours" },
|
||||||
{ FieldType.Number, Book => Book.Rating.OverallRating.ToLuceneString(), "ProductRating", "Rating" },
|
{ FieldType.Number, lb => lb.Book.Rating.OverallRating.ToLuceneString(), "ProductRating", "Rating" },
|
||||||
{ FieldType.Number, Book => Book.UserDefinedItem.Rating.OverallRating.ToLuceneString(), "UserRating", "MyRating" },
|
{ FieldType.Number, lb => lb.Book.UserDefinedItem.Rating.OverallRating.ToLuceneString(), "UserRating", "MyRating" },
|
||||||
{ FieldType.Number, Book => Book.DatePublished?.ToLuceneString() ?? "", nameof(Book.DatePublished) },
|
{ FieldType.Number, lb => lb.Book.DatePublished?.ToLuceneString() ?? "", nameof(Book.DatePublished) },
|
||||||
{ FieldType.Number, Book => Book.UserDefinedItem.LastDownloaded.ToLuceneString(), nameof(UserDefinedItem.LastDownloaded), "LastDownload" },
|
{ FieldType.Number, lb => lb.Book.UserDefinedItem.LastDownloaded.ToLuceneString(), nameof(UserDefinedItem.LastDownloaded), "LastDownload" },
|
||||||
{ FieldType.Number, lb => lb.DateAdded.ToLuceneString(), nameof(LibraryBook.DateAdded) }
|
{ FieldType.Number, lb => lb.DateAdded.ToLuceneString(), nameof(LibraryBook.DateAdded) }
|
||||||
};
|
};
|
||||||
#endregion
|
#endregion
|
||||||
@ -132,14 +132,14 @@ namespace LibationSearchEngine
|
|||||||
});
|
});
|
||||||
|
|
||||||
// update single document entry
|
// update single document entry
|
||||||
public void UpdateLiberatedStatus(Book book)
|
public void UpdateLiberatedStatus(LibraryBook book)
|
||||||
=> updateDocument(
|
=> updateDocument(
|
||||||
book.AudibleProductId,
|
book.Book.AudibleProductId,
|
||||||
d =>
|
d =>
|
||||||
{
|
{
|
||||||
var lib = FieldIndexRules.GetRuleByFieldName<BookRule>("IsLiberated");
|
var lib = FieldIndexRules.GetRuleByFieldName("IsLiberated");
|
||||||
var libError = FieldIndexRules.GetRuleByFieldName<BookRule>("LiberatedError");
|
var libError = FieldIndexRules.GetRuleByFieldName("LiberatedError");
|
||||||
var lastDl = FieldIndexRules.GetRuleByFieldName<BookRule>(nameof(UserDefinedItem.LastDownloaded));
|
var lastDl = FieldIndexRules.GetRuleByFieldName(nameof(UserDefinedItem.LastDownloaded));
|
||||||
|
|
||||||
d.RemoveRule(lib);
|
d.RemoveRule(lib);
|
||||||
d.RemoveRule(libError);
|
d.RemoveRule(libError);
|
||||||
@ -150,12 +150,12 @@ namespace LibationSearchEngine
|
|||||||
d.AddIndexRule(lastDl, book);
|
d.AddIndexRule(lastDl, book);
|
||||||
});
|
});
|
||||||
|
|
||||||
public void UpdateUserRatings(Book book)
|
public void UpdateUserRatings(LibraryBook book)
|
||||||
=>updateDocument(
|
=>updateDocument(
|
||||||
book.AudibleProductId,
|
book.Book.AudibleProductId,
|
||||||
d =>
|
d =>
|
||||||
{
|
{
|
||||||
var rating = FieldIndexRules.GetRuleByFieldName<BookRule>("UserRating");
|
var rating = FieldIndexRules.GetRuleByFieldName("UserRating");
|
||||||
|
|
||||||
d.RemoveRule(rating);
|
d.RemoveRule(rating);
|
||||||
d.AddIndexRule(rating, book);
|
d.AddIndexRule(rating, book);
|
||||||
|
|||||||
@ -88,7 +88,7 @@ namespace LibationUiBase.GridView
|
|||||||
var api = await LibraryBook.GetApiAsync();
|
var api = await LibraryBook.GetApiAsync();
|
||||||
|
|
||||||
if (await api.ReviewAsync(Book.AudibleProductId, (int)rating.OverallRating, (int)rating.PerformanceRating, (int)rating.StoryRating))
|
if (await api.ReviewAsync(Book.AudibleProductId, (int)rating.OverallRating, (int)rating.PerformanceRating, (int)rating.StoryRating))
|
||||||
LibraryBook.Book.UpdateUserDefinedItem(Book.UserDefinedItem.Tags, Book.UserDefinedItem.BookStatus, Book.UserDefinedItem.PdfStatus, rating);
|
LibraryBook.UpdateUserDefinedItem(Book.UserDefinedItem.Tags, Book.UserDefinedItem.BookStatus, Book.UserDefinedItem.PdfStatus, rating);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -93,7 +93,7 @@ namespace LibationWinForms.GridView
|
|||||||
{
|
{
|
||||||
var bookDetailsForm = new BookDetailsDialog(liveGridEntry.LibraryBook);
|
var bookDetailsForm = new BookDetailsDialog(liveGridEntry.LibraryBook);
|
||||||
if (bookDetailsForm.ShowDialog() == DialogResult.OK)
|
if (bookDetailsForm.ShowDialog() == DialogResult.OK)
|
||||||
liveGridEntry.Book.UpdateUserDefinedItem(bookDetailsForm.NewTags, bookDetailsForm.BookLiberatedStatus, bookDetailsForm.PdfLiberatedStatus);
|
liveGridEntry.LibraryBook.UpdateUserDefinedItem(bookDetailsForm.NewTags, bookDetailsForm.BookLiberatedStatus, bookDetailsForm.PdfLiberatedStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -131,7 +131,7 @@ namespace LibationWinForms.GridView
|
|||||||
if (entry.Liberate.IsSeries)
|
if (entry.Liberate.IsSeries)
|
||||||
setDownloadMenuItem.Click += (_, _) => ((ISeriesEntry)entry).Children.Select(c => c.LibraryBook).UpdateBookStatus(LiberatedStatus.Liberated);
|
setDownloadMenuItem.Click += (_, _) => ((ISeriesEntry)entry).Children.Select(c => c.LibraryBook).UpdateBookStatus(LiberatedStatus.Liberated);
|
||||||
else
|
else
|
||||||
setDownloadMenuItem.Click += (_, _) => entry.Book.UpdateBookStatus(LiberatedStatus.Liberated);
|
setDownloadMenuItem.Click += (_, _) => entry.LibraryBook.UpdateBookStatus(LiberatedStatus.Liberated);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
#region Set Download status to Not Downloaded
|
#region Set Download status to Not Downloaded
|
||||||
@ -147,7 +147,7 @@ namespace LibationWinForms.GridView
|
|||||||
if (entry.Liberate.IsSeries)
|
if (entry.Liberate.IsSeries)
|
||||||
setNotDownloadMenuItem.Click += (_, _) => ((ISeriesEntry)entry).Children.Select(c => c.LibraryBook).UpdateBookStatus(LiberatedStatus.NotLiberated);
|
setNotDownloadMenuItem.Click += (_, _) => ((ISeriesEntry)entry).Children.Select(c => c.LibraryBook).UpdateBookStatus(LiberatedStatus.NotLiberated);
|
||||||
else
|
else
|
||||||
setNotDownloadMenuItem.Click += (_, _) => entry.Book.UpdateBookStatus(LiberatedStatus.NotLiberated);
|
setNotDownloadMenuItem.Click += (_, _) => entry.LibraryBook.UpdateBookStatus(LiberatedStatus.NotLiberated);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
#region Remove from library
|
#region Remove from library
|
||||||
|
|||||||
@ -377,7 +377,7 @@ $@" Title: {libraryBook.Book.Title}
|
|||||||
|
|
||||||
if (dialogResult == SkipResult)
|
if (dialogResult == SkipResult)
|
||||||
{
|
{
|
||||||
libraryBook.Book.UpdateBookStatus(LiberatedStatus.Error);
|
libraryBook.UpdateBookStatus(LiberatedStatus.Error);
|
||||||
|
|
||||||
Logger.Info($"Error. Skip: [{libraryBook.Book.AudibleProductId}] {libraryBook.Book.Title}");
|
Logger.Info($"Error. Skip: [{libraryBook.Book.AudibleProductId}] {libraryBook.Book.Title}");
|
||||||
|
|
||||||
|
|||||||
@ -184,7 +184,7 @@ namespace LibationWinForms.ProcessQueue
|
|||||||
else if (result == ProcessBookResult.FailedAbort)
|
else if (result == ProcessBookResult.FailedAbort)
|
||||||
Queue.ClearQueue();
|
Queue.ClearQueue();
|
||||||
else if (result == ProcessBookResult.FailedSkip)
|
else if (result == ProcessBookResult.FailedSkip)
|
||||||
nextBook.LibraryBook.Book.UpdateBookStatus(DataLayer.LiberatedStatus.Error);
|
nextBook.LibraryBook.UpdateBookStatus(DataLayer.LiberatedStatus.Error);
|
||||||
else if (result == ProcessBookResult.LicenseDeniedPossibleOutage && !shownServiceOutageMessage)
|
else if (result == ProcessBookResult.LicenseDeniedPossibleOutage && !shownServiceOutageMessage)
|
||||||
{
|
{
|
||||||
MessageBox.Show(@$"
|
MessageBox.Show(@$"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user