View Single Post
Old 09-25-2021, 10:44 AM   #1
Leseratte_10
Groupie
Leseratte_10 ought to be getting tired of karma fortunes by now.Leseratte_10 ought to be getting tired of karma fortunes by now.Leseratte_10 ought to be getting tired of karma fortunes by now.Leseratte_10 ought to be getting tired of karma fortunes by now.Leseratte_10 ought to be getting tired of karma fortunes by now.Leseratte_10 ought to be getting tired of karma fortunes by now.Leseratte_10 ought to be getting tired of karma fortunes by now.Leseratte_10 ought to be getting tired of karma fortunes by now.Leseratte_10 ought to be getting tired of karma fortunes by now.Leseratte_10 ought to be getting tired of karma fortunes by now.Leseratte_10 ought to be getting tired of karma fortunes by now.
 
Posts: 181
Karma: 2010542
Join Date: Sep 2021
Device: PB Era, PB InkPad 3 Pro
[FileType Plugin] ACSM Input

ACSM import support for Calibre

This plugin is a replacement for Adobe Digital Editions (ADE) which allows you to turn an ACSM file into an EPUB or PDF just like ADE would.

A couple months ago, Grégory Soutadé created an open-source ADE replacement library (libgourou) in C++ which can be used to "convert" ACSM files into EPUB or PDF files - see the thread https://www.mobileread.com/forums/sh...d.php?t=340479

A couple days ago, I noticed that library and started to look at how that worked. First I only managed to make a small Calibre plugin that just executes his library / binary, so the first version was Linux-only, but then I was able to completely reimplement the libgourou library in native Python as a Calibre plugin.

This means, that Windows, Linux, and Mac users can just add this FileType plugin to Calibre, enter their AdobeID credentials in the plugin settings, and then just drag-and-drop an ACSM file into Calibre and it'll turn into an EPUB or PDF.

The source code, if you want to take a look, can be found here: https://github.com/Leseratte10/acsm-calibre-plugin

Couple important notes:
  • I would suggest creating a new dummy AdobeID to use for Calibre so just in case Adobe detects this and bans you, you don't lose your main AdobeID.
  • I recommend using noDRM's DeDRM fork together with this plugin. Using the old versions from Apprentice Harper can cause various issues
  • This software is not approved by Adobe. I am not responsible if Adobe detects that you're using nonstandard software and bans your account. Do not complain to me if Adobe bans your main ADE account - you have been warned. So far, none of my test accounts have been banned, but you never know ...

How to setup:

Download the plugin from this post (or from the Calibre Plugin list) and import it into Calibre, then open the plugin settings.

You now have four different ways to authorize / activate the plugin:
  • You can click on "Link to ADE account" and enter your AdobeID credentials. This will use up one of your available activations.
  • If you have ADE installed and activated, you can click "Import activation from ADE" to import the activation from Adobe Digital Editions.
  • You can click on "Create anonymous authorization" to authorize the plugin without an AdobeID. Make sure to create backups if you do this.
  • You can import an authorization backup ZIP file by clicking on "Import existing activation backup" if you have a backup from a different machine or from a previous install.

Once you activated the plugin using one of the four methods, click "Export account activation data" and save the data somewhere. Make enough backups of this, if you have an anonymous authorization you'll need this to restore the data if you reinstall your OS or move to another computer. If you are using an AdobeID, you can use this data to restore the activation without using another one of your available authorizations.

Now download an ACSM file from Adobe's test library ( https://www.adobe.com/de/solutions/e...k-library.html ) and see if you can import it into Calibre and if it turns into a readable EPUB or PDF file.


Version History:

Spoiler:

Version 0.0.16 - 31 Jul 2022
- Add support for Calibre 4.X / Python 2
- Add support for Calibre 6.X / QT 6
- Include custom fork of oscrypto until my PR is merged; this fixes Linux distributions with OpenSSL 3 like Ubuntu 22.04 and Fedora 36.
- Allow authorizing an eReader through USB (experimental) by clicking on the "Authorize eReader over USB" button in the plugin settings
- Ignore fatal HTTP errors and/or missing or broken servers during fulfillment notifications marked as optional
- Drop dependencies python-cryptography, python-rsa and python-pyasn1
- Change the way the WINE executables for Linux are included to prevent false alarms from Antivirus software
- Fix broken notification URLs where no protocol is included (assuming "http")
- Fix loan data for book loans without deviceID
- Fix nonce calculations (yet again)
- Merge #26 to make importing an existing authorization through WINE more reliable

Version 0.0.15 - 15 Dec 2021
- Add support for creating anonymous authorizations. Just click "Create anonymous authorization" instead of "Link to ADE account".
- Add support for AdobeID providers other than Adobe.
- Bugfix for ACSM files from Google Play Books (ACSM files without metadata node).
- Allow linking an anonymous authorization to a new, unused AdobeID account (by clicking the "Connect anonymous auth to ADE account" button).
- Update dependency python-cryptography from 3.4.8 to 36.0.1
- Update dependency python-rsa from 4.7.2 to 4.8

Version 0.0.14 - 11 Dec 2021
- Allow choosing between different ADE versions (2.0.1, 3.0.1, 4.0.3, 4.5.11) when linking an ADE account. 2.0.1 is recommended (and selected by default).
- Allow switching between ADE versions in the plugin settings (same versions as above, plus 1.7.2). 1.7.2 support is experimental, only use if necessary. It's recommended to just stay at 2.0.1.
- If you don't have your AdobeID connected yet (and you have ADE installed on your machine), there's a new button "Import activation from ADE" - this will copy the existing activation from ADE into the plugin without using up one of the 6 activations.
- Fix a race condition bug when importing multiple ACSM files at the same time.
- Fix a bug where authorization would fail with non-ASCII characters in the OS username.
- Pressing Ctrl+Shift+D in the plugin settings removes the existing authorization (like in ADE).
- Add a setting (disabled by default) for verbose debug logs. This can result in sensitive data like keys or book credentials to be included in the logfile.
- Add a setting (disabled by default) to auto-delete the ACSM file after successful import.
- Add a proper error message for ACSMs using a download type other than "simple". If you see that message, please open a bug report.

Version 0.0.13 - November 2021
Various different beta versions released in November 2021. There's no final version of v0.0.13.

Version 0.0.12 - 15 Nov 2021
- Fixes a bug that caused the plugin to not show up in the Calibre Plugin index. You can now download and update this Plugin directly from Calibre.

Version 0.0.11 - 12 Nov 2021
- Ignore SSL errors during FulfillmentNotification. This fixes distributors that have a broken SSL setup on their servers.
- Update & improve the Adobe signature hashing algorithm. Fixes some edge cases that probably don't affect any actual book anyways ...
- Small (potential) bugfix for distributors using the PassHash system (e. g. Barnes & Noble)
- Activation key exports now include the user ID in the (default) filename.
- Fixes a bug where other EPUB- and PDF-capable FileTypePlugins wouldn't run on files created by this plugin.

Version 0.0.10 - 23 Oct 2021
- Due to a stupid bug with the Adobe nonce calculation the plugin stopped working a couple days ago. You will probably receive the error message "int too big to convert" with v0.0.9 and earlier. If so, please update to v0.0.10.
- Try to use Cryptodomex if Crypto is not available. This fixes the error "local variable 'update_account_path' referenced before assignment" on some Linux distributions.

Version 0.0.9 - 4 Oct 2021
- Add support for the Adobe record "FulfillmentNotification". This lets the Adobe server (and the book distributor server) know you've successfully downloaded a book. This is not strictly required to fulfill a book, but it brings the behaviour of this plugin closer to the exact behaviour of ADE and thus reduces the chance of Adobe detecting and blocking this plugin. If you don't like this feature it can be disabled in the plugin settings.
- Add support for the Adobe record "LoanReturn". This lets you return a loaned eBook to the library (only if FulfillmentNotification support is enabled). This only works with books downloaded with v0.0.9 or newer.

Version 0.0.8 - 3 Oct 2021
- Fix some more issues with some PDF files
- Fix for PDF files larger than 4GB
- Fix for PDF or EPUB files larger than available RAM
- Fix for ACSM files not showing up in Calibre's "Add book" dialog

Version 0.0.7 - 1 Oct 2021
- Bugfix for some PDF files
- More debug logs for PDF issues
- Fix locale bug on MacOS

Version 0.0.6 - 28 Sep 2021
- First support for PDF files
- Add functionality to import an existing activation backup from a previous installation

Version 0.0.5 - 27 Sep 2021
- Bugfix: With version 0.0.4, the DeDRM plugin was also executed on imported books if it was installed but has been disabled in the Calibre settings. With this update the DeDRM plugin is only executed if it's enabled.
- Addition: There's now a standalone Python script included in the ZIP file (get_key_from_Adobe.py) that can be used to download the account DER encryption key (for DeDRM) from Adobe's servers without using up one of the six activations.

Version 0.0.4 - 26 Sep 2021
- Make plugin compatible with DeDRM, it's no longer needed to modify the DeDRM plugin to make it work.

Version 0.0.3 - 25 Sep 2021
- First version published on mobileread.
- Code completely rewritten in Python-only, no longer dependant on the Linux-only libgourou library

Version 0.0.2 - 21 Sep 2021 - unreleased development version
- Fix a bug with encryption key export

Version 0.0.1 - 20 Sep 2021
- First version - Linux-only as it still uses the C++ libgourou instead of my own Python implementation.

Attached Files
File Type: zip DeACSM_0.0.16.zip (446.8 KB, 44142 views)

Last edited by Leseratte_10; 10-21-2022 at 01:22 AM.
Leseratte_10 is offline   Reply With Quote