Skip to main content

A terminal-based manga downloader and archiver

Project description

PyPI Version Python Versions PyPI Downloads License CI

Manga Archiver

A terminal-based manga downloader and archiver.

About The Project

A terminal-based tool that makes it easy to search for and download manga from sources like MangaDex and AllManga.

Features

  • Interactive TUI with keyboard and mouse support
  • Download chapters in PDF, CBZ, or EPUB format
  • Configurable output settings via in-app Settings screen
  • Asynchronous download pipeline with configurable workers
  • Local file output or Google Drive upload modes
  • Backlog sync - automatically find and download missing chapters from your favorites

Getting Started

Prerequisites

  • Python 3.10 or higher

Installation

install the package with pip:

pip install manga-archiver

or clone the repository and install the package locally:

git clone https://github.com/jfang324/manga-archiver.git
cd manga-archiver
pip install .

Running the Application

manga-archiver

Google Drive Integration

The application supports uploading downloaded manga directly to Google Drive for cloud storage.

Setting Up Google Drive

  1. Create a Google Cloud Project

  2. Create OAuth Credentials

    • Go to "APIs & Services" > "Credentials"
    • Create "OAuth client ID" credentials
    • Application type: TVs and Limited Input Devices
    • Download the credentials JSON file
  3. Configure the Application

    • Download your OAuth credentials JSON file from Google Cloud Console
    • Rename it to client_secret.json and place it in ~/.manga-archiver/

    The file should have this structure (from Google's download):

    {
        "installed": {
            "client_id": "...",
            "client_secret": "...",
            "redirect_uris": [...],
            "token_uri": "..."
        }
    }
    
  4. Authenticate

    manga-archiver auth login
    

    This will initiate the OAuth device flow, follow the instructions in the terminal.

Using Google Drive

Once authenticated, you can:

  • Use archive mode to upload downloads directly to Google Drive:

    manga-archiver --archive
    
  • Logout when you want to disconnect your account:

    manga-archiver auth logout
    

How It Works

  1. A root folder "Manga-Archiver" is created in your Google Drive
  2. Each manga gets its own subfolder (created automatically or reused if existing)
  3. Downloaded files are uploaded to the corresponding manga folder
  4. File name collisions are handled by appending (1), (2), etc.

Backlog Sync

The backlog sync feature automatically finds missing chapters from your favorites by comparing your local downloads (stored in Google Drive) against the available chapters.

Usage:

# Sync missing chapters from favorites (requires --archive for Google Drive access)
manga-archiver --archive --backlog

This will:

  1. Fetch all your favorited manga from the database
  2. Scan each manga's folder in Google Drive to see which chapters you have
  3. Download any chapters you don't have yet
  4. Upload them to Google Drive automatically

Note: You must have:

  • Authenticated with Google Drive (manga-archiver auth login)
  • Favorites saved in the app (add manga to favorites in the TUI)
  • Run with --archive to access Google Drive

Settings

Press Ctrl+S on the Settings screen to save your preferences.

Configurable options:

  • Output Directory: Where downloaded files are saved (local mode)
  • Output Format: PDF, CBZ, or EPUB
  • Quality: 1-100 (higher = better quality, larger files)
  • Optimize: Optimize PDF file size (slower generation)

Settings are stored in ~/.manga-archiver/settings.json

CLI Arguments

The following command-line arguments are available:

Flag Type Default Description
--resolve-workers int 2 Number of workers retrieving download resources
--download-workers int 2 Number of workers downloading images
--merge-workers int 2 Number of workers merging images into output format
--resolve-rate-limit int 5 Global rate limit for resolve workers (requests/sec)
--download-rate-limit int 5 Global rate limit for download workers (requests/sec)
--archive flag false Enable archive mode (upload to Google Drive instead of local save)
--backlog flag false Sync favorites with Google Drive and download missing chapters
--benchmark flag false Enable benchmark metrics collection, written to ~/.manga-archiver/benchmark/metrics.txt
--auto-exit flag false Automatically exit when all jobs are complete
migrate sub - Run database migrations (subcommands: database, google-drive)
auth sub - Google Drive authentication (subcommands: login, logout)

Usage Examples

# Download with more workers for faster processing
manga-archiver --resolve-workers 10 --download-workers 10

# Upload directly to Google Drive
manga-archiver --archive

# Sync missing chapters from favorites
manga-archiver --archive --backlog

# Enable benchmark mode to collect performance metrics
manga-archiver --benchmark

For more options, run manga-archiver --help.

Migration Commands

The application includes a migration system to handle database and Google Drive schema updates.

# Migrate database schema
manga-archiver migrate database

# Migrate Google Drive schema
manga-archiver migrate google-drive

Gallery

https://github.com/user-attachments/assets/f07d5eb4-91d3-4fa1-b90f-23f9f24bfbed

Acknowledgements

  • MangaDex for providing the API used in this project

Known Issues

  • Manga with long titles and chapter titles sometimes fails to upload to Google Drive
  • Download screen reports "complete" even if it failed due to exceeding retry limit

Development

Activate Virtual Environment

poetry shell

Running Tests

coverage run -m pytest -v

Generating Coverage Report

coverage report -m

Linting

ruff check .

Formatting

ruff format .

Type Checking

pyright

Tools & Technologies

Core

  • Python 3.10+
  • aiohttp
  • asyncio
  • Pillow
  • ebooklib
  • SQLite

UI

  • Textual

Google Drive

  • google-auth
  • google-api-python-client

Code Quality

  • Ruff
  • Pyright

Testing

  • Pytest
  • Coverage
  • pytest-asyncio

Build & Package

  • Poetry
  • pip

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

manga_archiver-1.1.2.tar.gz (62.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

manga_archiver-1.1.2-py3-none-any.whl (97.2 kB view details)

Uploaded Python 3

File details

Details for the file manga_archiver-1.1.2.tar.gz.

File metadata

  • Download URL: manga_archiver-1.1.2.tar.gz
  • Upload date:
  • Size: 62.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.11.7 Windows/10

File hashes

Hashes for manga_archiver-1.1.2.tar.gz
Algorithm Hash digest
SHA256 40e7f5d8a0baf89168324398f363802ecb1b6cb01a8d2dd6bce89c2302bc2ee9
MD5 666aee41e1719712c91fc8aaf0b3d98c
BLAKE2b-256 f6dd234b475eb60beba9ce2fc7c45d05010f98121c3de4f5114ddcd9499e8c64

See more details on using hashes here.

File details

Details for the file manga_archiver-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: manga_archiver-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 97.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.11.7 Windows/10

File hashes

Hashes for manga_archiver-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 79067e8da6b29cf524e04713f09fcc71f295e3bd939d9481cc8a4c07c9b044f0
MD5 089247b9de3f5a3526a60340a5b04a10
BLAKE2b-256 55700be121dfeef9f82d89b69de69008dcd271d7166c53049b7d9b2874d916f7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page