mirror of
https://github.com/Leseratte10/acsm-calibre-plugin.git
synced 2024-12-23 01:34:36 +06:00
Fix misidentification as passHash book
This commit is contained in:
parent
9346b888d3
commit
2779334e4a
@ -649,27 +649,27 @@ def performFulfillmentNotification(fulfillmentResultToken, forceOptional = False
|
|||||||
# "Normal" Adobe fulfillment
|
# "Normal" Adobe fulfillment
|
||||||
user = fulfillmentResultToken.find("./%s/%s/%s/%s" % (adNS("fulfillmentResult"), adNS("resourceItemInfo"), adNS("licenseToken"), adNS("user"))).text
|
user = fulfillmentResultToken.find("./%s/%s/%s/%s" % (adNS("fulfillmentResult"), adNS("resourceItemInfo"), adNS("licenseToken"), adNS("user"))).text
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# B&N Adobe PassHash fulfillment
|
# B&N Adobe PassHash fulfillment. Doesn't use notifications usually ...
|
||||||
user = body.find("./%s" % (adNS("user"))).text
|
#user = body.find("./%s" % (adNS("user"))).text
|
||||||
|
print("Skipping notify due to passHash?")
|
||||||
|
print("If this is not a passHash book pls open a bug report.")
|
||||||
|
continue
|
||||||
|
|
||||||
if (device is None):
|
if (device is None):
|
||||||
try:
|
try:
|
||||||
# "Normal" Adobe fulfillment
|
# "Normal" Adobe fulfillment
|
||||||
device = fulfillmentResultToken.find("./%s/%s/%s/%s" % (adNS("fulfillmentResult"), adNS("resourceItemInfo"), adNS("licenseToken"), adNS("device"))).text
|
device = fulfillmentResultToken.find("./%s/%s/%s/%s" % (adNS("fulfillmentResult"), adNS("resourceItemInfo"), adNS("licenseToken"), adNS("device"))).text
|
||||||
except:
|
except:
|
||||||
# B&N Adobe PassHash fulfillment without device ID.
|
print("Missing deviceID for loan metadata ... why?")
|
||||||
# PassHash books aren't linked to a particular device, so there's no ID to send to Adobe.
|
# I have no idea if this behaviour is correct, need to do more testing on loaned books without deviceID
|
||||||
# If I understand Adobe's documentation correctly, PassHash books do not support notifications
|
|
||||||
# and are not supposed to contain notify tags, so lets just skip if that's the case.
|
|
||||||
print("Skipping notify due to passHash")
|
|
||||||
continue
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
full_text = "<adept:notification xmlns:adept=\"http://ns.adobe.com/adept\">"
|
full_text = "<adept:notification xmlns:adept=\"http://ns.adobe.com/adept\">"
|
||||||
full_text += "<adept:user>%s</adept:user>" % user
|
full_text += "<adept:user>%s</adept:user>" % user
|
||||||
full_text += "<adept:device>%s</adept:device>" % device
|
|
||||||
|
if device is not None:
|
||||||
|
full_text += "<adept:device>%s</adept:device>" % device
|
||||||
|
|
||||||
|
|
||||||
# ADE 4.0 apparently changed the order of these two elements.
|
# ADE 4.0 apparently changed the order of these two elements.
|
||||||
@ -751,6 +751,11 @@ def performFulfillmentNotification(fulfillmentResultToken, forceOptional = False
|
|||||||
errmsg_crit += "ERROR\n" + url + "\n" + msg + "\n\n"
|
errmsg_crit += "ERROR\n" + url + "\n" + msg + "\n\n"
|
||||||
|
|
||||||
|
|
||||||
|
if device is None and errmsg_crit != "":
|
||||||
|
errmsg_crit = ""
|
||||||
|
print("Skipping critical notification failure due to weird book.")
|
||||||
|
|
||||||
|
|
||||||
if errmsg_crit == "":
|
if errmsg_crit == "":
|
||||||
return True, ""
|
return True, ""
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user