Program for organizing and managing ebook collections. It is a Python port of ebook-tools (shell scripts).
Project description
🚧 Work-In-Progress
This project is a Python port of ebook-tools which is written in Shell by na–. The Python script ebooktools.py is a collection of tools for automated and semi-automated organization and management of large ebook collections.
ebooktools.py makes use of the following tools:
edit: to edit a configuration file which can either be the main config file that contains all the options defined below or the logging config file.
split: to split the supplied ebook files (and the accompanying metadata files if present) into folders with consecutive names that each contain the specified number of files.
Warning
More to come! Check the Roadmap to know what is coming soon.
Installation
It is highly recommended to install the package py_ebooktools in a virtual environment using for example venv or conda.
Make sure to update pip:
$ pip install --upgrade pip
Install the package py_ebooktools (bleeding-edge version) with pip:
$ pip install git+https://github.com/raul23/py-ebooktools#egg=py-ebooktools
Warning
Make sure that pip is working with the correct Python version. It might be the case that pip is using Python 2.x You can find what Python version pip uses with the following:
$ pip -VIf pip is working with the wrong Python version, then try to use pip3 which works with Python 3.x
Test installation
Test your installation by importing py_ebooktools and printing its version:
$ python -c "import py_ebooktools; print(py_ebooktools.__version__)"
You can also test that the script ebooktools.py runs by showing the program’s version:
$ ebooktools --version
Usage, options and configuration
All of the options documented below can either be passed to the ebooktools.py script via command-line parameters or via the configuration file config.py. Command-line parameters supersede variables defined in the configuration file. Most parameters are not required and if nothing is specified, the default value defined in the default config file default_config.py will be used.
General options
General control flags
-v, --verbose; config variable verbose; default value False
-d, --dry-run; config variable dry_run; default value False
--sl, --symlink-only; config variable symlink_only; default value False
Options for OCR
--ocr <value>, --ocr-enabled <value>; config variable ocr_enabled; default value False
--ocrop <value>, --ocr-only-first-last-pages <value>; config variable ocr_only_first_last_pages; default value (7,3) (except for convert-to-txt.py where it’s False)
Miscellaneous options
-r, --reverse; config variable file_sort_reverse; default value False
If this is enabled, the files will be sorted in reverse (i.e. descending) order. By default, they are sorted in ascending order.
Script usage and options
edit [<OPTIONS>] cfg_type {main,log}
Description
Edit a configuration file, either the main configuration file (main) or the logging configuration file (log). The configuration file can be opened by a user-specified application (app) or a default program associated with this type of file (when app is None).
Options
-a <value>, --app <value>; config variable app; default value None
-r, --reset; no config variable; default value False
split [<OPTIONS>] folder_with_books
Description
Split the supplied ebook files (and the accompanying metadata files if present) into folders with consecutive names that each contain the specified number of files.
Options
-o <value>, --output-folder <value>; config variable output_folder; default value is the current working directory (check with pwd)
The output folder in which all the new consecutively named folders will be created.
-s <value>, --start-number <value>; config variable start_number; default value 0
The number of the first folder.
-f <value>, --folder-pattern <value>; config variable folder_pattern; default value %05d000
The print format string that specifies the pattern with which new folders will be created. By default it creates folders like 00000000, 00001000, 00002000, ....
--fpf <value>, --files-per-folder <value>; env. variable files_per_folder; default value 1000
How many files should be moved to each folder.
Uninstall
To uninstall the package py_ebooktools:
$ pip uninstall py_ebooktools
Information
When uninstalling the py_ebooktools package, you might be informed that the configuration files logging.py and config.py won’t be removed by pip. You can remove those files manually by noting their paths returned by pip. Or you can leave them so your saved settings can be re-used the next time you re-install the package.
Example: uninstall the package and remove the config files
$ pip uninstall py_ebooktools Found existing installation: py-ebooktools 0.1.0 Uninstalling py-ebooktools-0.1.0: Would remove: /Users/test/miniconda3/envs/ebooktools_py37/bin/ebooktools /Users/test/miniconda3/envs/ebooktools_py37/lib/python3.7/site-packages/py_ebooktools-0.1.0.dist-info/* /Users/test/miniconda3/envs/ebooktools_py37/lib/python3.7/site-packages/py_ebooktools/* Would not remove (might be manually added): /Users/test/miniconda3/envs/ebooktools_py37/lib/python3.7/site-packages/py_ebooktools/configs/config.py /Users/test/miniconda3/envs/ebooktools_py37/lib/python3.7/site-packages/py_ebooktools/configs/logging.py Proceed (y/n)? y Successfully uninstalled py-ebooktools-0.1.0 $ rm -r /Users/test/miniconda3/envs/ebooktools_py37/lib/python3.7/site-packages/py_ebooktools/
Roadmap
Port all of ebook-tools shell scripts into Python
organize-ebooks.sh: not started yet
interactive-organizer.sh: not started yet
find-isbns.sh: working on it
convert-to-txt.sh: working on it
rename-calibre-library.sh: not started yet
split-into-folders.sh: done, see split_into_folders.py
Add tests
Eventually add documentation on readthedocs
References
ebook-tools: Shell scripts for organizing and managing ebook collections.
License
This program is licensed under the GNU General Public License v3.0. For more details see the LICENSE file in the repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file py-ebooktools-0.1.0a3.tar.gz
.
File metadata
- Download URL: py-ebooktools-0.1.0a3.tar.gz
- Upload date:
- Size: 32.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa44ab46f383749fb5e0c859edfc7b3c989a72f239cd7aa2bd0406a8caf92a6d |
|
MD5 | 7b1c9a0c17c07b331ed9fbcd46ba2bc7 |
|
BLAKE2b-256 | 0b9ebbe2dd8fd330d80058210d53c9da7a299b4024f4b9dfdb7554f5a9380e24 |
File details
Details for the file py_ebooktools-0.1.0a3-py3-none-any.whl
.
File metadata
- Download URL: py_ebooktools-0.1.0a3-py3-none-any.whl
- Upload date:
- Size: 33.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60395c9c9b07f9b73745bee63d79a8f7546145307de99cbf97cd48e0399d4196 |
|
MD5 | ed46989ce4a9d3c11207207147e4fe68 |
|
BLAKE2b-256 | 0f961118fdd68d015dea4df44ac1756508a4b14212bb094cc22f7ebd136b33f6 |