# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['kobodl', 'kobodl.commands']

package_data = \
{'': ['*'], 'kobodl': ['templates/*']}

install_requires = \
['beautifulsoup4<5.0.0',
 'click<8',
 'dataclasses-json<0.6.0',
 'dataclasses<1.0.0',
 'flask>=1.1.0,<2.0.0',
 'pycryptodome<4',
 'pyperclip>=1.8.2,<2.0.0',
 'requests>=2.25,<3.0',
 'tabulate<0.9.0']

entry_points = \
{'console_scripts': ['kobodl = kobodl:cli']}

setup_kwargs = {
    'name': 'kobodl',
    'version': '0.9.1',
    'description': 'Kobo Book Downloader',
    'long_description': '## Alternatives to kobodl\n\nI used to prefer `kobodl` because it\'s **standalone**, which means you don\'t need other proprietary software like Adobe Digial Editions or Kindle for PC (that I can\'t use on Linux). However, I have since discoverd a way to do this with [Calibre](https://github.com/kovidgoyal/calibre) and 2 plugins:\n\n* [Leseratte10/acsm-calibre-plugin](https://github.com/Leseratte10/acsm-calibre-plugin) - A plugin that can read Adobe Digital Editions files that Kobo web download produces.\n* [noDRM/DeDRM_tools](https://github.com/noDRM/DeDRM_tools) - The popular DRM removal plugin.\n\nNow you can just download the `.acm` file from your book list on Kobo.com and load it into Calibre desktop!\n\nIt doesn\'t work with audiobooks and is a little harder to set up, but I think it\'s overall a better solution and I am not using kobodl personally much anymore. If anyone is interested in becoming a new maintainer of kobodl please let me know by opening a [discussion](https://github.com/subdavis/kobo-book-downloader/discussions).  I will still try to keep it functioning as long as I can, and bug reports are still appreciated.\n\n---\n\n![kobodl logo](docs/kobodl.png)\n\n![GitHub Workflow Status](https://img.shields.io/github/workflow/status/subdavis/kobo-book-downloader/Publish%20Docker%20Container?style=for-the-badge)\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/subdavis/kobo-book-downloader?style=for-the-badge)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/kobodl?style=for-the-badge)\n![PyPI - License](https://img.shields.io/pypi/l/kobodl?style=for-the-badge)\n![PyPI](https://img.shields.io/pypi/v/kobodl?style=for-the-badge)\n\n# kobodl\n\nThis is a hard fork of [kobo-book-downloader](https://github.com/TnS-hun/kobo-book-downloader), a command line tool to download and remove Digital Rights Management (DRM) protection from media legally purchased from [Rakuten Kobo](https://www.kobo.com/). The resulting [EPUB](https://en.wikipedia.org/wiki/EPUB) files can be read with, amongst others, [KOReader](https://github.com/koreader/koreader).\n\n> **NOTE:** You must have a kobo email login for this tool to work (you can\'t use an external provider like Google or Facebook). However, you can create a NEW kobo account and link it with your existing account on the user profile page. Go to `My Account -> Account Settings` to link your new kobo login.\n\n## Features\n\nkobodl preserves the features from [TnS-hun/kobo-book-downloader](https://github.com/TnS-hun/kobo-book-downloader).\n\n* stand-alone; no need to run other software or pre-download through an e-reader.\n* downloads `.epub` formatted books\n\nIt adds several new features.\n\n* **audiobook support**; command-line only for now.\n  * Use `kobodl book get`. There will not be a download button in the webpage for audiobooks because they consist of many large files.\n* **multi-user support**; fetch books for multiple accounts.\n* **web interface**; adds new browser gui (with flask)\n* **CalibreWeb Integration**; send books directly to CalibreWeb from the web interface.\n* [docker image](https://github.com/subdavis/kobodl/pkgs/container/kobodl)\n* [pypi package](https://pypi.org/project/kobodl/)\n* [pyinstaller bundles](https://github.com/subdavis/kobo-book-downloader/releases/latest)\n\n## Web UI\n\nWebUI provides most of the same functions of the CLI. It was added to allow other members of a household to add their accounts to kobodl and access their books without having to set up python.\n\n### User page\n\n![Example of User page](docs/webss.png)\n\n### Book list page\n\n![Example of book list page](docs/books3.png)\n\n## Installation\n\n### pipx\n\n``` bash\npipx install kobodl\n```\n\n### pip\n\n``` bash\npip install kobodl\n```\n\n### Pre-built bundles\n\nNo python installation necessary.  Simply download the appropriate executable from [the latest release assets](https://github.com/subdavis/kobo-book-downloader/releases/latest) and run it from the command line.  Pre-built bundles are CLI-only (no web server) so use a different install option if you want that feature.\n\n``` bash\n# Linux\nwget https://github.com/subdavis/kobo-book-downloader/releases/latest/download/kobodl-ubuntu\nchmod +x kobodl-ubuntu-latest\n./kobodl-ubuntu-latest\n```\n\n``` bash\n# MacOS (Catalina 10.15 or newer required.  For older versions, use the pip or docker install option)\nwget https://github.com/subdavis/kobo-book-downloader/releases/latest/download/kobodl-macos\nchmod +x kobodl-macos-latest\n./kobodl-macos-latest\n```\n\n``` powershell\n# Windows Powershell example\nwget "https://github.com/subdavis/kobo-book-downloader/releases/latest/download/kobodl-windows.exe" -outfile "kobodl.exe"\n./kobodl.exe\n```\n\n### docker\n\n> *Note*: for rootless docker installations (uncommon), omit the `--user` argument.\n\n``` bash\n# list users\ndocker run --rm -it --user $(id -u):$(id -g) \\\n  -v ${HOME}/.config:/home/config \\\n  ghcr.io/subdavis/kobodl \\\n  --config /home/config/kobodl.json user list\n\n# run http server\ndocker run --rm -it --user $(id -u):$(id -g) \\\n  -p 5000:5000 \\\n  -v ${HOME}/.config:/home/config \\\n  -v ${PWD}:/home/downloads \\\n  ghcr.io/subdavis/kobodl \\\n  --config /home/config/kobodl.json \\\n  serve \\\n  --host 0.0.0.0 \\\n  --output-dir /home/downloads/kobodl_downloads\n```\n\n[Also see the **docker-compose** example file.](./docker-compose.yml)\n\n## Usage\n\nGeneral usage documentation.\n\n> **Note**: These are commands you type into a shell prompt like Terminal (Ubuntu, MacOS) or Powershell or CMD (Windows).  You may need to replace `kobodl` with `./kobodl.exe`, `./kobodl-macos-latest`, or something else, depending on which installation method you chose.\n\n``` bash\n# Get started by adding one or more users\n# See `Getting a reCAPTCHA code` below for more help\nkobodl user add\n\n# List users\nkobodl user list\n\n# Remove a user\nkobodl user rm email@domain.com\n\n# List books\nkobodl book list\n\n# List books for a single user\nkobodl book list --user email@domain.com\n\n# List all books, including those marked as read\nkobodl book list --read\n\n# Show book list help\nkobodl book list --help\n\n# Download a single book with default options when only 1 user exists\n# default output directory is `./kobo_downloads` \nkobodl book get c1db3f5c-82da-4dda-9d81-fa718d5d1d16\n\n# Download a single book with advanced options\nkobodl book get \\\n  --user email@domain.com \\\n  --output-dir /path/to/download_directory \\\n  --format-str \'{Title}\' \\\n  c1db3f5c-82da-4dda-9d81-fa718d5d1d16\n\n# Download ALL books with default options when only 1 user exists\nkobodl book get --get-all\n\n# Download ALL books with advanced options\nkobodl book get \\\n  --user email@domain.com \\\n  --output-dir /path/to/download_directory \\\n  --format-str \'{Title}\' \\\n  --get-all\n```\n\nRunning the web UI\n\n``` bash\nkobodl serve\n * Serving Flask app "kobodl.app" (lazy loading)\n * Environment: production\n   WARNING: This is a development server. Do not use it in a production deployment.\n   Use a production WSGI server instead.\n * Debug mode: off\n * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)\n```\n\nGlobal options\n\n``` bash\n# argument format\nkobodl [OPTIONS] COMMAND [ARGS]...\n\n# set python tabulate formatting style.\nkobodl --fmt "pretty" COMMAND [ARGS]...\n\n# set config path if different than ~/.config/kobodl.json\nkobodl --config /path/to/kobodl.json COMMAND [ARGS]...\n\n# get version\nkobodl --version\n\n# enable debugging, prints to "debug.log"\nkobodl --debug [OPTIONS] COMMAND [ARGS]...\n```\n\n## Getting a reCAPTCHA code\n\nAdding a user requires a bit of hackery to get a reCAPTCHA code from Kobo\'s website. This GIF helps to explain how to do that.\n\n![Gif explaining how to get reCAPTHCA](docs/captcha.gif)\n\n## CalibreWeb Integration: **Experimental**\n\nKobodl\'s web interface can send books directly to your calibre web server.  Only supported from web client.\n\nYou must add your CalibreWeb server and user details directly in kobodl.json.  Make sure to include `/upload` in the url.  If you don\'t have CalibreWeb authentication on, leave these fields blank (`""`).\n\n``` json\n{\n    "users": [ /* ... */ ],\n    "calibre_web": {\n        "enabled": true,\n        "url": "https://calibre.domain.com/upload",\n        "username": "CHANGEME",\n        "password": "CHANGEME"\n    }\n}\n```\n\n> **NOTE**: you may need to add escape characters if your password contains a `\\`, `"`, or others that require JSON escaping.\n\n## Troubleshooting\n\n> Some of my books are missing!\n\nTry `kobodl book list --read` to show all "finished" and "archived" books.  You can manage your book status on [the library page](https://kobo.com/library).  Try changing the status using the "..." button.\n\n> I see a mesage about "skipping _____" when I download all.\n\nTry to download the book individually using `kobodl book get <revision-id>`, replacing `revision-id` with the UUID from the list table.\n\n> I can\'t log in.  I get a message saying "The page format might have changed"\n\nThis happens from time to time, maybe once or twice a year.  Kobo changes their login page and makes it hard for the tool to parse out the necessary information.  Please open an issue.\n\n> Something else is going wrong!\n\nTry enabling debugging.  Run `kobodl --debug book get` (for example), which will dump a lot of data into a file called `debug.log`. Email me this file. Do not post it in public on an issue because it will contain information about your account.  My email address can be found on my [github profile page](https://github.com/subdavis).\n\n## Development\n\nThis project uses [Python Poetry](https://python-poetry.org/).\n\n```bash\npip install poetry\ngit clone https://github.com/subdavis/kobo-book-downloader\npoetry install\n\n# Run command line app\npoetry run kobodl\n\n# Run linting\npoetry run tox -e lint\n\n# Run standalone bundle generation\npoetry run tox -e buildcli\n\n# Run type checks\npoetry run tox -e type\n```\n\n## Notes\n\nkobo-book-downloader will prompt for your [Kobo](https://www.kobo.com/) e-mail address and password. Once it has successfully logged in, it won\'t ask for them again. Your password will not be stored on disk; Kobodl uses access tokens after the initial login.\n\nCredit recursively to [kobo-book-downloader](https://github.com/TnS-hun/kobo-book-downloader) and the projects that lead to it.\n\n## FAQ\n\n**How does this work?**\n\nkobodl works by pretending to be an Android Kobo e-reader.  It initializes a device, fetches your library, and downloads books as a "fake" Android app.\n\n**Why does this download KEPUB formatted books?**\n\nKobo has different formats that it serves to different platforms.  For example, Desktop users generally get `EPUB3` books with `AdobeDrm` DRM.  Android users typically get `KEPUB` books with `KDRM` DRM, which is fairly easy to remove, so that\'s what you get when you use this tool.\n\n**Is this tool safe and okay to use?**\n\nI\'m not a lawyer, and the discussion below is strictly academic.\n\nThe author(s) of `kobodl` don\'t collect any information about you or your account aside from what is made available through metrics from GitHub, PyPi, Docker Hub, etc.  See `LICENSE.md` for further info.\n\nKobo would probably claim that this tool violates its [Terms of Use](https://authorize.kobo.com/terms/termsofuse) but I\'m not able to conclusively determine that it does so.  Some relevant sections are reproduced here.\n\n> The download of, and access to any Digital Content is available only to Customers and is intended only for such Customers’ personal and non-commercial use. Any other use of Digital Content downloaded or accessed from the Service is strictly prohibited\n\nThis tool should only be used to download books for personal use.\n\n> You may not obscure or misrepresent your geographical location, forge headers, use proxies, use IP spoofing or otherwise manipulate identifiers in order to disguise the origin of any message or transmittal you send on or through the Service. You may not pretend that you are, or that you represent, someone else, or impersonate any other individual or entity.\n\nThis might be a violation.  This client announces itself to Kobo servers as an Android device, which can safely be construed as "manipulating identifiers", but whether or not the purpose is to "disguise the origin" is unclear.\n\n> Kobo may also take steps to prevent fraud, such as restricting the number of titles that may be accessed at one time, and monitoring Customer accounts for any activity that may violate these Terms. If Kobo discovers any type of fraud, Kobo reserves the right to take enforcement action including the termination or suspension of a User’s account.\n\nIn other words, you could have your account suspended for using `kobodl`. **Please open an issue on the issue tracker if this happens to you.**\n',
    'author': 'Brandon Davis',
    'author_email': 'kobodl@subdavis.com',
    'maintainer': None,
    'maintainer_email': None,
    'url': 'https://github.com/subdavis/kobo-book-downloader.git',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'entry_points': entry_points,
    'python_requires': '>=3.6,<3.10',
}


setup(**setup_kwargs)
