From 396f0cfad09661abe6e426c7a04433f82e55384f Mon Sep 17 00:00:00 2001 From: Florian Bach Date: Sat, 3 Sep 2022 19:06:46 +0200 Subject: [PATCH] Add debugging and readme note for LoanReturn on ACS6 servers --- README.md | 4 ++++ calibre-plugin/libadobeFulfill.py | 28 +++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c6eb945..396d42d 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,10 @@ See the "LICENSE" file for a full copy of the GNU GPL v3. +## Known bugs + +- Returning an eBook to a library running Adobe Content Server 6 (ACS6) or newer will fail. The plugin will claim the book return was successful, but the book won't be marked as returned on the libraries' servers. This will hopefully be fixed with the next version of the plugin - I already dumped a bunch of logs from ADE so I know what my plugin is missing, now I just need to implement the fix and see if it works. It might be a good idea to stop returning books with the current version of the plugin, as that'd be a difference that the libraries could detect as doing something weird, if they're using ACS6. + ## Setup Download the plugin and import it into Calibre, then open the plugin settings. The plugin should display "Not authorized for any ADE ID". You now have multiple options to authorize the plugin: diff --git a/calibre-plugin/libadobeFulfill.py b/calibre-plugin/libadobeFulfill.py index 14d69f2..58462cd 100644 --- a/calibre-plugin/libadobeFulfill.py +++ b/calibre-plugin/libadobeFulfill.py @@ -567,6 +567,17 @@ def updateLoanReturnData(fulfillmentResultToken): def tryReturnBook(bookData): + + + verbose_logging = False + try: + import calibre_plugins.deacsm.prefs as prefs + deacsmprefs = prefs.DeACSM_Prefs() + verbose_logging = deacsmprefs["detailed_logging"] + except: + pass + + try: user = bookData["user"] loanID = bookData["loanID"] @@ -600,7 +611,8 @@ def tryReturnBook(bookData): print("Would notify server %s:" % (operatorURL + "/LoanReturn")) doc_send = "\n" + etree.tostring(full_text_xml, encoding="utf-8", pretty_print=True, xml_declaration=False).decode("utf-8") - # print(doc_send) + if verbose_logging: + print(doc_send) retval = sendRequestDocu(doc_send, operatorURL + "/LoanReturn").decode("utf-8") @@ -610,6 +622,8 @@ def tryReturnBook(bookData): return False, retval elif "