Skip to content

Commit

Permalink
[2.1.4] - 2022-05-29
Browse files Browse the repository at this point in the history
  • Loading branch information
olofvndrhr committed May 29, 2022
2 parents 6fde304 + c520992 commit 95ed20d
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 22 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

- Add support for more sites

## [2.1.4] - 2022-05-29

### Fixed

- Docker container now works again
- Fixed cron in docker container

### Changed

- Docker container scheduling is now more practical

## [2.1.3] - 2022-05-29

### Fixed
Expand Down
3 changes: 1 addition & 2 deletions docker/Dockerfile.amd64
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LABEL build_version="Version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="Ivan Schaller"

# manga-dlp version
ENV MDLP_VERSION=2.1.3
ENV MDLP_VERSION=2.1.4

# install packages
RUN \
Expand All @@ -28,7 +28,6 @@ RUN \
/var/tmp/*


# copy files to container
# copy files to container
COPY docker/rootfs /
COPY mangadlp/ /app/mangadlp/
Expand Down
3 changes: 1 addition & 2 deletions docker/Dockerfile.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LABEL build_version="Version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="Ivan Schaller"

# manga-dlp version
ENV MDLP_VERSION=2.1.3
ENV MDLP_VERSION=2.1.4

# install packages
RUN \
Expand All @@ -28,7 +28,6 @@ RUN \
/var/tmp/*


# copy files to container
# copy files to container
COPY docker/rootfs /
COPY mangadlp/ /app/mangadlp/
Expand Down
55 changes: 45 additions & 10 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ docker run -e PUID=<userid> -e PGID=<groupid>

## 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
Expand All @@ -41,21 +43,54 @@ docker exec <container name> python3 manga-dlp.py <options>

## Run your own schedule

The default config runs manga-dlp.py once a day at 03:00 and fetches every chapter of the mangas listed in the file
mangas.txt in the root directory of this repo.
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.

#### The default schedule:

```sh
#!/bin/bash

python3 /app/manga-dlp.py \
--path /app/downloads \
--read /app/mangas.txt \
--chapters all \
--wait 2
```

To use your own schedule you need to mount (override) the default schedule or add new ones to the crontab.

To use your own schedule you need to mount (override) the default crontab or add new ones to the cron directory.
> Don't forget to add the cron entries for every new schedule
```yml
# docker-compose.yml
volumes:
- ./crontab:/etc/cron.d/01_manga-dlp # overwrites the default one
- ./crontab2:/etc/cron.d/02_something # adds a new one
- ./crontab:/etc/cron.d/mangadlp # overwrites the default crontab
- ./crontab2:/etc/cron.d/something # adds a new one crontab file
- ./schedule1:/app/schedules/daily # overwrites the default schedule
- ./schedule2:/app/schedules/weekly # adds a new schedule
```
```sh
docker run -v ./crontab:/etc/cron.d/01_manga-dlp # overwrites the default one
docker run -v ./crontab2:/etc/cron.d/02_something # adds a new one
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:/app/schedules/daily # overwrites the default schedule
docker run -v ./schedule2:/app/schedules/weekly # adds a new schedule
```

#### The 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 > /proc/1/fd/1 2>&1
```

## Add mangas to mangas.txt
Expand All @@ -77,15 +112,15 @@ docker run -v ./mangas.txt:/app/mangas.txt

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 `./media/mangas/` to a path of your choice.
to change the path of the host, simply change `./downloads/` to a path of your choice.

```yml
# docker-compose.yml
volumes:
- ./media/mangas/:/app/downloads
- ./downloads/:/app/downloads
```
```sh
docker run -v ./media/mangas/:/app/downloads
docker run -v ./downloads/:/app/downloads
```

2 changes: 2 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ services:
volumes:
- ./downloads/:/app/downloads/ # default manga download directory
- ./mangas.txt:/app/mangas.txt # default file for manga links to download
#- ./crontab:/etc/cron.d/mangadlp # path to default crontab
#- ./schedule:/app/schedules/daily # path to the default schedule which is run daily
environment:
- TZ=Europe/Zurich
# - PUID= # custom userid - defaults to 4444
Expand Down
7 changes: 7 additions & 0 deletions docker/rootfs/app/schedules/daily
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

python3 /app/manga-dlp.py \
--path /app/downloads \
--read /app/mangas.txt \
--chapters all \
--wait 2
3 changes: 3 additions & 0 deletions docker/rootfs/etc/cont-init.d/80-fix-perms
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ find '/app' -type 'f' \( -not -perm 664 -and -not -path '/app/downloads*' \) -ex

find '/app' \( -not -user abc -and -not -path '/app/downloads*' \) -exec chown abc '{}' \+
find '/app' \( -not -group abc -and -not -path '/app/downloads*' \) -exec chown :abc '{}' \+

# fix schedules
chmod -R +x /app/schedules
5 changes: 0 additions & 5 deletions docker/rootfs/etc/cron.d/01-manga-dlp

This file was deleted.

11 changes: 11 additions & 0 deletions docker/rootfs/etc/cron.d/mangadlp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
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 > /proc/1/fd/1 2>&1

2 changes: 1 addition & 1 deletion manga-dlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from mangadlp.input import get_args

mangadlp_version = "2.1.3"
mangadlp_version = "2.1.4"


def get_input():
Expand Down
2 changes: 1 addition & 1 deletion mangadlp/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import mangadlp.app as app

mangadlp_version = "2.1.3"
mangadlp_version = "2.1.4"


def check_args(args):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setuptools.setup(
name="manga-dlp",
version="2.1.3",
version="2.1.4",
author="Ivan Schaller",
author_email="[email protected]",
description="A cli manga downloader",
Expand Down

0 comments on commit 95ed20d

Please sign in to comment.