Metadata-Version: 2.5
Name: mangafire-dl
Version: 0.6.0
Summary: Download manga volumes and chapters from MangaFire in CBZ format.
License-Expression: MIT
License-File: LICENSE
Requires-Python: >=3.10
Requires-Dist: gallery-dl<2,>=1.32.15
Requires-Dist: requests<3,>=2.32
Provides-Extra: dev
Requires-Dist: build<2,>=1.2; extra == 'dev'
Requires-Dist: pyinstaller<7,>=6.15; extra == 'dev'
Requires-Dist: pytest<10,>=9; extra == 'dev'
Description-Content-Type: text/markdown

[English](README.md) | [Português](README.pt.md)

# MangaFire Downloader

A command-line tool for downloading manga volumes and chapters from MangaFire as CBZ archives.

**Built on [`gallery-dl`](https://github.com/mikf/gallery-dl).** MangaFire Downloader relies on `gallery-dl` for its underlying extraction and download capabilities. This project would not exist in its current form without the work of the `gallery-dl` developers and contributors.

> **Latest release:** v0.6.0. Install from [PyPI](https://pypi.org/project/mangafire-dl/) or download the [Windows portable ZIP](https://github.com/Osanticide/mangafire-dl/releases).

## Features

- Download individual volumes or chapters directly from their MangaFire URLs.
- Select volumes or chapters from a manga page by number, range, or a combination of both.
- List available volumes and chapters before downloading.
- Filter listings by language.
- Display chapter numbers and distinguish `official` and `unofficial` versions.
- Accept a manga ID or a MangaFire title, volume, or chapter URL as input.
- Save downloads as CBZ archives.
- Choose a custom output directory.
- Use the command-line interface on supported Python environments or the portable Windows build without installing Python.

## Installation

### Windows — Portable ZIP

1. Open [GitHub Releases](https://github.com/Osanticide/mangafire-dl/releases).
2. Download the `mangafire-dl-windows-x64-<version>.zip` asset for the release you want.
3. Extract the ZIP to a folder.
4. To use the guided prompt, double-click `Executar.bat`.
5. To use the command-line interface directly, run `mangafire-dl.exe` from PowerShell or Command Prompt and pass the URL or manga ID and the desired options.

The portable ZIP includes the executable and its required files. Keep `mangafire-dl.exe`, `Executar.bat`, and the `_internal` directory together. Do not move or distribute the EXE by itself.

### Python — pipx

```powershell
pipx install mangafire-dl
```

To upgrade:

```powershell
pipx upgrade mangafire-dl
```

### Python — pip

Python 3.10 or newer is required. Using a virtual environment is recommended:

```powershell
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install mangafire-dl
```

On Linux or macOS, activate the environment with:

```bash
source .venv/bin/activate
```

## Quick Start

You can use a MangaFire title URL or a bare manga ID. Replace the examples with the manga you want to access.

### List available volumes

```bash
mangafire-dl 027-bleach --lang pt-br --list volumes
```

Or use a title URL:

```bash
mangafire-dl "https://mangafire.to/title/027-bleach" --lang pt-br --list volumes
```

The output shows the available volumes in the selected language, the chapter count for each volume, and the total number of volumes.

### List available chapters

```bash
mangafire-dl 027-bleach --lang pt-br --list chapters
```

The chapter listing is displayed in four columns and identifies each selected chapter version as `official` or `unofficial`. Special chapter numbers, including decimal numbers, are preserved.

You can also use a direct volume or chapter URL as the source for a listing. The listing refers to the manga associated with that URL.

### Download selected volumes

```bash
mangafire-dl 027-bleach --lang pt-br --volumes "1-5"
```

### Download selected chapters

```bash
mangafire-dl "https://mangafire.to/title/027-bleach" --lang en --chapters "1-5, 10, 12-15"
```

### Download a direct volume or chapter URL

```bash
mangafire-dl "https://mangafire.to/title/027-bleach/volume/144857"
```

```bash
mangafire-dl "https://mangafire.to/title/027-bleach/chapter/6056551"
```

Direct downloads do not require `--lang`, `--volumes`, or `--chapters`.

### Choose an output directory

```bash
mangafire-dl 027-bleach --lang pt-br --volumes "1-5" --output "D:\Mangas"
```

By default, downloaded files are saved in the operating system's Downloads directory.

## Usage

### Command-line syntax

```text
mangafire-dl URL_OR_ID [--lang LANGUAGE] [--list {chapters,volumes} | --volumes SELECTION | --chapters SELECTION] [--output PATH]
```

### Options

| Option | Description |
| --- | --- |
| `URL_OR_ID` | MangaFire manga ID, title URL, volume URL, or chapter URL. Required. |
| `--lang LANGUAGE` | Language code for listing or selecting resources from a manga. Examples: `pt-br`, `en`. Required for listing and manga-page downloads. |
| `--list {chapters,volumes}` | Lists available chapters or volumes without downloading them. Requires `--lang`. |
| `--volumes SELECTION` | Volumes to download from a manga page. Mutually exclusive with `--chapters` and `--list`. |
| `--chapters SELECTION` | Chapters to download from a manga page. Mutually exclusive with `--volumes` and `--list`. |
| `--output PATH` | Output directory. Defaults to the operating system's Downloads directory. |
| `--help` | Show command-line help. |
| `--version` | Show the installed version. |

For a listing, provide `--lang` and `--list chapters` or `--list volumes`. For a manga-page download, provide `--lang` and exactly one of `--volumes` or `--chapters`. For a direct volume or chapter download, provide the resource URL and, optionally, `--output`.

### Selection syntax

Selections accept individual numbers, ranges, and comma-separated combinations:

```text
1
1-5
1, 6, 12
1-5, 8, 12-15
```

Use quotes around a selection in shell commands, especially when it contains commas or spaces.

## Output Structure

Downloads are organized by manga and resource type. For example:

```text
Downloads/
└── Bleach/
    ├── volumes/
    │   ├── Bleach - Volume 01.cbz
    │   └── Bleach - Volume 02.cbz
    └── chapters/
        ├── Bleach - Chapter 001.cbz
        └── Bleach - Chapter 002.cbz
```

Volume numbers are normally padded to two digits and chapter numbers to three digits. Decimal chapter numbers retain their decimal part. The manga folder and filenames are derived from the resource's title.

## Requirements

- **Python package:** Python 3.10 or newer.
- **Runtime dependencies:** `gallery-dl` and `requests` are declared by the package and installed automatically by `pip` or `pipx`.
- **Windows portable ZIP:** does not require a separate Python or `gallery-dl` installation. Keep the EXE and its `_internal` directory together.

## Troubleshooting

- **A manga-page download is rejected:** include `--lang` and either `--volumes` or `--chapters`.
- **A listing is rejected:** include `--lang` and specify `--list chapters` or `--list volumes`.
- **Conflicting modes are supplied:** use only one of `--list`, `--volumes`, or `--chapters` per command.
- **No resources are found:** check the selected language and the volumes or chapters available on MangaFire.
- **A request fails:** check your internet connection and whether MangaFire is reachable, then retry. Site responses and available resources can change.
- **The portable build fails to start:** extract the complete ZIP and keep `mangafire-dl.exe`, `Executar.bat`, and `_internal` in the same folder.

## Limitations

- The tool depends on MangaFire's current site behavior and the resources available there; changes to the site may require updates.
- The command-line interface does not currently provide a graphical user interface.
- The Windows portable build is distributed as a folder packaged in a ZIP, not as a Windows installer.

## For Developers

### Development setup

```bash
git clone https://github.com/Osanticide/mangafire-dl.git
cd mangafire-dl
python -m venv .venv
source .venv/bin/activate
python -m pip install -e ".[dev]"
```

On Windows, activate the environment with:

```powershell
.\.venv\Scripts\Activate.ps1
```

### Run tests

```bash
python -m pytest
```

### Build release artifacts

```bash
python scripts/build_release.py
```

The build script runs the test suite and builds the Python wheel and source distribution. When run on Windows, it also builds the Windows standalone folder and creates the portable ZIP. Run the script on each target operating system; PyInstaller does not cross-build a Windows executable from Linux or a Linux executable from Windows.

Build outputs are written to `dist/`. The script prepares artifacts locally; it does not publish them to PyPI or create a GitHub Release automatically.

## Contributing

Bug reports, suggestions, and pull requests are welcome. Before opening a pull request, run the test suite and describe the behavior your change affects.

## License

The original MangaFire Downloader project is licensed under the [MIT License](LICENSE). Third-party components, including [`gallery-dl`](https://github.com/mikf/gallery-dl), remain subject to their respective licenses.

## Acknowledgements

MangaFire Downloader uses [`gallery-dl`](https://github.com/mikf/gallery-dl) as the underlying download component. Many thanks to its developers and contributors for creating and maintaining that project.

## Disclaimer

MangaFire Downloader is an independent third-party project and is not affiliated with, endorsed by, or maintained by MangaFire or the `gallery-dl` project. Users are responsible for complying with applicable laws, copyright requirements, and the terms that apply to the websites and content they access.
