mirror of
https://github.com/rmcrackan/Libation.git
synced 2026-09-12 21:57:19 -04:00
Reported in issue #1973: a scheduled liberate run re-requested a content license for the same 59 titles every 15 minutes, 1397 refused requests in six hours, because nothing about a failed PDF was remembered and the PDF step asked Audible afresh every time. The two download paths have been converging for a while - a PDF is now named and placed by the audiobook path's own logic, and verified like one - and every part of this bug lives where that stopped short. Both steps ask Audible for the same license. The request asks for pdf_url alongside the content reference, and LicenseInfo dropped it, so DownloadPdf turned round and requested an identical license to read the field the first response had already returned. Carry PdfUrl on LicenseInfo and give both steps one ILicensedDownload contract: a license may be supplied to a step, and the one a step ended up using is published for the next step for the same title. The CLI and the GUI queue hand it on, so a title costs one license request per run however many steps want something from it. A carried license is retried once with a fresh one if it does not work, since Audible's links are signed and a long decrypt can run between the two steps. Where the audiobook step obtained no license there is nothing to hand on and the supplement step does not run, which deletes a bug rather than guarding it: Completed fires from a finally, so a refused audio download was followed at once by a PDF request that reproduced the refusal. Error now means the same for a PDF as for a book. The audiobook step has always skipped LiberatedStatus.Error through AudioExists, and NeedsPdfDownload agrees, but DownloadPdf selected on PdfExists and so retried an errored PDF forever. A license that is granted and carries no pdf_url - the 'No PDF URL available' in the report - is Audible saying the title has no PDF, and is written off that same way instead of failing identically on every run. It stays resettable by everything that resets a book: --force, a named title, Set PDF Not Downloaded. Refusals now reach ProcessSingleAsync, which has always recorded them for whichever step throws one; DownloadPdf swallowed everything and recorded nothing. It keeps swallowing what the classifier does not recognise, which is what stopped a missing PDF from taking the app down with it. A bulk CLI run leaves alone the titles the last scan did not find, by the same Downloadable rule every multi-title path in the app already uses, and the PDF back-fill pass waits on a refused title just as the first pass does. --force and a named title still attempt everything. Co-authored-by: rmcrackan <rmcrackan@gmail.com>
26 lines
1.2 KiB
C#
26 lines
1.2 KiB
C#
namespace FileLiberator;
|
|
|
|
/// <summary>
|
|
/// A step that downloads something Audible delivers through a content license: the audiobook, and the
|
|
/// supplement whose link the same license carries.
|
|
/// <para>
|
|
/// One license serves every such step for a title. The request is identical - <c>response_groups</c> asks for
|
|
/// <c>pdf_url</c> alongside the content reference - so a run holding a license must hand it on rather than ask
|
|
/// for another, which would be a second refusal to record for a title already refused once.
|
|
/// </para>
|
|
/// </summary>
|
|
public interface ILicensedDownload
|
|
{
|
|
/// <summary>
|
|
/// Optional override to supply license info directly instead of querying the api based on Configuration options
|
|
/// </summary>
|
|
DownloadOptions.LicenseInfo? LicenseInfo { get; set; }
|
|
|
|
/// <summary>
|
|
/// The license this step ended up using, whether supplied or requested, so the next step for the same title
|
|
/// can reuse it. Null until a license has been obtained, and reset at the start of every attempt: a
|
|
/// Processable instance is reused across books, so a license left behind belongs to a different title.
|
|
/// </summary>
|
|
DownloadOptions.LicenseInfo? ObtainedLicense { get; }
|
|
}
|