Coder Social home page Coder Social logo

ibook2epub's Introduction

ibooks2epub

Use this program to convert iBooks epub directories to epub format.

The Problem

Apple stores books in a proprietary format, which is a directory with a bunch of files in it. This is not a valid epub file, and cannot be read by most epub readers.

The Solution

This program converts the directory into a valid epub file. It does this by removing the iTunesMetadata.plist file, and using the remaining files in the folder to create a valid epub file.

Special Considerations

This program implements the following special considerations:

  • Valid epub files are zip files.
  • The first file must be named "mimetype",
    • it must not be compressed,
    • it must contain the string "application/epub+zip".
  • The rest of the files must be compressed.

Performance

There are two operations which are time consuming:

  • Compressing the files from the source directory.
  • Writing the files to the output directory.

The program uses a thread pool to compress the files, and a thread pool to write the files.

Usage

Command Line

Usage: convert.py [OPTIONS]

  Convert Apple iBooks epub packages to zipped epub files.

  This function collects directory names, creates EPUB files, and handles the
  process flow. It limits the total number of files processed based on the
  MAX_EXPORT_FILES global constant.

Options:
  -m, --max-export-files INTEGER  Override the maximum number of exported
                                  files, default=5, 0=no limit.
  -o, --output-dir DIRECTORY      Path of the output directory.
  -s, --source-dir DIRECTORY      Path of the source directory.
  -d, --dry-run                   Run the program in dry-run mode.
  --help                          Show this message and exit.

ibook2epub's People

Contributors

raeq avatar

Stargazers

Kelly Arwine avatar

Watchers

 avatar

ibook2epub's Issues

Feedback and one nitpick

This open source library was super helpful! Thank you! I ⭐️'ed it.

I ran the following command but the logging said it was still checking
python3 convert.py -s ~/Downloads/***/ -o ~/Downloads/*** -m 100

Logs:

Starting the convert application {'source_dir': '/Users/***/Downloads/iBooks/', 'output_dir': '/Users/***/Downloads/converted', 'max_export_files': 50, 'dry_run': False}
2024-05-12 13:33:27,847 - INFO - Examining: /Users/***/Library/Mobile Documents/iCloud~com~apple~iBooks/Documents/
2024-05-12 13:33:27,849 - INFO - Limiting activity to a maximum of 50 epub files.

A few problems I had or things that would make it better:

  • Sort output files and input files into folders so I know what's been done.
  • Don't add "converted" to the filname.
  • Log should mention /Users/***/Library/Mobile Documents/iCloud~com~apple~iBooks/Documents/ if the source file has been directed
  • Show an example of how to run the command with the directory flags

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.