Leseratte10 / acsm-calibre-plugin

Calibre plugin for ACSM->EPUB and ACSM->PDF conversion.
https://www.mobileread.com/forums/showthread.php?t=341975
GNU General Public License v3.0
600 stars 23 forks source link

Doesn't work with ACSM files from Google Play Books #11

Closed tclimis closed 2 years ago

tclimis commented 2 years ago

Bug description

This is probably more of a feature request than a bug, but it appears that the acsm files from Google Play Books are a different format, which causes the following error when trying to open them:

Traceback (most recent call last):
  File "/usr/lib64/calibre/calibre/customize/ui.py", line 175, in _run_filetype_plugins
    nfp = plugin.run(nfp) or nfp
  File "calibre_plugins.deacsm.__init__", line 324, in run
    success, replyData = fulfill(path_to_ebook, deacsmprefs["notify_fulfillment"])
  File "calibre_plugins.deacsm.libadobeFulfill", line 322, in fulfill
    mimetype = acsmxml.find("./%s/%s/%s" % (adNS("resourceItemInfo"), adNS("metadata"), dcNS("format"))).text
AttributeError: 'NoneType' object has no attribute 'text'

The issue is that these ascm files do not have the <metadata> tag at all. <resourceItemInfo> instead looks like this:

<resourceItemInfo>
        <resource>urn:uuid:bc30db2e-38bf-5956-2221-bdf7e1e7e0f5</resource>
        <resourceItem>1</resourceItem>
        <src>https://books.google.com/books/download/Mockingjay_Hunger_Games_Book_Three.epub?acsid=urn:uuid:bc30db2e-38bf-5956-2221-bdf7e1e7e0f5&amp;output=acs4_book_bytes&amp;ar=4ad7a2b478964a50ec5e0f567678ecfe</src>
        <downloadType>simple</downloadType>
    </resourceItemInfo>

Operating system

Linux

Which version of Calibre are you running?

5.33

Which version of the DeACSM plugin are you running?

v0.0.14

Further information

No response

Leseratte10 commented 2 years ago

Any non-working ACSM file is a bug, as this plugin is supposed to work with all of them. Thanks for the report, the bugfix f9fbc4172a5d44f95ffd50b0f105f351b91ea8d7 will be included in the next release.

Leseratte10 commented 2 years ago

I've just included this bugfix in the v0.0.15 release.