How nodrm/dedrm_tools works
Project Type and Purpose
• The project is a collection of DRM removal tools for ebooks that interface primarily as Calibre plugins. Two main plugins, DeDRM (for Amazon, Adobe, Barnes & Noble, and legacy formats) and Obok (for Kobo DRM), are at the core.
• The README clarifies that this is a fork of an earlier project with a focus on supporting multiple Calibre versions and a variety of DRM schemes. Complementary “Other_Tools” exist for additional DRM key processing or patching.
Analyzing the File Structure
• At the root, you see general project files (README.md, CHANGELOG.md, make_release.py, etc.) and configuration directories (.github) for CI/CD workflows.
• The project is divided into major directories:
– DeDRM_plugin: Contains the bulk of the DRM removal logic. This directory includes initialization (__init__.py), compatibility modules, DRM-specific modules (adobekey.py, androidkindlekey.py, kfxdedrm.py, etc.), scripts for standalone usage, configuration handling, and utility functions.
– Obok_plugin: The second plugin focused on removing Kobo DRM, including similar structure with initialization, configuration, dialogs, and localized translations.
– Other_Tools: A collection of ancillary scripts and patches (for Barnes & Noble, Adobe Digital Editions, Kindle variants, etc.), which support extra functionalities or legacy formats. They include both JavaScript-based tools and Python scripts.
• The presence of separate directories for GitHub workflows and ISSUE_TEMPLATE signifies a robust development process with automated tests or builds.
Main Components and Their Relationships
• User Interface/Calibre Integration: The entry point is the Calibre plugin interface. When installed, Calibre calls the appropriate plugin (DeDRM or Obok) based on the ebook format.
• DeDRM Plugin Core: This component includes various modules that detect the DRM type (e.g., Adobe, Kindle, Mobipocket) and call specialized routines (like adobekey libraries for Adobe DRM or androidkindlekey for Kindle on Android). It links to key retrieval, decryption, and file conversion modules.
• Obok Plugin: Similarly, this plugin manages Kobo-specific DRM, handling user dialogs, configuration, and utility functions to process Kobo ebooks.
• Other DRM Key Scripts/Tools: These act as support tools that can operate independently from Calibre. They provide DRM key extraction, version-specific patches, and additional functionality.
• External Dependencies & Environment: Integration with different Calibre versions (Python 2 & Python 3), supported by conditional compatibility layers and external workflows for releases (github workflows, release candidate publishing).