move docs to mkdocs website
All checks were successful
ci/woodpecker/push/tests Pipeline was successful

This commit is contained in:
Ivan Schaller 2022-08-15 13:47:16 +02:00
parent cce3b5d632
commit d43fa6ac5b
6 changed files with 496 additions and 192 deletions

197
README.md
View file

@ -1,22 +1,20 @@
# manga-dlp # manga-dlp - python script to download mangas
## python script to download mangas CI/CD
#### CI/CD:
[![status-badge](https://img.shields.io/drone/build/olofvndrhr/manga-dlp?label=tests&server=https%3A%2F%2Fci.44net.ch)](https://ci.44net.ch/olofvndrhr/manga-dlp) [![status-badge](https://img.shields.io/drone/build/olofvndrhr/manga-dlp?label=tests&server=https%3A%2F%2Fci.44net.ch)](https://ci.44net.ch/olofvndrhr/manga-dlp)
[![Last Release](https://img.shields.io/github/release-date/olofvndrhr/manga-DLP?label=last%20release)](https://github.com/olofvndrhr/manga-dlp/releases) [![Last Release](https://img.shields.io/github/release-date/olofvndrhr/manga-DLP?label=last%20release)](https://github.com/olofvndrhr/manga-dlp/releases)
[![Version](https://img.shields.io/github/v/release/olofvndrhr/manga-dlp?label=git%20release)](https://github.com/olofvndrhr/manga-dlp/releases) [![Version](https://img.shields.io/github/v/release/olofvndrhr/manga-dlp?label=git%20release)](https://github.com/olofvndrhr/manga-dlp/releases)
[![Version PyPi](https://img.shields.io/pypi/v/manga-dlp?label=pypi%20release)](https://pypi.org/project/manga-dlp/) [![Version PyPi](https://img.shields.io/pypi/v/manga-dlp?label=pypi%20release)](https://pypi.org/project/manga-dlp/)
#### Code Analysis: Code Analysis
[![Quality Gate Status](https://sonarqube.44net.ch/api/project_badges/measure?project=olofvndrhr%3Amanga-dlp&metric=alert_status&token=f9558470580eea5b4899cf33f190eee16011346d)](https://sonarqube.44net.ch/dashboard?id=olofvndrhr%3Amanga-dlp) [![Quality Gate Status](https://sonarqube.44net.ch/api/project_badges/measure?project=olofvndrhr%3Amanga-dlp&metric=alert_status&token=f9558470580eea5b4899cf33f190eee16011346d)](https://sonarqube.44net.ch/dashboard?id=olofvndrhr%3Amanga-dlp)
[![Coverage](https://sonarqube.44net.ch/api/project_badges/measure?project=olofvndrhr%3Amanga-dlp&metric=coverage&token=f9558470580eea5b4899cf33f190eee16011346d)](https://sonarqube.44net.ch/dashboard?id=olofvndrhr%3Amanga-dlp) [![Coverage](https://sonarqube.44net.ch/api/project_badges/measure?project=olofvndrhr%3Amanga-dlp&metric=coverage&token=f9558470580eea5b4899cf33f190eee16011346d)](https://sonarqube.44net.ch/dashboard?id=olofvndrhr%3Amanga-dlp)
[![Bugs](https://sonarqube.44net.ch/api/project_badges/measure?project=olofvndrhr%3Amanga-dlp&metric=bugs&token=f9558470580eea5b4899cf33f190eee16011346d)](https://sonarqube.44net.ch/dashboard?id=olofvndrhr%3Amanga-dlp) [![Bugs](https://sonarqube.44net.ch/api/project_badges/measure?project=olofvndrhr%3Amanga-dlp&metric=bugs&token=f9558470580eea5b4899cf33f190eee16011346d)](https://sonarqube.44net.ch/dashboard?id=olofvndrhr%3Amanga-dlp)
[![Security](https://img.shields.io/snyk/vulnerabilities/github/olofvndrhr/manga-dlp)](https://app.snyk.io/org/olofvndrhr-t6h/project/aae9609d-a4e4-41f8-b1ac-f2561b2ad4e3) [![Security](https://img.shields.io/snyk/vulnerabilities/github/olofvndrhr/manga-dlp)](https://app.snyk.io/org/olofvndrhr-t6h/project/aae9609d-a4e4-41f8-b1ac-f2561b2ad4e3)
#### Meta: Meta
[![Code style](https://img.shields.io/badge/code%20style-black-black)](https://github.com/psf/black) [![Code style](https://img.shields.io/badge/code%20style-black-black)](https://github.com/psf/black)
[![Linter](https://img.shields.io/badge/linter-pylint-yellowgreen)](https://pylint.pycqa.org/en/latest/) [![Linter](https://img.shields.io/badge/linter-pylint-yellowgreen)](https://pylint.pycqa.org/en/latest/)
@ -84,7 +82,7 @@ mangadlp <args> # call script directly
### With docker ### With docker
See the docker [README](./docker/README.md) See the docker [README](https://manga-dlp.ivn.sh/docker/)
## Options ## Options
@ -115,191 +113,6 @@ optional arguments:
--hook-chapter-post HOOK_CHAPTER_POST Commands to execute after the chapter download finished --hook-chapter-post HOOK_CHAPTER_POST Commands to execute after the chapter download finished
``` ```
### Downloads file-structure
```txt
.
└── <download path>/
└── <manga title>/
└── <chapter title>/
```
#### Example:
```txt
./downloads/mangatitle/chaptertitle(.cbz)
```
### Select chapters to download
> With the option `-c "all"` you download every chapter available in the selected language
To download specific chapters you can use the option `-c` or `--chapters`. That you don't have to specify all chapters
individually, the script has some logic to fill in the blanks.
Examples:
```sh
# if you want to download chapters 1 to 5
python3 manga-dlp -u <url> -c 1-5
# if you want to download chapters 1 and 5
python3 manga-dlp -u <url> -c 1,5
```
If you use `--forcevol` it's the same, just with the volume number
```sh
# if you want to download chapters 1:1 to 1:5
python3 manga-dlp -u <url> -c 1:1-1:5
# if you want to download chapters 1:1 and 1:5
python3 manga-dlp -u <url> -c 1:1,1:5
# to download the whole volume 1
python3 manga-dlp -u <url> -c 1:
```
And a combination of all
```sh
# if you want to download chapters 1 to 5 and 9
python3 manga-dlp -u <url> -c 1-5,9
# with --forcevol
# if you want to download chapters 1:1 to 1:5 and 9, also the whole volume 4
python3 manga-dlp -u <url> -c 1:1-1:5,1:9,4:
```
### Read list of links from file
With the option `--read` you can specify a file with links to multiple mangas. They will be parsed from top to bottom
one at a time. Every link will be matched for the right api to use. It is important that you only have one link per
line, otherwise they can't be parsed.
#### Example:
```txt
# mangas.txt
link1
link2
link3
```
`python3 manga-dlp.py --read mangas.txt --list`
This will list all available chapters for link1, link2 and link3.
### Set download path
With the option `-p/--path` you can specify a path to download the chapters to. The default path
is `<script_dir>/downloads`. Absolute and relative paths are supported.
#### Example:
`python3 manga-dlp.py <other options> --path /media/mangas`
This will save all mangas/chapters in the path `/media/mangas/<manga title>/<chapter name>`
### Set output format
> `--format` currently only works with `""`, `"pdf"`, `"zip"`, `"rar"` and `"cbz"`.
> As it just renames the zip file with the new
> suffix (except pdf).
You can specify the output format of the manga images with the `--format` option.
The default is set to `.cbz`, so if no format is given it falls back to `<manga-name>/<chapter_name>.cbz`
For pdf creation you have to install [img2pdf](https://pypi.org/project/img2pdf/).
With the amd64 docker image it is already installed
see more in the Docker [README.md](docker/README.md).
#### Supported format options are:
* cbz - `--format "cbz"` or `--format ".cbz"` **- default**
* cbr - `--format "cbr"` or `--format ".cbr"`
* zip - `--format "zip"` or `--format ".zip"`
* pdf - `--format "pdf"` or `--format ".pdf"`
* _none_ - `--format ""` - this saves the images just in a folder
#### Example:
`python3 manga-dlp.py <other options> --format "zip"`
This will download the chapter and save it as a zip archive.
### Hooks
You can run custom hooks with manga-dlp for specific events.
They are run with the `subproccess.call` function, so they get run directly by your operating system.
The available hook events are:
- **Pre Manga** -> Before anything gets downloaded
- **Pre Chapter** -> Before the chapter gets downloaded
- **Post Manga** -> After the manga is done. (All specified chapters were downloaded)
- **Post Chapter** -> After each chapter was downloaded (and formatted if specified)
Each of these hooks can be set with a specific flag:
- `--hook-pre-manga` -> Pre Manga hook
- `--hook-pre-chapter` -> Pre Chapter hook
- `--hook-post-manga` -> Post Manga hook
- `--hook-post-chapter` -> Post Chapter hook
#### Example:
```sh
manga-dlp -u <some url> -c 1 --hook-post-manga <some command>
# echo "abc" to stdout
manga-dlp -u <some url> -c 1 --hook-post-manga "echo abc"
# echo the manga name to stdout
manga-dlp -u <some url> -c 1 --hook-post-manga "echo ${MDLP_MANGA_TITLE}"
```
#### Env Variables
All hooks are exposed to a variety of environment variables with infos about the manga/chapter currently downloading.
All available env variables are listed below with the example
for [this](https://mangadex.org/title/0aea9f43-d4a9-4bf7-bebc-550a512f9b95/shikimori-s-not-just-a-cutie) manga:
> Command
> used: `python3 manga-dlp.py -u https://mangadex.org/title/0aea9f43-d4a9-4bf7-bebc-550a512f9b95/shikimori-s-not-just-a-cutie -c 1`
**General:**
- `MDLP_HOOK_TYPE` -> manga_pre / manga_post / chapter_pre / chapter_post
- `MDLP_STATUS` -> starting / success / error / none
- `MDLP_REASON` -> none or the reason of the status
**Manga hooks:**
- `MDLP_API` -> Mangadex
- `MDLP_MANGA_URL_UUID` -> https://mangadex.org/title/0aea9f43-d4a9-4bf7-bebc-550a512f9b95/shikimori-s-not-just-a-cutie
- `MDLP_MANGA_UUID` -> 0aea9f43-d4a9-4bf7-bebc-550a512f9b95
- `MDLP_MANGA_TITLE` -> Shikimori's Not Just a Cutie
- `MDLP_LANGUAGE` -> en
- `MDLP_TOTAL_CHAPTERS` -> 158
- `MDLP_CHAPTERS_TO_DOWNLOAD` -> ['1']
- `MDLP_FILE_FORMAT` -> .cbz
- `MDLP_FORCEVOL` -> False
- `MDLP_DOWNLOAD_PATH` -> downloads
- `MDLP_MANGA_PATH` -> downloads/Shikimori's Not Just a Cutie
**Chapter hooks (extends Manga hooks env variables):**
- `MDLP_CHAPTER_FILENAME` -> Ch. 1
- `MDLP_CHAPTER_PATH` -> downloads/Shikimori's Not Just a Cutie/Ch. 1
- `MDLP_CHAPTER_ARCHIVE_PATH` -> downloads/Shikimori's Not Just a Cutie/Ch. 1.cbz
- `MDLP_CHAPTER_UUID` -> b7cba066-0b45-4d88-be08-89240841b4f7
- `MDLP_CHAPTER_VOLUME` -> 1
- `MDLP_CHAPTER_NUMBER` -> 1
- `MDLP_CHAPTER_NAME` -> `empty string`
## Contribution / Bugs ## Contribution / Bugs
For suggestions for improvement, just open a pull request. For suggestions for improvement, just open a pull request.

20
docs/mkdocs.yml Normal file
View file

@ -0,0 +1,20 @@
site_name: manga-dlp
site_url: https://manga-dlp.ivn.sh/
site_description: docs for manga-dlp
site_author: Ivan Schaller
copyright: MIT
repo_url: https://github.com/olofvndrhr/manga-dlp/
repo_name: manga-dlp
docs_dir: pages
theme:
name: readthedocs
locale: en
nav:
- Home: index.md
- Download: download.md
- Hooks: hooks.md
- Docker: docker.md

147
docs/pages/docker.md Normal file
View file

@ -0,0 +1,147 @@
# Docker container of manga-dlp
## Quick start
> the pdf creation only works on amd64 images, as it unfortunately is incompatible with arm64.
```sh
# with docker-compose
curl -O docker-compose.yml https://raw.githubusercontent.com/olofvndrhr/manga-dlp/master/docker/docker-compose.yml
# adjust settings to your needs
docker-compose up -d
# with docker run
docker run -v ./downloads:/app/downloads -v ./mangas.txt:/app/mangas.txt olofvndrhr/manga-dlp
```
## Change UID/GID
> The default UID and GID are 4444.
You can change the UID and GID of the container user simply with:
```yml
# docker-compose.yml
environment:
- PUID=<userid>
- PGID=<groupid>
```
```sh
docker run -e PUID=<userid> -e PGID=<groupid>
```
## Environment variables
You can configure the default schedule via environment variables. Don't forget to set `MDLP_GENERATE_SCHEDULE` to "true"
, else
it will not generate it (it will just use the default one).
For more info's about the options, you can look in the main scripts [README.md](../README.md)
| ENV Variable | Default | manga-dlp option | Info |
|:-----------------------|:----------------|:-------------------------|--------------------------------------------------------------------------|
| MDLP_GENERATE_SCHEDULE | false | none | Has to be set to "true" to generate the config via environment variables |
| MDLP_PATH | /app/downloads | --path | |
| MDLP_READ | /app/mangas.txt | --read | |
| MDLP_LANGUAGE | en | --language | |
| MDLP_CHAPTERS | all | --chapter | |
| MDLP_FILE_FORMAT | cbz | --format | |
| MDLP_WAIT | 0.5 | --wait | |
| MDLP_FORCEVOL | false | --forcevol | |
| MDLP_LOG_LEVEL | lean | --lean/--verbose/--debug | Can either be set to: "lean", "verbose" or "debug" |
## Run commands in container
> You don't need to use the full path of manga-dlp.py because `/app` already is the working directory
You can simply use the `docker exec` command to run the scripts like normal.
```sh
docker exec <container name> python3 manga-dlp.py <options>
```
## Run your own schedule
The default config runs `manga-dlp.py` once a day at 12:00 and fetches every chapter of the mangas listed in the file
`mangas.txt` in the root directory of this repo.
#### Default schedule
```sh
#!/bin/bash
python3 /app/manga-dlp.py \
--path /app/downloads \
--read /app/mangas.txt \
--chapters all \
--wait 2 \
--lean
```
To use your own schedule you need to mount (override) the default schedule or add new ones to the crontab.
> Don't forget to add the cron entries for every new schedule
```yml
# docker-compose.yml
volumes:
- ./crontab:/etc/cron.d/mangadlp # overwrites the default crontab
- ./crontab2:/etc/cron.d/something # adds a new one crontab file
- ./schedule1.sh:/app/schedules/daily.sh # overwrites the default schedule
- ./schedule2.sh:/app/schedules/weekly.sh # adds a new schedule
```
```sh
docker run -v ./crontab:/etc/cron.d/mangadlp # overwrites the default crontab
docker run -v ./crontab2:/etc/cron.d/something # adds a new one crontab file
docker run -v ./schedule1.sh:/app/schedules/daily.sh # overwrites the default schedule
docker run -v ./schedule2.sh:/app/schedules/weekly.sh # adds a new schedule
```
#### Default crontab file
```sh
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# default crontab to run manga-dlp once a day
# and get all (new) chapters of the mangas in
# the file mangas.txt
# "/proc/1/fd/1 2>&1" is to show the logs in the container
# "s6-setuidgid abc" is used to set the permissions
0 12 * * * root s6-setuidgid abc /app/schedules/daily.sh > /proc/1/fd/1 2>&1
```
## Add mangas to mangas.txt
If you use the default crontab you still need to add some mangas to mangas.txt. This is done almost identical to adding
your own cron schedule. If you use a custom cron schedule you need to mount the file you specified with `--read`.
```yml
# docker-compose.yml
volumes:
- ./mangas.txt:/app/mangas.txt
```
```sh
docker run -v ./mangas.txt:/app/mangas.txt
```
## Change download directory
Per default as in the script, it downloads everything to "downloads" in the scripts root directory. This data does not
persist with container recreation, so you need to mount it. This is already done in the quick start section. If you want
to change the path of the host, simply change `./downloads/` to a path of your choice.
```yml
# docker-compose.yml
volumes:
- ./downloads/:/app/downloads
```
```sh
docker run -v ./downloads/:/app/downloads
```

114
docs/pages/download.md Normal file
View file

@ -0,0 +1,114 @@
# Download mangas
## File-structure
```txt
.
└── <download path>/
└── <manga title>/
└── <chapter title>/
```
**Example:**
```txt
./downloads/mangatitle/chaptertitle(.cbz)
```
## Select chapters to download
> With the option `-c "all"` you download every chapter available in the selected language
To download specific chapters you can use the option `-c` or `--chapters`. That you don't have to specify all chapters
individually, the script has some logic to fill in the blanks.
Examples:
```sh
# if you want to download chapters 1 to 5
python3 manga-dlp -u <url> -c 1-5
# if you want to download chapters 1 and 5
python3 manga-dlp -u <url> -c 1,5
```
If you use `--forcevol` it's the same, just with the volume number
```sh
# if you want to download chapters 1:1 to 1:5
python3 manga-dlp -u <url> -c 1:1-1:5
# if you want to download chapters 1:1 and 1:5
python3 manga-dlp -u <url> -c 1:1,1:5
# to download the whole volume 1
python3 manga-dlp -u <url> -c 1:
```
And a combination of all
```sh
# if you want to download chapters 1 to 5 and 9
python3 manga-dlp -u <url> -c 1-5,9
# with --forcevol
# if you want to download chapters 1:1 to 1:5 and 9, also the whole volume 4
python3 manga-dlp -u <url> -c 1:1-1:5,1:9,4:
```
## Set download path
With the option `-p/--path` you can specify a path to download the chapters to. The default path
is `<script_dir>/downloads`. Absolute and relative paths are supported.
**Example:**
`python3 manga-dlp.py <other options> --path /media/mangas`
This will save all mangas/chapters in the path `/media/mangas/<manga title>/<chapter name>`
## Set output format
> `--format` currently only works with `""`, `"pdf"`, `"zip"`, `"rar"` and `"cbz"`.
> As it just renames the zip file with the new
> suffix (except pdf).
You can specify the output format of the manga images with the `--format` option.
The default is set to `.cbz`, so if no format is given it falls back to `<manga-name>/<chapter_name>.cbz`
For pdf creation you have to install [img2pdf](https://pypi.org/project/img2pdf/).
With the amd64 docker image it is already installed
see more in the Docker [README.md](docker/README.md).
**Supported format options:**
* cbz - `--format "cbz"` or `--format ".cbz"` **- default**
* cbr - `--format "cbr"` or `--format ".cbr"`
* zip - `--format "zip"` or `--format ".zip"`
* pdf - `--format "pdf"` or `--format ".pdf"`
* _none_ - `--format ""` - this saves the images just in a folder
**Example:**
`python3 manga-dlp.py <other options> --format "zip"`
This will download the chapter and save it as a zip archive.
## Read links from a file
With the option `--read` you can specify a file with links to multiple mangas. They will be parsed from top to bottom
one at a time. Every link will be matched for the right api to use. It is important that you only have one link per
line, otherwise they can't be parsed.
**Example:**
```txt
# mangas.txt
link1
link2
link3
```
`python3 manga-dlp.py --read mangas.txt --list`
This will list all available chapters for link1, link2 and link3.

74
docs/pages/hooks.md Normal file
View file

@ -0,0 +1,74 @@
# Hooks
## Available hooks
You can run custom hooks with manga-dlp for specific events.
They are run with the `subproccess.call` function, so they get run directly by your operating system.
The available hook events are:
- **Pre Manga** -> Before anything gets downloaded
- **Pre Chapter** -> Before the chapter gets downloaded
- **Post Manga** -> After the manga is done. (All specified chapters were downloaded)
- **Post Chapter** -> After each chapter was downloaded (and formatted if specified)
Each of these hooks can be set with a specific flag:
- `--hook-pre-manga` -> Pre Manga hook
- `--hook-pre-chapter` -> Pre Chapter hook
- `--hook-post-manga` -> Post Manga hook
- `--hook-post-chapter` -> Post Chapter hook
**Example:**
```sh
manga-dlp -u <some url> -c 1 --hook-post-manga <some command>
# echo "abc" to stdout
manga-dlp -u <some url> -c 1 --hook-post-manga "echo abc"
# echo the manga name to stdout
manga-dlp -u <some url> -c 1 --hook-post-manga "echo ${MDLP_MANGA_TITLE}"
```
## Env Variables
All hooks are exposed to a variety of environment variables with infos about the manga/chapter currently downloading.
All available env variables are listed below with the example
for [this](https://mangadex.org/title/0aea9f43-d4a9-4bf7-bebc-550a512f9b95/shikimori-s-not-just-a-cutie) manga:
> Command
>
used: `python3 manga-dlp.py -u https://mangadex.org/title/0aea9f43-d4a9-4bf7-bebc-550a512f9b95/shikimori-s-not-just-a-cutie -c 1`
**General:**
- `MDLP_HOOK_TYPE` -> manga_pre / manga_post / chapter_pre / chapter_post
- `MDLP_STATUS` -> starting / success / error / none
- `MDLP_REASON` -> none or the reason of the status
**Manga hooks:**
- `MDLP_API` -> Mangadex
- `MDLP_MANGA_URL_UUID` -> https://mangadex.org/title/0aea9f43-d4a9-4bf7-bebc-550a512f9b95/shikimori-s-not-just-a-cutie
- `MDLP_MANGA_UUID` -> 0aea9f43-d4a9-4bf7-bebc-550a512f9b95
- `MDLP_MANGA_TITLE` -> Shikimori's Not Just a Cutie
- `MDLP_LANGUAGE` -> en
- `MDLP_TOTAL_CHAPTERS` -> 158
- `MDLP_CHAPTERS_TO_DOWNLOAD` -> ['1']
- `MDLP_FILE_FORMAT` -> .cbz
- `MDLP_FORCEVOL` -> False
- `MDLP_DOWNLOAD_PATH` -> downloads
- `MDLP_MANGA_PATH` -> downloads/Shikimori's Not Just a Cutie
**Chapter hooks (extends Manga hooks env variables):**
- `MDLP_CHAPTER_FILENAME` -> Ch. 1
- `MDLP_CHAPTER_PATH` -> downloads/Shikimori's Not Just a Cutie/Ch. 1
- `MDLP_CHAPTER_ARCHIVE_PATH` -> downloads/Shikimori's Not Just a Cutie/Ch. 1.cbz
- `MDLP_CHAPTER_UUID` -> b7cba066-0b45-4d88-be08-89240841b4f7
- `MDLP_CHAPTER_VOLUME` -> 1
- `MDLP_CHAPTER_NUMBER` -> 1
- `MDLP_CHAPTER_NAME` -> `empty string`

136
docs/pages/index.md Normal file
View file

@ -0,0 +1,136 @@
# manga-dlp - python script to download mangas
CI/CD
[![status-badge](https://img.shields.io/drone/build/olofvndrhr/manga-dlp?label=tests&server=https%3A%2F%2Fci.44net.ch)](https://ci.44net.ch/olofvndrhr/manga-dlp)
[![Last Release](https://img.shields.io/github/release-date/olofvndrhr/manga-DLP?label=last%20release)](https://github.com/olofvndrhr/manga-dlp/releases)
[![Version](https://img.shields.io/github/v/release/olofvndrhr/manga-dlp?label=git%20release)](https://github.com/olofvndrhr/manga-dlp/releases)
[![Version PyPi](https://img.shields.io/pypi/v/manga-dlp?label=pypi%20release)](https://pypi.org/project/manga-dlp/)
Code Analysis
[![Quality Gate Status](https://sonarqube.44net.ch/api/project_badges/measure?project=olofvndrhr%3Amanga-dlp&metric=alert_status&token=f9558470580eea5b4899cf33f190eee16011346d)](https://sonarqube.44net.ch/dashboard?id=olofvndrhr%3Amanga-dlp)
[![Coverage](https://sonarqube.44net.ch/api/project_badges/measure?project=olofvndrhr%3Amanga-dlp&metric=coverage&token=f9558470580eea5b4899cf33f190eee16011346d)](https://sonarqube.44net.ch/dashboard?id=olofvndrhr%3Amanga-dlp)
[![Bugs](https://sonarqube.44net.ch/api/project_badges/measure?project=olofvndrhr%3Amanga-dlp&metric=bugs&token=f9558470580eea5b4899cf33f190eee16011346d)](https://sonarqube.44net.ch/dashboard?id=olofvndrhr%3Amanga-dlp)
[![Security](https://img.shields.io/snyk/vulnerabilities/github/olofvndrhr/manga-dlp)](https://app.snyk.io/org/olofvndrhr-t6h/project/aae9609d-a4e4-41f8-b1ac-f2561b2ad4e3)
Meta
[![Code style](https://img.shields.io/badge/code%20style-black-black)](https://github.com/psf/black)
[![Linter](https://img.shields.io/badge/linter-pylint-yellowgreen)](https://pylint.pycqa.org/en/latest/)
[![Types](https://img.shields.io/badge/types-mypy-blue)](https://github.com/python/mypy)
[![Imports](https://img.shields.io/badge/imports-isort-ef8336.svg)](https://github.com/pycqa/isort)
[![Tests](https://img.shields.io/badge/tests-pytest%20%7C%20tox-yellow)](https://github.com/pytest-dev/pytest/)
[![Coverage](https://img.shields.io/badge/coverage-coveragepy-green)](https://github.com/nedbat/coveragepy)
[![License](https://img.shields.io/badge/license-MIT-9400d3.svg)](https://snyk.io/learn/what-is-mit-license/)
[![Compatibility](https://img.shields.io/pypi/pyversions/manga-dlp)](https://pypi.org/project/manga-dlp/)
---
## Description
A manga download script written in python. It only supports [mangadex.org](https://mangadex.org/) for now. But support
for other sites is planned.
Before downloading a new chapter, the script always checks if there is already a chapter with the same name in the
download directory. If found the chapter is skipped. So you can run the script on a schedule to only download new
chapters without any additional setup.
The default behaiviour is to pack the images to a [cbz archive](https://en.wikipedia.org/wiki/Comic_book_archive). If
you just want the folder with all the pictures use the flag `--nocbz`.
## _Currently_ Supported sites
- [Mangadex.org](https://mangadex.org/)
## Usage
### Quick start
```sh
python3 manga-dlp.py \
--url https://mangadex.org/title/a96676e5-8ae2-425e-b549-7f15dd34a6d8/komi-san-wa-komyushou-desu \
--language "en" \
--chapters "all"
```
### With GitHub
```sh
git clone https://github.com/olofvndrhr/manga-dlp.git # clone the repository
cd manga-dlp # go in the directory
pip install -r requirements.txt # install required packages
# on windows
python manga-dlp.py <options>
# on unix
python3 manga-dlp.py <options>
```
### With pip ([pypi](https://pypi.org/project/manga-dlp/))
```sh
python3 -m pip install manga-dlp # download the package from pypi
python3 -m mangadlp <args> # start the script as a module
OR
manga-dlp <args> # call script directly
OR
mangadlp <args> # call script directly
```
### With docker
See the docker [README](https://manga-dlp.ivn.sh/docker/)
## Options
```txt
usage: manga-dlp.py [-h] (-u URL_UUID | --read READ | -v) [-c CHAPTERS] [-p PATH] [-l LANG] [--list] [--format FORMAT] [--forcevol] [--wait WAIT] [--lean | --verbose | --debug] [--hook-manga-pre HOOK_MANGA_PRE]
[--hook-manga-post HOOK_MANGA_POST] [--hook-chapter-pre HOOK_CHAPTER_PRE] [--hook-chapter-post HOOK_CHAPTER_POST]
Script to download mangas from various sites
optional arguments:
-h, --help show this help message and exit
-u URL_UUID, --url URL_UUID, --uuid URL_UUID URL or UUID of the manga
--read READ Path of file with manga links to download. One per line
-v, --version Show version of manga-dlp and exit
-c CHAPTERS, --chapters CHAPTERS Chapters to download
-p PATH, --path PATH Download path. Defaults to "<script_dir>/downloads"
-l LANG, --language LANG Manga language. Defaults to "en" --> english
--list List all available chapters. Defaults to false
--format FORMAT Archive format to create. An empty string means dont archive the folder. Defaults to 'cbz'
--forcevol Force naming of volumes. For mangas where chapters reset each volume
--wait WAIT Time to wait for each picture to download in seconds(float). Defaults 0.5
--lean Lean logging. Minimal log output. Defaults to false
--verbose Verbose logging. More log output. Defaults to false
--debug Debug logging. Most log output. Defaults to false
--hook-manga-pre HOOK_MANGA_PRE Commands to execute before the manga download starts
--hook-manga-post HOOK_MANGA_POST Commands to execute after the manga download finished
--hook-chapter-pre HOOK_CHAPTER_PRE Commands to execute before the chapter download starts
--hook-chapter-post HOOK_CHAPTER_POST Commands to execute after the chapter download finished
```
## Contribution / Bugs
For suggestions for improvement, just open a pull request.
If you want to add support for a new site, there is an api [template file](./contrib/api_template.py) which you can use.
And more infos and tools in the contrib [README.md](contrib/README.md)
Otherwise, you can open am issue with the name of the site which you want support for. (not guaranteed to be
implemented)
If you encounter any bugs, also just open an issue with a description of the problem.
## TODO's
- <del>Make docker container for easy distribution</del>
--> [Dockerhub](https://hub.docker.com/repository/docker/olofvndrhr/manga-dlp)
- <del>Automate release</del>
--> Done with woodpecker-ci
- <del>Make pypi package</del>
--> Done with release [2.1.7](https://pypi.org/project/manga-dlp/)
- Add more supported sites