Compare commits
No commits in common. "master" and "2.3.1" have entirely different histories.
58 changed files with 1272 additions and 1125 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
use asdf
|
|
@ -1,99 +0,0 @@
|
||||||
name: build package and container
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- "v*.*.*"
|
|
||||||
|
|
||||||
pull_request:
|
|
||||||
branches: [main, master]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-pypackage:
|
|
||||||
runs-on: python311
|
|
||||||
env:
|
|
||||||
HATCH_INDEX_REPO: main
|
|
||||||
HATCH_INDEX_USER: __token__
|
|
||||||
HATCH_INDEX_AUTH: ${{ secrets.PYPI_TOKEN }}
|
|
||||||
steps:
|
|
||||||
- name: checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: install hatch
|
|
||||||
run: pip install -U hatch hatchling
|
|
||||||
|
|
||||||
- name: build package
|
|
||||||
run: hatch build --clean
|
|
||||||
|
|
||||||
- name: publish package
|
|
||||||
if: gitea.event_name != 'pull_request'
|
|
||||||
run: hatch publish --yes --no-prompt
|
|
||||||
|
|
||||||
build-container:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
REGISTRY: docker.io
|
|
||||||
AUTHOR: olofvndrhr
|
|
||||||
IMAGE: manga-dlp
|
|
||||||
steps:
|
|
||||||
- name: checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: setup qemu
|
|
||||||
uses: docker/setup-qemu-action@v2
|
|
||||||
|
|
||||||
- name: setup docker buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
|
|
||||||
- name: get container metadata
|
|
||||||
uses: docker/metadata-action@v4
|
|
||||||
id: metadata
|
|
||||||
with:
|
|
||||||
images: ${{ env.REGISTRY }}/${{ env.AUTHOR }}/${{ env.IMAGE }}
|
|
||||||
flavor: |
|
|
||||||
latest=auto
|
|
||||||
prefix=
|
|
||||||
suffix=
|
|
||||||
tags: |
|
|
||||||
type=schedule
|
|
||||||
type=ref,event=branch
|
|
||||||
type=ref,event=pr
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
type=semver,pattern={{major}}
|
|
||||||
type=sha
|
|
||||||
|
|
||||||
- name: login to docker.io container registry
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ secrets.CR_USERNAME }}
|
|
||||||
password: ${{ secrets.CR_PASSWORD }}
|
|
||||||
|
|
||||||
- name: login to private container registry
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
registry: git.44net.ch
|
|
||||||
username: ${{ secrets.CR_PRIV_USERNAME }}
|
|
||||||
password: ${{ secrets.CR_PRIV_PASSWORD }}
|
|
||||||
|
|
||||||
- name: build and push docker image @amd64+arm64
|
|
||||||
uses: docker/build-push-action@v4
|
|
||||||
with:
|
|
||||||
push: ${{ gitea.event_name != 'pull_request' }}
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
context: .
|
|
||||||
file: docker/Dockerfile
|
|
||||||
provenance: false
|
|
||||||
tags: ${{ steps.metadata.outputs.tags }}
|
|
||||||
labels: ${{ steps.metadata.outputs.labels }}
|
|
||||||
|
|
||||||
- name: update dockerhub repo description
|
|
||||||
uses: peter-evans/dockerhub-description@v3
|
|
||||||
if: gitea.event_name != 'pull_request'
|
|
||||||
with:
|
|
||||||
repository: ${{ env.AUTHOR }}/${{ env.IMAGE }}
|
|
||||||
short-description: ${{ github.event.repository.description }}
|
|
||||||
enable-url-completion: true
|
|
||||||
username: ${{ secrets.CR_USERNAME }}
|
|
||||||
password: ${{ secrets.CR_PASSWORD }}
|
|
|
@ -1,122 +0,0 @@
|
||||||
name: check code
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main, master]
|
|
||||||
|
|
||||||
pull_request:
|
|
||||||
branches: [main, master]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check-docs:
|
|
||||||
runs-on: python311
|
|
||||||
steps:
|
|
||||||
- name: checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: "build docs"
|
|
||||||
run: |
|
|
||||||
python3 -m pip install mkdocs
|
|
||||||
cd docs || exit 1
|
|
||||||
mkdocs build --strict
|
|
||||||
|
|
||||||
scan-code-py311:
|
|
||||||
runs-on: python311
|
|
||||||
if: gitea.event_name != 'pull_request'
|
|
||||||
needs: [check-code-py38]
|
|
||||||
steps:
|
|
||||||
- name: checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: install hatch
|
|
||||||
run: pip install -U hatch
|
|
||||||
|
|
||||||
- name: get coverage (hatch)
|
|
||||||
run: hatch run default:cov
|
|
||||||
|
|
||||||
- name: run sonar-scanner
|
|
||||||
uses: sonarsource/sonarqube-scan-action@v2.1.0
|
|
||||||
env:
|
|
||||||
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }}
|
|
||||||
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
|
|
||||||
|
|
||||||
check-code-py38:
|
|
||||||
runs-on: python38
|
|
||||||
steps:
|
|
||||||
- name: checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: install hatch
|
|
||||||
run: pip install -U hatch
|
|
||||||
|
|
||||||
- name: test codestyle
|
|
||||||
run: hatch run +py=3.8 lint:style
|
|
||||||
|
|
||||||
- name: test typing
|
|
||||||
run: hatch run +py=3.8 lint:typing
|
|
||||||
|
|
||||||
- name: run tests
|
|
||||||
if: gitea.event_name == 'pull_request'
|
|
||||||
run: hatch run default:test
|
|
||||||
|
|
||||||
check-code-py39:
|
|
||||||
runs-on: python39
|
|
||||||
needs: [check-code-py38]
|
|
||||||
steps:
|
|
||||||
- name: checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: install hatch
|
|
||||||
run: pip install -U hatch
|
|
||||||
|
|
||||||
- name: test codestyle
|
|
||||||
run: hatch run +py=3.9 lint:style
|
|
||||||
|
|
||||||
- name: test typing
|
|
||||||
run: hatch run +py=3.9 lint:typing
|
|
||||||
|
|
||||||
- name: run tests
|
|
||||||
if: gitea.event_name == 'pull_request'
|
|
||||||
run: hatch run default:test
|
|
||||||
|
|
||||||
check-code-py310:
|
|
||||||
runs-on: python310
|
|
||||||
needs: [check-code-py39]
|
|
||||||
steps:
|
|
||||||
- name: checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: install hatch
|
|
||||||
run: pip install -U hatch
|
|
||||||
|
|
||||||
- name: test codestyle
|
|
||||||
run: hatch run +py=3.10 lint:style
|
|
||||||
|
|
||||||
- name: test typing
|
|
||||||
run: hatch run +py=3.10 lint:typing
|
|
||||||
|
|
||||||
- name: run tests
|
|
||||||
if: gitea.event_name == 'pull_request'
|
|
||||||
run: hatch run default:test
|
|
||||||
|
|
||||||
check-code-py311:
|
|
||||||
runs-on: python311
|
|
||||||
needs: [check-code-py310]
|
|
||||||
steps:
|
|
||||||
- name: checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: install hatch
|
|
||||||
run: pip install -U hatch
|
|
||||||
|
|
||||||
- name: test codestyle
|
|
||||||
run: hatch run +py=3.11 lint:style
|
|
||||||
|
|
||||||
- name: test typing
|
|
||||||
run: hatch run +py=3.11 lint:typing
|
|
||||||
|
|
||||||
- name: run tests
|
|
||||||
if: gitea.event_name == 'pull_request'
|
|
||||||
run: hatch run default:test
|
|
|
@ -1,56 +0,0 @@
|
||||||
name: create release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- "v*.*.*"
|
|
||||||
|
|
||||||
pull_request:
|
|
||||||
branches: [main, master]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release-pypackage:
|
|
||||||
runs-on: python311
|
|
||||||
env:
|
|
||||||
HATCH_INDEX_REPO: main
|
|
||||||
HATCH_INDEX_USER: __token__
|
|
||||||
HATCH_INDEX_AUTH: ${{ secrets.PYPI_TOKEN }}
|
|
||||||
steps:
|
|
||||||
- name: checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: setup go
|
|
||||||
uses: actions/setup-go@v4
|
|
||||||
with:
|
|
||||||
go-version: '>=1.20'
|
|
||||||
|
|
||||||
- name: install hatch
|
|
||||||
run: pip install -U hatch hatchling
|
|
||||||
|
|
||||||
- name: build package
|
|
||||||
run: hatch build --clean
|
|
||||||
|
|
||||||
- name: get release notes
|
|
||||||
id: release-notes
|
|
||||||
uses: olofvndrhr/releasenote-gen@v1
|
|
||||||
|
|
||||||
- name: create gitea release
|
|
||||||
uses: https://gitea.com/actions/release-action@main
|
|
||||||
if: gitea.event_name != 'pull_request'
|
|
||||||
with:
|
|
||||||
title: ${{ gitea.ref_name }}
|
|
||||||
body: ${{ steps.release-notes.outputs.releasenotes }}
|
|
||||||
files: |-
|
|
||||||
dist/**
|
|
||||||
|
|
||||||
- name: create github release
|
|
||||||
uses: ncipollo/release-action@v1
|
|
||||||
if: gitea.event_name != 'pull_request'
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GH_TOKEN }}
|
|
||||||
owner: olofvndrhr
|
|
||||||
repo: manga-dlp
|
|
||||||
name: ${{ gitea.ref_name }}
|
|
||||||
body: ${{ steps.release-notes.outputs.releasenotes }}
|
|
||||||
artifacts: |-
|
|
||||||
dist/**
|
|
|
@ -1,18 +0,0 @@
|
||||||
name: run scheduled tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: "0 20 * * 6"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check-code-py311:
|
|
||||||
runs-on: python311
|
|
||||||
steps:
|
|
||||||
- name: checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: install hatch
|
|
||||||
run: pip install -U hatch
|
|
||||||
|
|
||||||
- name: run tests
|
|
||||||
run: hatch run default:test
|
|
|
@ -1,4 +1,5 @@
|
||||||
shellcheck 0.10.0
|
python 3.9.13 3.10.5 3.8.13
|
||||||
shfmt 3.8.0
|
shellcheck 0.9.0
|
||||||
just 1.25.2
|
shfmt 3.6.0
|
||||||
lefthook 1.4.6
|
direnv 2.32.2
|
||||||
|
just 1.13.0
|
36
.woodpecker/publish_docker_amd64.yml
Normal file
36
.woodpecker/publish_docker_amd64.yml
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
#########################################
|
||||||
|
# build and publish docker images amd64 #
|
||||||
|
#########################################
|
||||||
|
# branch: master
|
||||||
|
# event: tag
|
||||||
|
|
||||||
|
platform: linux/amd64
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- tests
|
||||||
|
|
||||||
|
clone:
|
||||||
|
git:
|
||||||
|
image: woodpeckerci/plugin-git:v1.6.0
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
|
||||||
|
pipeline:
|
||||||
|
|
||||||
|
# build and publish docker image for amd64 - x86
|
||||||
|
build-amd64:
|
||||||
|
image: plugins/docker
|
||||||
|
pull: true
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
settings:
|
||||||
|
repo: olofvndrhr/manga-dlp
|
||||||
|
platforms: linux/amd64
|
||||||
|
dockerfile: docker/Dockerfile.amd64
|
||||||
|
auto_tag: true
|
||||||
|
auto_tag_suffix: linux-amd64
|
||||||
|
build_args: BUILD_VERSION=${CI_COMMIT_TAG}
|
||||||
|
username:
|
||||||
|
from_secret: cr-dhub-username
|
||||||
|
password:
|
||||||
|
from_secret: cr-dhub-key
|
36
.woodpecker/publish_docker_arm64.yml
Normal file
36
.woodpecker/publish_docker_arm64.yml
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
#########################################
|
||||||
|
# build and publish docker images arm64 #
|
||||||
|
#########################################
|
||||||
|
# branch: master
|
||||||
|
# event: tag
|
||||||
|
|
||||||
|
platform: linux/arm64
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- tests
|
||||||
|
|
||||||
|
clone:
|
||||||
|
git:
|
||||||
|
image: woodpeckerci/plugin-git:v1.6.0
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
|
||||||
|
pipeline:
|
||||||
|
|
||||||
|
# build and publish docker image for arm64
|
||||||
|
build-arm64:
|
||||||
|
image: plugins/docker
|
||||||
|
pull: true
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
settings:
|
||||||
|
repo: olofvndrhr/manga-dlp
|
||||||
|
platforms: linux/arm64
|
||||||
|
dockerfile: docker/Dockerfile.arm64
|
||||||
|
auto_tag: true
|
||||||
|
auto_tag_suffix: linux-arm64
|
||||||
|
build_args: BUILD_VERSION=${CI_COMMIT_TAG}
|
||||||
|
username:
|
||||||
|
from_secret: cr-dhub-username
|
||||||
|
password:
|
||||||
|
from_secret: cr-dhub-key
|
36
.woodpecker/publish_docker_manifest.yml
Normal file
36
.woodpecker/publish_docker_manifest.yml
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
###########################
|
||||||
|
# publish docker manifest #
|
||||||
|
###########################
|
||||||
|
# branch: master
|
||||||
|
# event: tag
|
||||||
|
|
||||||
|
platform: linux/amd64
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- publish_docker_amd64
|
||||||
|
- publish_docker_arm64
|
||||||
|
|
||||||
|
clone:
|
||||||
|
git:
|
||||||
|
image: woodpeckerci/plugin-git:v1.6.0
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
tag: "*[!-dev]"
|
||||||
|
|
||||||
|
pipeline:
|
||||||
|
|
||||||
|
# publish docker manifest for automatic multi arch pulls
|
||||||
|
publish-manifest:
|
||||||
|
image: plugins/manifest
|
||||||
|
pull: true
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
tag: "*[!-dev]"
|
||||||
|
settings:
|
||||||
|
spec: docker/manifest.tmpl
|
||||||
|
auto_tag: true
|
||||||
|
ignore_missing: true
|
||||||
|
username:
|
||||||
|
from_secret: cr-dhub-username
|
||||||
|
password:
|
||||||
|
from_secret: cr-dhub-key
|
77
.woodpecker/publish_release.yml
Normal file
77
.woodpecker/publish_release.yml
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
###################
|
||||||
|
# publish release #
|
||||||
|
###################
|
||||||
|
# branch: master
|
||||||
|
# event: tag
|
||||||
|
|
||||||
|
platform: linux/amd64
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- tests
|
||||||
|
|
||||||
|
clone:
|
||||||
|
git:
|
||||||
|
image: woodpeckerci/plugin-git:v1.6.0
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
|
||||||
|
pipeline:
|
||||||
|
|
||||||
|
# build wheel and dist
|
||||||
|
build-pypi:
|
||||||
|
image: cr.44net.ch/ci-plugins/tests
|
||||||
|
pull: true
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
commands:
|
||||||
|
- python3 -m hatch build --clean
|
||||||
|
|
||||||
|
# create release-notes
|
||||||
|
create-release-notes:
|
||||||
|
image: cr.44net.ch/baseimages/debian-base
|
||||||
|
pull: true
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
commands:
|
||||||
|
- bash get_release_notes.sh ${CI_COMMIT_TAG%%-dev}
|
||||||
|
|
||||||
|
# publish release on github (github.com/olofvndrhr/manga-dlp)
|
||||||
|
publish-release-github:
|
||||||
|
image: woodpeckerci/plugin-github-release
|
||||||
|
pull: true
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
settings:
|
||||||
|
api_key:
|
||||||
|
from_secret: github-olofvndrhr-token
|
||||||
|
files: dist/*
|
||||||
|
title: ${CI_COMMIT_TAG}
|
||||||
|
note: RELEASENOTES.md
|
||||||
|
|
||||||
|
# publish release on gitea (git.44net.ch/olofvndrhr/manga-dlp)
|
||||||
|
publish-release-gitea:
|
||||||
|
image: woodpeckerci/plugin-gitea-release
|
||||||
|
pull: true
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
settings:
|
||||||
|
api_key:
|
||||||
|
from_secret: gitea-olofvndrhr-token
|
||||||
|
base_url: https://git.44net.ch
|
||||||
|
files: dist/*
|
||||||
|
title: ${CI_COMMIT_TAG}
|
||||||
|
note: RELEASENOTES.md
|
||||||
|
|
||||||
|
# release pypi
|
||||||
|
release-pypi:
|
||||||
|
image: cr.44net.ch/ci-plugins/tests
|
||||||
|
pull: true
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
secrets:
|
||||||
|
- source: pypi_username
|
||||||
|
target: HATCH_INDEX_USER
|
||||||
|
- source: pypi_token
|
||||||
|
target: HATCH_INDEX_AUTH
|
||||||
|
commands:
|
||||||
|
- python3 -m hatch publish --no-prompt --yes
|
35
.woodpecker/test_docker_amd64.yml
Normal file
35
.woodpecker/test_docker_amd64.yml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
##################################
|
||||||
|
# test build docker images amd64 #
|
||||||
|
##################################
|
||||||
|
# branch: master
|
||||||
|
# event: pull_request
|
||||||
|
|
||||||
|
platform: linux/amd64
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- tests
|
||||||
|
|
||||||
|
clone:
|
||||||
|
git:
|
||||||
|
image: woodpeckerci/plugin-git:v1.6.0
|
||||||
|
when:
|
||||||
|
branch: master
|
||||||
|
event: pull_request
|
||||||
|
|
||||||
|
pipeline:
|
||||||
|
|
||||||
|
# build docker image for amd64 - x86
|
||||||
|
test-build-amd64:
|
||||||
|
image: plugins/docker
|
||||||
|
pull: true
|
||||||
|
when:
|
||||||
|
branch: master
|
||||||
|
event: pull_request
|
||||||
|
settings:
|
||||||
|
dry_run: true
|
||||||
|
repo: olofvndrhr/manga-dlp
|
||||||
|
platforms: linux/amd64
|
||||||
|
dockerfile: docker/Dockerfile.amd64
|
||||||
|
auto_tag: true
|
||||||
|
auto_tag_suffix: linux-amd64-test
|
||||||
|
build_args: BUILD_VERSION=test
|
35
.woodpecker/test_docker_arm64.yml
Normal file
35
.woodpecker/test_docker_arm64.yml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
##################################
|
||||||
|
# test build docker images arm64 #
|
||||||
|
##################################
|
||||||
|
# branch: master
|
||||||
|
# event: pull_request
|
||||||
|
|
||||||
|
platform: linux/arm64
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- tests
|
||||||
|
|
||||||
|
clone:
|
||||||
|
git:
|
||||||
|
image: woodpeckerci/plugin-git:v1.6.0
|
||||||
|
when:
|
||||||
|
branch: master
|
||||||
|
event: pull_request
|
||||||
|
|
||||||
|
pipeline:
|
||||||
|
|
||||||
|
# build docker image for arm64
|
||||||
|
test-build-arm64:
|
||||||
|
image: plugins/docker
|
||||||
|
pull: true
|
||||||
|
when:
|
||||||
|
branch: master
|
||||||
|
event: pull_request
|
||||||
|
settings:
|
||||||
|
dry_run: true
|
||||||
|
repo: olofvndrhr/manga-dlp
|
||||||
|
platforms: linux/arm64
|
||||||
|
dockerfile: docker/Dockerfile.arm64
|
||||||
|
auto_tag: true
|
||||||
|
auto_tag_suffix: linux-arm64-test
|
||||||
|
build_args: BUILD_VERSION=test
|
40
.woodpecker/test_release.yml
Normal file
40
.woodpecker/test_release.yml
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
################
|
||||||
|
# test release #
|
||||||
|
################
|
||||||
|
# branch: master
|
||||||
|
# event: pull_request
|
||||||
|
|
||||||
|
platform: linux/amd64
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- tests
|
||||||
|
|
||||||
|
clone:
|
||||||
|
git:
|
||||||
|
image: woodpeckerci/plugin-git:v1.6.0
|
||||||
|
when:
|
||||||
|
branch: master
|
||||||
|
event: pull_request
|
||||||
|
|
||||||
|
pipeline:
|
||||||
|
|
||||||
|
# build wheel and dist
|
||||||
|
test-build-pypi:
|
||||||
|
image: cr.44net.ch/ci-plugins/tests
|
||||||
|
pull: true
|
||||||
|
when:
|
||||||
|
branch: master
|
||||||
|
event: pull_request
|
||||||
|
commands:
|
||||||
|
- just test_build
|
||||||
|
|
||||||
|
# create release-notes
|
||||||
|
test-create-release-notes:
|
||||||
|
image: cr.44net.ch/baseimages/debian-base
|
||||||
|
pull: true
|
||||||
|
when:
|
||||||
|
branch: master
|
||||||
|
event: pull_request
|
||||||
|
commands:
|
||||||
|
- bash get_release_notes.sh latest
|
||||||
|
- cat RELEASENOTES.md
|
29
.woodpecker/test_tox_amd64.yml
Normal file
29
.woodpecker/test_tox_amd64.yml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
##################
|
||||||
|
# test tox amd64 #
|
||||||
|
##################
|
||||||
|
# branch: master
|
||||||
|
# event: pull_request
|
||||||
|
|
||||||
|
platform: linux/amd64
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- tests
|
||||||
|
|
||||||
|
clone:
|
||||||
|
git:
|
||||||
|
image: woodpeckerci/plugin-git:v1.6.0
|
||||||
|
when:
|
||||||
|
branch: master
|
||||||
|
event: pull_request
|
||||||
|
|
||||||
|
pipeline:
|
||||||
|
|
||||||
|
# test code with different python versions - amd64
|
||||||
|
test-tox-amd64:
|
||||||
|
image: cr.44net.ch/ci-plugins/multipy
|
||||||
|
pull: true
|
||||||
|
when:
|
||||||
|
branch: master
|
||||||
|
event: pull_request
|
||||||
|
commands:
|
||||||
|
- just test_tox
|
32
.woodpecker/test_tox_arm64.yml
Normal file
32
.woodpecker/test_tox_arm64.yml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
##################
|
||||||
|
# test tox arm64 #
|
||||||
|
##################
|
||||||
|
# branch: master
|
||||||
|
# event: pull_request
|
||||||
|
|
||||||
|
platform: linux/arm64
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- tests
|
||||||
|
|
||||||
|
clone:
|
||||||
|
git:
|
||||||
|
image: woodpeckerci/plugin-git:v1.6.0
|
||||||
|
when:
|
||||||
|
branch: master
|
||||||
|
event: pull_request
|
||||||
|
|
||||||
|
pipeline:
|
||||||
|
|
||||||
|
# test code with different python versions - arm64
|
||||||
|
test-tox-arm64:
|
||||||
|
image: cr.44net.ch/ci-plugins/multipy
|
||||||
|
pull: true
|
||||||
|
when:
|
||||||
|
branch: master
|
||||||
|
event: pull_request
|
||||||
|
commands:
|
||||||
|
- grep -v img2pdf contrib/requirements_dev.txt > contrib/requirements_dev_arm64.txt
|
||||||
|
- rm -f contrib/requirements_dev.txt
|
||||||
|
- mv contrib/requirements_dev_arm64.txt contrib/requirements_dev.txt
|
||||||
|
- just test_tox
|
83
.woodpecker/tests.yml
Normal file
83
.woodpecker/tests.yml
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
##############################
|
||||||
|
# code testing and analysis #
|
||||||
|
#############################
|
||||||
|
# branch: all
|
||||||
|
# event: all
|
||||||
|
|
||||||
|
platform: linux/amd64
|
||||||
|
|
||||||
|
clone:
|
||||||
|
git:
|
||||||
|
image: woodpeckerci/plugin-git:v1.6.0
|
||||||
|
|
||||||
|
pipeline:
|
||||||
|
|
||||||
|
# check code style - shell
|
||||||
|
test-shfmt:
|
||||||
|
image: cr.44net.ch/ci-plugins/tests
|
||||||
|
pull: true
|
||||||
|
commands:
|
||||||
|
- just test_shfmt
|
||||||
|
|
||||||
|
# check code style - python
|
||||||
|
test-black:
|
||||||
|
image: cr.44net.ch/ci-plugins/tests
|
||||||
|
pull: true
|
||||||
|
commands:
|
||||||
|
- just test_black
|
||||||
|
|
||||||
|
# check static typing - python
|
||||||
|
test-pyright:
|
||||||
|
image: cr.44net.ch/ci-plugins/tests
|
||||||
|
pull: true
|
||||||
|
commands:
|
||||||
|
- just install_deps
|
||||||
|
- just test_pyright
|
||||||
|
|
||||||
|
# ruff test - python
|
||||||
|
test-ruff:
|
||||||
|
image: cr.44net.ch/ci-plugins/tests
|
||||||
|
pull: true
|
||||||
|
commands:
|
||||||
|
- just test_ruff
|
||||||
|
|
||||||
|
# test mkdocs generation
|
||||||
|
test-mkdocs:
|
||||||
|
image: cr.44net.ch/ci-plugins/tests
|
||||||
|
pull: true
|
||||||
|
commands:
|
||||||
|
- python3 -m pip install mkdocs
|
||||||
|
- cd docs || exit 1
|
||||||
|
- python3 -m mkdocs build --strict
|
||||||
|
|
||||||
|
# test code with pytest - python
|
||||||
|
test-tox-pytest:
|
||||||
|
when:
|
||||||
|
event: [ push ]
|
||||||
|
image: cr.44net.ch/ci-plugins/tests
|
||||||
|
pull: true
|
||||||
|
commands:
|
||||||
|
- just test_pytest
|
||||||
|
|
||||||
|
# generate coverage report - python
|
||||||
|
test-tox-coverage:
|
||||||
|
when:
|
||||||
|
branch: master
|
||||||
|
event: [ pull_request ]
|
||||||
|
image: cr.44net.ch/ci-plugins/tests
|
||||||
|
pull: true
|
||||||
|
commands:
|
||||||
|
- just test_coverage
|
||||||
|
|
||||||
|
# analyse code with sonarqube and upload it
|
||||||
|
sonarqube-analysis:
|
||||||
|
when:
|
||||||
|
branch: master
|
||||||
|
event: [ pull_request ]
|
||||||
|
image: cr.44net.ch/ci-plugins/sonar-scanner
|
||||||
|
pull: true
|
||||||
|
settings:
|
||||||
|
sonar_host: https://sonarqube.44net.ch
|
||||||
|
sonar_token:
|
||||||
|
from_secret: sq-44net-token
|
||||||
|
usingProperties: true
|
374
CHANGELOG.md
374
CHANGELOG.md
|
@ -7,476 +7,458 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
- Add support for more sites
|
- Add support for more sites
|
||||||
|
|
||||||
## [2.4.1] - 2024-02-01
|
|
||||||
|
|
||||||
- same as 2.4.0
|
|
||||||
|
|
||||||
## [2.4.0] - 2024-02-01
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
|
|
||||||
- Some issues with Python3.8 compatibility
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
|
|
||||||
- Moved build system from woodpecker-ci to gitea actions
|
|
||||||
- Updated some dependencies
|
|
||||||
- Updated the docker image
|
|
||||||
- Switched from formatter/linter `black` to `ruff`
|
|
||||||
- Switches typing from `pyright` to `mypy`
|
|
||||||
|
|
||||||
## [2.3.1] - 2023-03-12
|
## [2.3.1] - 2023-03-12
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Added TypedDicts for type checkers and type annotation
|
- Added TypedDicts for type checkers and type annotation
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed some typos in the README
|
- Fixed some typos in the README
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Switched from pylint/pylama/isort/autoflake to ruff
|
- Switched from pylint/pylama/isort/autoflake to ruff
|
||||||
- Switched from mypy to pyright and added strict type checking
|
- Switched from mypy to pyright and added strict type checking
|
||||||
- Updated the api template
|
- Updated the api template
|
||||||
|
|
||||||
## [2.3.0] - 2023-02-15
|
## [2.3.0] - 2023-02-15
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Metadata is now added to each chapter. Schema
|
- Metadata is now added to each chapter. Schema
|
||||||
standard: [https://anansi-project.github.io/docs/comicinfo/schemas/v2.0](https://anansi-project.github.io/docs/comicinfo/schemas/v2.0)
|
standard: [https://anansi-project.github.io/docs/comicinfo/schemas/v2.0](https://anansi-project.github.io/docs/comicinfo/schemas/v2.0)
|
||||||
- Added `xmltodict` as a package requirement
|
- Added `xmltodict` as a package requirement
|
||||||
- Cache now also saves the manga title
|
- Cache now also saves the manga title
|
||||||
- New tests
|
- New tests
|
||||||
- More typo annotations for function, compatible with python3.8
|
- More typo annotations for function, compatible with python3.8
|
||||||
- File format checker if you use the MangaDLP class directly
|
- File format checker if you use the MangaDLP class directly
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- API template typos
|
- API template typos
|
||||||
- Some useless type annotations
|
- Some useless type annotations
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Simplified the chapter info generation
|
- Simplified the chapter info generation
|
||||||
- Updated the license year
|
- Updated the license year
|
||||||
- Updated the API template
|
- Updated the API template
|
||||||
- Updated the API detection and removed it from the MangaDLP class
|
- Updated the API detection and removed it from the MangaDLP class
|
||||||
|
|
||||||
## [2.2.20] - 2023-02-12
|
## [2.2.20] - 2023-02-12
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Script now doesn't exit if multiple mangas were requested and one had an error
|
- Script now doesn't exit if multiple mangas were requested and one had an error
|
||||||
|
|
||||||
## [2.2.19] - 2023-02-11
|
## [2.2.19] - 2023-02-11
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- First version of the chapter cache (very basic functionality)
|
- First version of the chapter cache (very basic functionality)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed all exception re-raises to include the original stack trace
|
- Fixed all exception re-raises to include the original stack trace
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Simplified chapter download loop
|
- Simplified chapter download loop
|
||||||
|
|
||||||
## [2.2.18] - 2023-01-21
|
## [2.2.18] - 2023-01-21
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed manga titles on non english language
|
- Fixed manga titles on non english language
|
||||||
- Fixed title & filename fixing to not use `ascii` but `uft8`
|
- Fixed title & filename fixing to not use `ascii` but `uft8`
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Fallback title to english of none was found in requested language
|
- Fallback title to english of none was found in requested language
|
||||||
- More debug logs
|
- More debug logs
|
||||||
- More tests
|
- More tests
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Now uses the first found alt-title. Before it was the last
|
- Now uses the first found alt-title. Before it was the last
|
||||||
- Removed `sys.exit` in the api
|
- Removed `sys.exit` in the api
|
||||||
|
|
||||||
## [2.2.17] - 2023-01-15
|
## [2.2.17] - 2023-01-15
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Set a timeout of 10 seconds for the api requests
|
- Set a timeout of 10 seconds for the api requests
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- `--name-format` and `--name-format-none` flags to add a custom naming scheme for the downloaded files. See
|
- `--name-format` and `--name-format-none` flags to add a custom naming scheme for the downloaded files. See
|
||||||
docs: https://manga-dlp.ivn.sh/download/
|
docs: https://manga-dlp.ivn.sh/download/
|
||||||
- More debug log messages
|
- More debug log messages
|
||||||
- More tests for the custom naming scheme
|
- More tests for the custom naming scheme
|
||||||
- More type hints
|
- More type hints
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Make `--format` a `click.Choice` option
|
- Make `--format` a `click.Choice` option
|
||||||
- In the `--format` option the leading dot is now invalid. `--format .cbz` -> `--format cbz`
|
- In the `--format` option the leading dot is now invalid. `--format .cbz` -> `--format cbz`
|
||||||
- Changed empty values from the api from None to an empty string
|
- Changed empty values from the api from None to an empty string
|
||||||
- Minor code readability improvements
|
- Minor code readability improvements
|
||||||
|
|
||||||
## [2.2.16] - 2022-12-30
|
## [2.2.16] - 2022-12-30
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Log level is now fixed and should not default to 0
|
- Log level is now fixed and should not default to 0
|
||||||
- Docker schedule should now work again
|
- Docker schedule should now work again
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Integrate logging logs to loguru via custom sink
|
- Integrate logging logs to loguru via custom sink
|
||||||
- Simplify docker shell scripts
|
- Simplify docker shell scripts
|
||||||
|
|
||||||
## [2.2.15] - 2022-12-29
|
## [2.2.15] - 2022-12-29
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- `--warn` and `--loglevel` flags
|
- `--warn` and `--loglevel` flags
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
- Remove `--lean` and `--verbose` flags and remove custom log levels
|
- Remove `--lean` and `--verbose` flags and remove custom log levels
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Move from standard library logging to [loguru](https://loguru.readthedocs.io/en/stable/index.html)
|
- Move from standard library logging to [loguru](https://loguru.readthedocs.io/en/stable/index.html)
|
||||||
- Move from standard library argparse to [click](https://click.palletsprojects.com/en/8.1.x/)
|
- Move from standard library argparse to [click](https://click.palletsprojects.com/en/8.1.x/)
|
||||||
|
|
||||||
## [2.2.14] - 2022-10-06
|
## [2.2.14] - 2022-10-06
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Changed logging format to ISO 8601
|
- Changed logging format to ISO 8601
|
||||||
- Small logging corrections
|
- Small logging corrections
|
||||||
|
|
||||||
## [2.2.13] - 2022-08-15
|
## [2.2.13] - 2022-08-15
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Option to run custom hooks before and after each chapter/manga download
|
- Option to run custom hooks before and after each chapter/manga download
|
||||||
- _Tests for the new hooks_
|
- _Tests for the new hooks_
|
||||||
- _Docs for the new hooks_
|
- _Docs for the new hooks_
|
||||||
- _Tests for mkdocs generation_
|
- _Tests for mkdocs generation_
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Verbose and Debug logging now have a space as a seperator between log level-name and log-level
|
- Verbose and Debug logging now have a space as a seperator between log level-name and log-level
|
||||||
- APIs now have an attribute with their name (for the hooks) - `api.api_name`
|
- APIs now have an attribute with their name (for the hooks) - `api.api_name`
|
||||||
- Docs moved to Cloudflare pages (generated with mkdocs)
|
- Docs moved to Cloudflare pages (generated with mkdocs)
|
||||||
|
|
||||||
## [2.1.12] - 2022-07-25
|
## [2.1.12] - 2022-07-25
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Image publishing with `hatch` on pypi should now work again
|
- Image publishing with `hatch` on pypi should now work again
|
||||||
- The schedule fixer for the new `.sh` schedule should now work correctly
|
- The schedule fixer for the new `.sh` schedule should now work correctly
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- More CI tests: `pylint`, `pylama` and `autoflake`
|
- More CI tests: `pylint`, `pylama` and `autoflake`
|
||||||
- New function in `get_release_notes.sh` to get the latest version
|
- New function in `get_release_notes.sh` to get the latest version
|
||||||
- Docstrings for `MangaDLP` and the api module `Mangadex`
|
- Docstrings for `MangaDLP` and the api module `Mangadex`
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- CI workflow is now faster and runs natively on arm64 (before it was buildx/emulation)
|
- CI workflow is now faster and runs natively on arm64 (before it was buildx/emulation)
|
||||||
- `Pylint`/`pylama` code improvements
|
- `Pylint`/`pylama` code improvements
|
||||||
- Version management is now done with `hatch` (in `__about__.py`)
|
- Version management is now done with `hatch` (in `__about__.py`)
|
||||||
|
|
||||||
## [2.1.11] - 2022-07-18
|
## [2.1.11] - 2022-07-18
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- The `--read` option now filters empty lines, so it will not generate an error anymore
|
- The `--read` option now filters empty lines, so it will not generate an error anymore
|
||||||
- An error which was caused by the interactive input method when you did not specify a chapter or to list them
|
- An error which was caused by the interactive input method when you did not specify a chapter or to list them
|
||||||
- Some typos
|
- Some typos
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Options to configure the default schedule in the docker container via environment variables
|
- Options to configure the default schedule in the docker container via environment variables
|
||||||
- Section the the docker [README.md](docker/README.md) for the new environment variables
|
- Section the the docker [README.md](docker/README.md) for the new environment variables
|
||||||
- `autoflake` test in `justfile`
|
- `autoflake` test in `justfile`
|
||||||
- Some more things which get logged
|
- Some more things which get logged
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- **BREAKING**: renamed the default schedule from `daily` to `daily.sh`. Don't forget to fix your bind-mounts to
|
- **BREAKING**: renamed the default schedule from `daily` to `daily.sh`. Don't forget to fix your bind-mounts to
|
||||||
overwrite
|
overwrite
|
||||||
the default schedule
|
the default schedule
|
||||||
- Added the `.sh` suffix to the s6 init scripts for better compatibility
|
- Added the `.sh` suffix to the s6 init scripts for better compatibility
|
||||||
- Adjusted the new logging implementation. It shows now more info about the module the log is from, and some other
|
- Adjusted the new logging implementation. It shows now more info about the module the log is from, and some other
|
||||||
improvements
|
improvements
|
||||||
|
|
||||||
## [2.1.10] - 2022-07-14
|
## [2.1.10] - 2022-07-14
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Removed some unused files
|
- Removed some unused files
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- `logger.py` for all log related settings and functions
|
- `logger.py` for all log related settings and functions
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Logging of output. The script now uses the `logging` library
|
- Logging of output. The script now uses the `logging` library
|
||||||
|
|
||||||
## [2.1.9] - 2022-06-26
|
## [2.1.9] - 2022-06-26
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Timeouts in tests, due to api limitations. Now added a wait time between tests
|
- Timeouts in tests, due to api limitations. Now added a wait time between tests
|
||||||
- Pytest path
|
- Pytest path
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- `--lean` flag for less output
|
- `--lean` flag for less output
|
||||||
- [justfile](https://github.com/casey/just) for setting up a dev environment and testing the code
|
- [justfile](https://github.com/casey/just) for setting up a dev environment and testing the code
|
||||||
- [asdf](https://github.com/asdf-vm/asdf) for version management
|
- [asdf](https://github.com/asdf-vm/asdf) for version management
|
||||||
- Dev requirements in [contrib/requirements_dev.txt](contrib/requirements_dev.txt)
|
- Dev requirements in [contrib/requirements_dev.txt](contrib/requirements_dev.txt)
|
||||||
- `README` in [contrib](contrib)
|
- `README` in [contrib](contrib)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Handling of verbosity and logging. Now there are 4 types of verbosity: `normal`, `lean`, `verbose` and `debug`
|
- Handling of verbosity and logging. Now there are 4 types of verbosity: `normal`, `lean`, `verbose` and `debug`
|
||||||
- CI/CD pipeline for testing and releases
|
- CI/CD pipeline for testing and releases
|
||||||
- Coverage testing now also done with `tox`
|
- Coverage testing now also done with `tox`
|
||||||
- Default verbosity of docker container is now `--lean`
|
- Default verbosity of docker container is now `--lean`
|
||||||
- Reorganised [pyproject.toml](pyproject.toml)
|
- Reorganised [pyproject.toml](pyproject.toml)
|
||||||
|
|
||||||
## [2.1.8] - 2022-06-22
|
## [2.1.8] - 2022-06-22
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Interactive input
|
- Interactive input
|
||||||
|
|
||||||
## [2.1.7] - 2022-06-22
|
## [2.1.7] - 2022-06-22
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- tox version testing
|
- tox version testing
|
||||||
- New pre-release tests
|
- New pre-release tests
|
||||||
- Build info's with hatch
|
- Build info's with hatch
|
||||||
- [Pypi](https://pypi.org/project/manga-dlp/) build with hatch
|
- [Pypi](https://pypi.org/project/manga-dlp/) build with hatch
|
||||||
- Pypi section in `README.md`
|
- Pypi section in `README.md`
|
||||||
- [Snyk](https://app.snyk.io/org/olofvndrhr-t6h/project/aae9609d-a4e4-41f8-b1ac-f2561b2ad4e3) test results
|
- [Snyk](https://app.snyk.io/org/olofvndrhr-t6h/project/aae9609d-a4e4-41f8-b1ac-f2561b2ad4e3) test results
|
||||||
in `README.md`
|
in `README.md`
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Moved code from `manga-dlp.py` to `input.py` for uniformity
|
- Moved code from `manga-dlp.py` to `input.py` for uniformity
|
||||||
- The default entrypoint is now `mangadlp.input:main`
|
- The default entrypoint is now `mangadlp.input:main`
|
||||||
|
|
||||||
## [2.1.6] - 2022-06-21
|
## [2.1.6] - 2022-06-21
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Docker labels are now working
|
- Docker labels are now working
|
||||||
- Global variables are now fully uppercase
|
- Global variables are now fully uppercase
|
||||||
- Some errors with static types
|
- Some errors with static types
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- bump2version config for releases
|
- bump2version config for releases
|
||||||
- More tests with: `mypy` and `isort`
|
- More tests with: `mypy` and `isort`
|
||||||
- New issue templates
|
- New issue templates
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Release workflow now is based on configuration files
|
- Release workflow now is based on configuration files
|
||||||
- Switched from `setup.py` to `pyproject.toml`
|
- Switched from `setup.py` to `pyproject.toml`
|
||||||
- `README.md` now has sorted badges
|
- `README.md` now has sorted badges
|
||||||
- Imports are now sorted with `isort`
|
- Imports are now sorted with `isort`
|
||||||
- Static types are now checked with `mypy`
|
- Static types are now checked with `mypy`
|
||||||
- Release note generation is now simplified
|
- Release note generation is now simplified
|
||||||
|
|
||||||
## [2.1.5] - 2022-06-18
|
## [2.1.5] - 2022-06-18
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Image names now have a suffix, as some comic readers have problems with no
|
- Image names now have a suffix, as some comic readers have problems with no
|
||||||
suffix [fixes issue #2]
|
suffix [fixes issue #2]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- `--format` section in the README
|
- `--format` section in the README
|
||||||
|
|
||||||
## [2.1.4] - 2022-05-29
|
## [2.1.4] - 2022-05-29
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Docker container now works again
|
- Docker container now works again
|
||||||
- Fixed cron in docker container
|
- Fixed cron in docker container
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Docker container scheduling is now more practical
|
- Docker container scheduling is now more practical
|
||||||
|
|
||||||
## [2.1.3] - 2022-05-29
|
## [2.1.3] - 2022-05-29
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Error-chapters and skipped-chapters list are now shown again
|
- Error-chapters and skipped-chapters list are now shown again
|
||||||
- The Interactive input version now matches `--version`
|
- The Interactive input version now matches `--version`
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Ability to list chapters with interactive input
|
- Ability to list chapters with interactive input
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Replace `exit()` with `sys.exit()`
|
- Replace `exit()` with `sys.exit()`
|
||||||
- Renamed class methods to not look like dunder methods
|
- Renamed class methods to not look like dunder methods
|
||||||
- Script execution moved from `os.system()` to `subprocess.call()`
|
- Script execution moved from `os.system()` to `subprocess.call()`
|
||||||
|
|
||||||
## [2.1.2] - 2022-05-20
|
## [2.1.2] - 2022-05-20
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- List chapters when none were specified
|
- List chapters when none were specified
|
||||||
- Typos
|
- Typos
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Ability to download whole volumes
|
- Ability to download whole volumes
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Moved processing of list with links to input.py
|
- Moved processing of list with links to input.py
|
||||||
- Updated README for volume and chapter selection
|
- Updated README for volume and chapter selection
|
||||||
|
|
||||||
## [2.1.1] - 2022-05-18
|
## [2.1.1] - 2022-05-18
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Progress bar on verbose output
|
- Progress bar on verbose output
|
||||||
- Sonarqube link for CI
|
- Sonarqube link for CI
|
||||||
- A few typos
|
- A few typos
|
||||||
- Removed unnecessary escapes from file rename regex
|
- Removed unnecessary escapes from file rename regex
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- API template
|
- API template
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Updated docker baseimage
|
- Updated docker baseimage
|
||||||
- Rewrote app.py to a class
|
- Rewrote app.py to a class
|
||||||
|
|
||||||
## [2.1.0] - 2022-05-16
|
## [2.1.0] - 2022-05-16
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Detection of files. Now it will skip them again
|
- Detection of files. Now it will skip them again
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Ability to save the chapters as pdf (only on amd64/x86)
|
- Ability to save the chapters as pdf (only on amd64/x86)
|
||||||
- New output formats: rar, zip
|
- New output formats: rar, zip
|
||||||
- Progress bar to show image download
|
- Progress bar to show image download
|
||||||
- Interactive input if no command line flags are given
|
- Interactive input if no command line flags are given
|
||||||
- Better KeyboardInterrupt handling
|
- Better KeyboardInterrupt handling
|
||||||
- Better error handling
|
- Better error handling
|
||||||
- Removed duplicate code
|
- Removed duplicate code
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- How the variables are used inside the script
|
- How the variables are used inside the script
|
||||||
- Variables have now the same name as in other scripts (mostly)
|
- Variables have now the same name as in other scripts (mostly)
|
||||||
- Better retrying when a task fails
|
- Better retrying when a task fails
|
||||||
|
|
||||||
## [2.0.8] - 2022-05-13
|
## [2.0.8] - 2022-05-13
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Rewrote parts of script to be easier to maintain
|
- Rewrote parts of script to be easier to maintain
|
||||||
- Moved the input script to the base folder
|
- Moved the input script to the base folder
|
||||||
- Moved all arguments to a class
|
- Moved all arguments to a class
|
||||||
- Docker container creation
|
- Docker container creation
|
||||||
|
|
||||||
## [2.0.7] - 2022-05-13
|
## [2.0.7] - 2022-05-13
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Changed CI/CD Platform from Drone-CI to Woodpecker-CI
|
- Changed CI/CD Platform from Drone-CI to Woodpecker-CI
|
||||||
- Release title is now only the version
|
- Release title is now only the version
|
||||||
|
|
||||||
## [2.0.6] - 2022-05-11
|
## [2.0.6] - 2022-05-11
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Filenames on windows (ntfs). Removed double quote from file and folder names
|
- Filenames on windows (ntfs). Removed double quote from file and folder names
|
||||||
|
|
||||||
## [2.0.5] - 2022-05-11
|
## [2.0.5] - 2022-05-11
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Better error handling on "KeyboardInterrupt"
|
- Better error handling on "KeyboardInterrupt"
|
||||||
- Release notes now fixed
|
- Release notes now fixed
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- New test cases
|
- New test cases
|
||||||
|
|
||||||
## [2.0.4] - 2022-05-10
|
## [2.0.4] - 2022-05-10
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- New test cases for more coverage
|
- New test cases for more coverage
|
||||||
- Github release
|
- Github release
|
||||||
- Updated docker baseimage
|
- Updated docker baseimage
|
||||||
|
|
||||||
## [2.0.3] - 2022-05-10
|
## [2.0.3] - 2022-05-10
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Test cases now work again
|
- Test cases now work again
|
||||||
- Sonarqube settings
|
- Sonarqube settings
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Coverage report in sonarqube
|
- Coverage report in sonarqube
|
||||||
- Gitea release
|
- Gitea release
|
||||||
|
|
||||||
## [2.0.2] - 2022-05-09
|
## [2.0.2] - 2022-05-09
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Restart failed api requests
|
- Restart failed api requests
|
||||||
- Added wait time for image gathering, as to stop api rate limiting from mangadex
|
- Added wait time for image gathering, as to stop api rate limiting from mangadex
|
||||||
- "--wait" options now works properly again
|
- "--wait" options now works properly again
|
||||||
|
|
||||||
## [2.0.1] - 2022-05-09
|
## [2.0.1] - 2022-05-09
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Regex for removing illegal characters in the filenames now doesn't remove quotes
|
- Regex for removing illegal characters in the filenames now doesn't remove quotes
|
||||||
- Updated docker baseimage and fixed the mangadlp tag in it
|
- Updated docker baseimage and fixed the mangadlp tag in it
|
||||||
- Update license for 2022
|
- Update license for 2022
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Quick start section in README
|
- Quick start section in README
|
||||||
- Preperation for pypi
|
- Preperation for pypi
|
||||||
|
|
||||||
## [2.0.0] - 2022-05-09
|
## [2.0.0] - 2022-05-09
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Support for new mangadex api
|
- Support for new mangadex api
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Code is now formatted with [black](https://github.com/psf/black)
|
- Code is now formatted with [black](https://github.com/psf/black)
|
||||||
- Now also supports just the uuid for managex (not a full link)
|
- Now also supports just the uuid for managex (not a full link)
|
||||||
|
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2021-present Ivan Schaller <ivan@schaller.sh>
|
Copyright (c) 2021-2023 Ivan Schaller
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
14
MANIFEST.in
14
MANIFEST.in
|
@ -1 +1,13 @@
|
||||||
graft src
|
include *.json
|
||||||
|
include *.md
|
||||||
|
include *.properties
|
||||||
|
include *.py
|
||||||
|
include *.txt
|
||||||
|
include *.yml
|
||||||
|
include *.xml
|
||||||
|
recursive-include contrib *.py
|
||||||
|
recursive-include mangadlp *.py
|
||||||
|
recursive-include mangadlp *.xml
|
||||||
|
recursive-include tests *.py
|
||||||
|
recursive-include tests *.xml
|
||||||
|
recursive-include tests *.txt
|
||||||
|
|
52
README.md
52
README.md
|
@ -2,23 +2,29 @@
|
||||||
|
|
||||||
> Full docs: https://manga-dlp.ivn.sh
|
> Full docs: https://manga-dlp.ivn.sh
|
||||||
|
|
||||||
|
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
|
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)
|
[![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)
|
||||||
[![Maintainability Rating](https://sonarqube.44net.ch/api/project_badges/measure?project=olofvndrhr%3Amanga-dlp&metric=sqale_rating&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)
|
||||||
[![Reliability Rating](https://sonarqube.44net.ch/api/project_badges/measure?project=olofvndrhr%3Amanga-dlp&metric=reliability_rating&token=f9558470580eea5b4899cf33f190eee16011346d)](https://sonarqube.44net.ch/dashboard?id=olofvndrhr%3Amanga-dlp)
|
|
||||||
[![Security Rating](https://sonarqube.44net.ch/api/project_badges/measure?project=olofvndrhr%3Amanga-dlp&metric=security_rating&token=f9558470580eea5b4899cf33f190eee16011346d)](https://sonarqube.44net.ch/dashboard?id=olofvndrhr%3Amanga-dlp)
|
|
||||||
|
|
||||||
Meta
|
Meta
|
||||||
|
|
||||||
[![Formatter](https://img.shields.io/badge/code%20style-ruff-black)](https://github.com/charliermarsh/ruff)
|
[![Code style](https://img.shields.io/badge/code%20style-black-black)](https://github.com/psf/black)
|
||||||
[![Linter](https://img.shields.io/badge/linter-ruff-red)](https://github.com/charliermarsh/ruff)
|
[![Linter](https://img.shields.io/badge/linter-ruff-red)](https://github.com/charliermarsh/ruff)
|
||||||
[![Types](https://img.shields.io/badge/types-mypy-blue)](https://github.com/python/mypy)
|
[![Types](https://img.shields.io/badge/types-pyright-blue)](https://github.com/microsoft/pyright)
|
||||||
[![Tests](https://img.shields.io/badge/tests-pytest%20%7C%20tox-yellow)](https://github.com/pytest-dev/pytest/)
|
[![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)
|
[![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/)
|
[![License](https://img.shields.io/badge/license-MIT-9400d3.svg)](https://snyk.io/learn/what-is-mit-license/)
|
||||||
[![Compatibility](https://img.shields.io/badge/python-3.11-blue)]()
|
[![Compatibility](https://img.shields.io/pypi/pyversions/manga-dlp)](https://pypi.org/project/manga-dlp/)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -36,19 +42,19 @@ you just want the folder with all the pictures use the flag `--format ""`.
|
||||||
|
|
||||||
## _Currently_ Supported sites
|
## _Currently_ Supported sites
|
||||||
|
|
||||||
- [Mangadex.org](https://mangadex.org/)
|
- [Mangadex.org](https://mangadex.org/)
|
||||||
|
|
||||||
## Features (not complete)
|
## Features (not complete)
|
||||||
|
|
||||||
- Metadata support with [ComicInfo.xml](https://anansi-project.github.io/docs/comicinfo/intro)
|
- Metadata support with [ComicInfo.xml](https://anansi-project.github.io/docs/comicinfo/intro)
|
||||||
- Json caching
|
- Json caching
|
||||||
- Custom hooks after/before each download
|
- Custom hooks after/before each download
|
||||||
- Custom chapter name format
|
- Custom chapter name format
|
||||||
- Volume support
|
- Volume support
|
||||||
- Multiple archive formats supported (cbz,cbr,zip,none)
|
- Multiple archive formats supported (cbz,cbr,zip,none)
|
||||||
- Language selection
|
- Language selection
|
||||||
- Download all chapters directly
|
- Download all chapters directly
|
||||||
- And others...
|
- And others...
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
@ -140,10 +146,10 @@ If you encounter any bugs, also just open an issue with a description of the pro
|
||||||
|
|
||||||
## TODO's
|
## TODO's
|
||||||
|
|
||||||
- <del>Make docker container for easy distribution</del>
|
- <del>Make docker container for easy distribution</del>
|
||||||
--> [Dockerhub](https://hub.docker.com/r/olofvndrhr/manga-dlp)
|
--> [Dockerhub](https://hub.docker.com/r/olofvndrhr/manga-dlp)
|
||||||
- <del>Automate release</del>
|
- <del>Automate release</del>
|
||||||
--> Done with woodpecker-ci
|
--> Done with woodpecker-ci
|
||||||
- <del>Make pypi package</del>
|
- <del>Make pypi package</del>
|
||||||
--> Done with release [2.1.7](https://pypi.org/project/manga-dlp/)
|
--> Done with release [2.1.7](https://pypi.org/project/manga-dlp/)
|
||||||
- Add more supported sites
|
- Add more supported sites
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from typing import Dict, List
|
from typing import Dict, List, Union
|
||||||
|
|
||||||
from mangadlp.models import ChapterData, ComicInfo
|
|
||||||
|
|
||||||
|
from mangadlp.types import ChapterData,ComicInfo
|
||||||
|
|
||||||
# api template for manga-dlp
|
# api template for manga-dlp
|
||||||
|
|
||||||
|
@ -46,7 +45,7 @@ class YourAPI:
|
||||||
"volume": "1",
|
"volume": "1",
|
||||||
"chapter": "1",
|
"chapter": "1",
|
||||||
"name": "test",
|
"name": "test",
|
||||||
"pages": 2,
|
"pages" 2,
|
||||||
},
|
},
|
||||||
"2": {
|
"2": {
|
||||||
"uuid": "abc",
|
"uuid": "abc",
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
FROM git.44net.ch/44net/python311:11 AS builder
|
|
||||||
|
|
||||||
COPY pyproject.toml README.md /build/
|
|
||||||
COPY src /build/src
|
|
||||||
WORKDIR /build
|
|
||||||
RUN \
|
|
||||||
echo "**** building package ****" \
|
|
||||||
&& pip3 install hatch hatchling \
|
|
||||||
&& python3 -m hatch build --clean
|
|
||||||
|
|
||||||
FROM git.44net.ch/44net/debian-s6:11
|
|
||||||
|
|
||||||
LABEL maintainer="Ivan Schaller" \
|
|
||||||
description="A CLI manga downloader"
|
|
||||||
|
|
||||||
ENV PATH="/opt/python3/bin:${PATH}"
|
|
||||||
|
|
||||||
COPY --from=builder /opt/python3 /opt/python3
|
|
||||||
COPY --from=builder /build/dist/*.whl /build/dist/
|
|
||||||
COPY docker/rootfs /
|
|
||||||
|
|
||||||
RUN \
|
|
||||||
echo "**** creating folders ****" \
|
|
||||||
&& mkdir -p /app \
|
|
||||||
&& echo "**** updating pip ****" \
|
|
||||||
&& python3 -m pip install --upgrade pip setuptools wheel \
|
|
||||||
&& echo "**** install python packages ****" \
|
|
||||||
&& python3 -m pip install /build/dist/*.whl
|
|
||||||
|
|
||||||
RUN \
|
|
||||||
echo "**** cleanup ****" \
|
|
||||||
&& apt-get purge --auto-remove -y \
|
|
||||||
&& apt-get clean \
|
|
||||||
&& rm -rf \
|
|
||||||
/tmp/* \
|
|
||||||
/var/lib/apt/lists/* \
|
|
||||||
/var/tmp/*
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
50
docker/Dockerfile.amd64
Normal file
50
docker/Dockerfile.amd64
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
FROM cr.44net.ch/baseimages/debian-s6:11.6-linux-amd64
|
||||||
|
|
||||||
|
# set version label
|
||||||
|
ARG BUILD_VERSION
|
||||||
|
ENV IMAGE_VERSION=${BUILD_VERSION}
|
||||||
|
LABEL version="${BUILD_VERSION}"
|
||||||
|
LABEL maintainer="Ivan Schaller"
|
||||||
|
LABEL description="A CLI manga downloader"
|
||||||
|
|
||||||
|
|
||||||
|
# install packages
|
||||||
|
RUN \
|
||||||
|
echo "**** install base packages ****" \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
python3 \
|
||||||
|
python3-pip
|
||||||
|
|
||||||
|
# prepare app
|
||||||
|
RUN \
|
||||||
|
echo "**** creating folders ****" \
|
||||||
|
&& mkdir -p /app \
|
||||||
|
&& echo "**** updating pip ****" \
|
||||||
|
&& python3 -m pip install --upgrade pip
|
||||||
|
|
||||||
|
# cleanup installation
|
||||||
|
RUN \
|
||||||
|
echo "**** cleanup ****" \
|
||||||
|
&& apt-get purge --auto-remove -y \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf \
|
||||||
|
/tmp/* \
|
||||||
|
/var/lib/apt/lists/* \
|
||||||
|
/var/tmp/*
|
||||||
|
|
||||||
|
|
||||||
|
# copy files to container
|
||||||
|
COPY docker/rootfs /
|
||||||
|
COPY mangadlp/ /app/mangadlp/
|
||||||
|
COPY \
|
||||||
|
manga-dlp.py \
|
||||||
|
requirements.txt \
|
||||||
|
LICENSE \
|
||||||
|
/app/
|
||||||
|
|
||||||
|
|
||||||
|
# install requirements
|
||||||
|
RUN pip install -r /app/requirements.txt
|
||||||
|
|
||||||
|
WORKDIR /app
|
52
docker/Dockerfile.arm64
Normal file
52
docker/Dockerfile.arm64
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
FROM cr.44net.ch/baseimages/debian-s6:11.6-linux-arm64
|
||||||
|
|
||||||
|
# set version label
|
||||||
|
ARG BUILD_VERSION
|
||||||
|
ENV IMAGE_VERSION=${BUILD_VERSION}
|
||||||
|
LABEL version="${BUILD_VERSION}"
|
||||||
|
LABEL maintainer="Ivan Schaller"
|
||||||
|
LABEL description="A CLI manga downloader"
|
||||||
|
|
||||||
|
|
||||||
|
# install packages
|
||||||
|
RUN \
|
||||||
|
echo "**** install base packages ****" \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
python3 \
|
||||||
|
python3-pip
|
||||||
|
|
||||||
|
# prepare app
|
||||||
|
RUN \
|
||||||
|
echo "**** creating folders ****" \
|
||||||
|
&& mkdir -p /app \
|
||||||
|
&& echo "**** updating pip ****" \
|
||||||
|
&& python3 -m pip install --upgrade pip
|
||||||
|
|
||||||
|
# cleanup installation
|
||||||
|
RUN \
|
||||||
|
echo "**** cleanup ****" \
|
||||||
|
&& apt-get purge --auto-remove -y \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf \
|
||||||
|
/tmp/* \
|
||||||
|
/var/lib/apt/lists/* \
|
||||||
|
/var/tmp/*
|
||||||
|
|
||||||
|
|
||||||
|
# copy files to container
|
||||||
|
COPY docker/rootfs /
|
||||||
|
COPY mangadlp/ /app/mangadlp/
|
||||||
|
COPY \
|
||||||
|
manga-dlp.py \
|
||||||
|
requirements.txt \
|
||||||
|
LICENSE \
|
||||||
|
/app/
|
||||||
|
|
||||||
|
|
||||||
|
# install requirements (without img2pdf)
|
||||||
|
RUN grep -v img2pdf /app/requirements.txt > /app/requirements-arm64.txt
|
||||||
|
RUN pip install -r /app/requirements-arm64.txt
|
||||||
|
|
||||||
|
|
||||||
|
WORKDIR /app
|
20
docker/manifest.tmpl
Normal file
20
docker/manifest.tmpl
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
image: olofvndrhr/manga-dlp:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}dev{{/if}}
|
||||||
|
{{#if build.tags}}
|
||||||
|
tags:
|
||||||
|
{{#each build.tags}}
|
||||||
|
- {{this}}
|
||||||
|
{{/each}}
|
||||||
|
- "latest"
|
||||||
|
{{/if}}
|
||||||
|
manifests:
|
||||||
|
-
|
||||||
|
image: olofvndrhr/manga-dlp:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{else}}dev-{{/if}}linux-amd64
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: linux
|
||||||
|
-
|
||||||
|
image: olofvndrhr/manga-dlp:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{else}}dev-{{/if}}linux-arm64
|
||||||
|
platform:
|
||||||
|
architecture: arm64
|
||||||
|
os: linux
|
||||||
|
variant: v8
|
|
@ -8,3 +8,4 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||||
# "s6-setuidgid abc" is used to set the permissions
|
# "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
|
0 12 * * * root s6-setuidgid abc /app/schedules/daily.sh > /proc/1/fd/1 2>&1
|
||||||
|
|
||||||
|
|
52
get_release_notes.sh
Executable file
52
get_release_notes.sh
Executable file
|
@ -0,0 +1,52 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
|
||||||
|
# script to extract the release notes from the changelog
|
||||||
|
|
||||||
|
# show script help
|
||||||
|
function show_help() {
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
Script to generate release-notes from a changelog (CHANGELOG.md)
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
./get_release_notes.sh <new_version>
|
||||||
|
|
||||||
|
|
||||||
|
Example:
|
||||||
|
./get_release_notes.sh "2.0.5"
|
||||||
|
or
|
||||||
|
./get_release_notes.sh "latest"
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# create changelog for release
|
||||||
|
function get_release_notes() {
|
||||||
|
local l_version="${1}"
|
||||||
|
|
||||||
|
printf 'Creating release-notes\n'
|
||||||
|
# check for version
|
||||||
|
if [[ -z "${l_version}" ]]; then
|
||||||
|
printf 'You need to specify a version with $1\n'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ ${l_version,,} == "latest" ]]; then
|
||||||
|
l_version="$(grep -o -E "^##\s\[[0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2}\]" CHANGELOG.md | head -n 1 | grep -o -E "[0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2}")"
|
||||||
|
fi
|
||||||
|
awk -v ver="[${l_version}]" \
|
||||||
|
'/^## / { if (p) { exit }; if ($2 == ver) { p=1 } } p && NF' \
|
||||||
|
'CHANGELOG.md' > 'RELEASENOTES.md'
|
||||||
|
printf 'Done\n'
|
||||||
|
}
|
||||||
|
|
||||||
|
# check options
|
||||||
|
case "${1}" in
|
||||||
|
'--help' | '-h' | 'help')
|
||||||
|
show_help
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
get_release_notes "${@}"
|
||||||
|
;;
|
||||||
|
esac
|
156
justfile
156
justfile
|
@ -3,73 +3,143 @@
|
||||||
default: show_receipts
|
default: show_receipts
|
||||||
|
|
||||||
set shell := ["bash", "-uc"]
|
set shell := ["bash", "-uc"]
|
||||||
set dotenv-load
|
set dotenv-load := true
|
||||||
|
#set export
|
||||||
|
|
||||||
|
# aliases
|
||||||
|
alias s := show_receipts
|
||||||
|
alias i := show_system_info
|
||||||
|
alias p := prepare_workspace
|
||||||
|
alias l := lint
|
||||||
|
alias t := tests
|
||||||
|
alias f := tests_full
|
||||||
|
|
||||||
|
# variables
|
||||||
|
export asdf_version := "v0.10.2"
|
||||||
|
|
||||||
|
# default recipe to display help information
|
||||||
show_receipts:
|
show_receipts:
|
||||||
just --list
|
@just --list
|
||||||
|
|
||||||
show_system_info:
|
show_system_info:
|
||||||
@echo "=================================="
|
@echo "=================================="
|
||||||
@echo "os : {{os()}}"
|
@echo "os : {{os()}}"
|
||||||
@echo "arch: {{arch()}}"
|
@echo "arch: {{arch()}}"
|
||||||
@echo "justfile dir: {{justfile_directory()}}"
|
@echo "home: ${HOME}"
|
||||||
@echo "invocation dir: {{invocation_directory()}}"
|
@echo "project dir: {{justfile_directory()}}"
|
||||||
@echo "running dir: `pwd -P`"
|
|
||||||
@echo "=================================="
|
@echo "=================================="
|
||||||
|
|
||||||
setup:
|
check_asdf:
|
||||||
asdf install
|
@if ! asdf --version; then \
|
||||||
lefthook install
|
just install_asdf \
|
||||||
|
;else \
|
||||||
|
echo "asdf already installed" \
|
||||||
|
;fi
|
||||||
|
just install_asdf_bins
|
||||||
|
|
||||||
|
install_asdf:
|
||||||
|
@echo "installing asdf"
|
||||||
|
@echo "asdf version: ${asdf_version}"
|
||||||
|
@git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch "${asdf_version}"
|
||||||
|
@echo "adding asdf to .bashrc"
|
||||||
|
@if ! grep -q ".asdf/asdf.sh" "${HOME}/.bashrc"; then \
|
||||||
|
echo -e '\n# source asdf' >> "${HOME}/.bashrc" \
|
||||||
|
;echo 'source "${HOME}/.asdf/asdf.sh"' >> "${HOME}/.bashrc" \
|
||||||
|
;echo -e 'source "${HOME}/.asdf/completions/asdf.bash"\n' >> "${HOME}/.bashrc" \
|
||||||
|
;fi
|
||||||
|
@echo "to load asdf either restart your shell or do: 'source \${HOME}/.bashrc'"
|
||||||
|
|
||||||
|
setup_asdf:
|
||||||
|
@echo "installing asdf bins"
|
||||||
|
# add plugins
|
||||||
|
@if ! asdf plugin add python; then :; fi
|
||||||
|
@if ! asdf plugin add shfmt; then :; fi
|
||||||
|
@if ! asdf plugin add shellcheck; then :; fi
|
||||||
|
@if ! asdf plugin add just https://github.com/franklad/asdf-just; then :; fi
|
||||||
|
@if ! asdf plugin add direnv; then :; fi
|
||||||
|
# install bins
|
||||||
|
@if ! asdf install; then :; fi
|
||||||
|
# setup direnv
|
||||||
|
@if ! asdf direnv setup --shell bash --version latest; then :; fi
|
||||||
|
|
||||||
create_venv:
|
create_venv:
|
||||||
@echo "creating venv"
|
@echo "creating venv"
|
||||||
python3 -m pip install --upgrade pip setuptools wheel
|
@python3 -m pip install --upgrade pip setuptools wheel
|
||||||
python3 -m venv venv
|
@python3 -m venv venv
|
||||||
|
|
||||||
install_deps:
|
install_deps:
|
||||||
@echo "installing dependencies"
|
@echo "installing dependencies"
|
||||||
python3 -m hatch dep show requirements --project-only > /tmp/requirements.txt
|
@pip3 install -r requirements.txt
|
||||||
pip3 install -r /tmp/requirements.txt
|
|
||||||
|
|
||||||
install_deps_dev:
|
install_deps_dev:
|
||||||
@echo "installing dev dependencies"
|
@echo "installing dependencies"
|
||||||
python3 -m hatch dep show requirements --project-only > /tmp/requirements.txt
|
@pip3 install -r contrib/requirements_dev.txt
|
||||||
python3 -m hatch dep show requirements --env-only >> /tmp/requirements.txt
|
|
||||||
pip3 install -r /tmp/requirements.txt
|
|
||||||
|
|
||||||
create_reqs:
|
|
||||||
@echo "creating requirements"
|
|
||||||
pipreqs --force --savepath requirements.txt src/mangadlp/
|
|
||||||
|
|
||||||
test_shfmt:
|
test_shfmt:
|
||||||
find . -type f \( -name "**.sh" -and -not -path "./.**" -and -not -path "./venv**" \) -exec shfmt -d -i 4 -bn -ci -sr "{}" \+;
|
@find . -type f \( -name "**.sh" -and -not -path "./.**" -and -not -path "./venv**" \) -exec shfmt -d -i 4 -bn -ci -sr "{}" \+;
|
||||||
|
|
||||||
format_shfmt:
|
test_black:
|
||||||
find . -type f \( -name "**.sh" -and -not -path "./.**" -and -not -path "./venv**" \) -exec shfmt -w -i 4 -bn -ci -sr "{}" \+;
|
@python3 -m black --check --diff mangadlp/
|
||||||
|
|
||||||
|
test_pyright:
|
||||||
|
@python3 -m pyright mangadlp/
|
||||||
|
|
||||||
|
test_ruff:
|
||||||
|
@python3 -m ruff --diff mangadlp/
|
||||||
|
|
||||||
|
test_ci_conf:
|
||||||
|
@woodpecker-cli lint .woodpecker/
|
||||||
|
|
||||||
|
test_pytest:
|
||||||
|
@python3 -m tox -e basic
|
||||||
|
|
||||||
|
test_coverage:
|
||||||
|
@python3 -m tox -e coverage
|
||||||
|
|
||||||
|
test_tox:
|
||||||
|
@python3 -m tox
|
||||||
|
|
||||||
|
test_build:
|
||||||
|
@python3 -m hatch build --clean
|
||||||
|
|
||||||
|
test_docker_build:
|
||||||
|
@docker build . -f docker/Dockerfile.amd64 -t manga-dlp:test
|
||||||
|
|
||||||
|
# install dependecies and set everything up
|
||||||
|
prepare_workspace:
|
||||||
|
just show_system_info
|
||||||
|
just check_asdf
|
||||||
|
just setup_asdf
|
||||||
|
just create_venv
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
just show_system_info
|
just show_system_info
|
||||||
|
-just test_ci_conf
|
||||||
just test_shfmt
|
just test_shfmt
|
||||||
hatch run lint:style
|
just test_black
|
||||||
hatch run lint:typing
|
just test_pyright
|
||||||
|
just test_ruff
|
||||||
|
@echo -e "\n\033[0;32m=== ALL DONE ===\033[0m\n"
|
||||||
|
|
||||||
format:
|
tests:
|
||||||
just show_system_info
|
just show_system_info
|
||||||
just format_shfmt
|
-just test_ci_conf
|
||||||
hatch run lint:fmt
|
just test_shfmt
|
||||||
|
just test_black
|
||||||
|
just test_pyright
|
||||||
|
just test_ruff
|
||||||
|
just test_pytest
|
||||||
|
@echo -e "\n\033[0;32m=== ALL DONE ===\033[0m\n"
|
||||||
|
|
||||||
check:
|
tests_full:
|
||||||
just lint
|
just show_system_info
|
||||||
just format
|
-just test_ci_conf
|
||||||
|
just test_shfmt
|
||||||
test:
|
just test_black
|
||||||
hatch run default:test
|
just test_pyright
|
||||||
|
just test_ruff
|
||||||
coverage:
|
just test_build
|
||||||
hatch run default:cov
|
just test_tox
|
||||||
|
just test_coverage
|
||||||
build:
|
just test_docker_build
|
||||||
hatch build --clean
|
@echo -e "\n\033[0;32m=== ALL DONE ===\033[0m\n"
|
||||||
|
|
||||||
run loglevel *flags:
|
|
||||||
hatch run mangadlp --loglevel {{loglevel}} {{flags}}
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import src.mangadlp.cli
|
import mangadlp.cli
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(src.mangadlp.cli.main())
|
sys.exit(mangadlp.cli.main()) # pylint: disable=no-value-for-parameter
|
||||||
|
|
1
mangadlp/__about__.py
Normal file
1
mangadlp/__about__.py
Normal file
|
@ -0,0 +1 @@
|
||||||
|
__version__ = "2.3.1"
|
0
mangadlp/__init__.py
Normal file
0
mangadlp/__init__.py
Normal file
6
mangadlp/__main__.py
Normal file
6
mangadlp/__main__.py
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import mangadlp.cli
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(mangadlp.cli.main()) # pylint: disable=no-value-for-parameter
|
0
mangadlp/api/__init__.py
Normal file
0
mangadlp/api/__init__.py
Normal file
|
@ -6,7 +6,7 @@ import requests
|
||||||
from loguru import logger as log
|
from loguru import logger as log
|
||||||
|
|
||||||
from mangadlp import utils
|
from mangadlp import utils
|
||||||
from mangadlp.models import ChapterData, ComicInfo
|
from mangadlp.types import ChapterData, ComicInfo
|
||||||
|
|
||||||
|
|
||||||
class Mangadex:
|
class Mangadex:
|
||||||
|
@ -22,7 +22,7 @@ class Mangadex:
|
||||||
Attributes:
|
Attributes:
|
||||||
api_name (str): Name of the API
|
api_name (str): Name of the API
|
||||||
manga_uuid (str): UUID of the manga, without the url part
|
manga_uuid (str): UUID of the manga, without the url part
|
||||||
manga_data (dict): Infos of the manga. Name, title etc.
|
manga_data (dict): Infos of the manga. Name, title etc
|
||||||
manga_title (str): The title of the manga, sanitized for all file systems
|
manga_title (str): The title of the manga, sanitized for all file systems
|
||||||
manga_chapter_data (dict): All chapter data of the manga. Volumes, chapters, chapter uuids and chapter names
|
manga_chapter_data (dict): All chapter data of the manga. Volumes, chapters, chapter uuids and chapter names
|
||||||
chapter_list (list): A list of all available chapters for the language
|
chapter_list (list): A list of all available chapters for the language
|
||||||
|
@ -57,7 +57,9 @@ class Mangadex:
|
||||||
# get the uuid for the manga
|
# get the uuid for the manga
|
||||||
def get_manga_uuid(self) -> str:
|
def get_manga_uuid(self) -> str:
|
||||||
# isolate id from url
|
# isolate id from url
|
||||||
uuid_regex = re.compile("[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}")
|
uuid_regex = re.compile(
|
||||||
|
"[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}"
|
||||||
|
)
|
||||||
# try to get uuid in string
|
# try to get uuid in string
|
||||||
try:
|
try:
|
||||||
uuid = uuid_regex.search(self.url_uuid)[0] # type: ignore
|
uuid = uuid_regex.search(self.url_uuid)[0] # type: ignore
|
||||||
|
@ -65,7 +67,7 @@ class Mangadex:
|
||||||
log.error("No valid UUID found")
|
log.error("No valid UUID found")
|
||||||
raise exc
|
raise exc
|
||||||
|
|
||||||
return uuid
|
return uuid # pyright:ignore
|
||||||
|
|
||||||
# make initial request
|
# make initial request
|
||||||
def get_manga_data(self) -> Dict[str, Any]:
|
def get_manga_data(self) -> Dict[str, Any]:
|
||||||
|
@ -73,7 +75,9 @@ class Mangadex:
|
||||||
counter = 1
|
counter = 1
|
||||||
while counter <= 3:
|
while counter <= 3:
|
||||||
try:
|
try:
|
||||||
response = requests.get(f"{self.api_base_url}/manga/{self.manga_uuid}", timeout=10)
|
response = requests.get(
|
||||||
|
f"{self.api_base_url}/manga/{self.manga_uuid}", timeout=10
|
||||||
|
)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
if counter >= 3:
|
if counter >= 3:
|
||||||
log.error("Maybe the MangaDex API is down?")
|
log.error("Maybe the MangaDex API is down?")
|
||||||
|
@ -84,9 +88,9 @@ class Mangadex:
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
response_body: Dict[str, Dict[str, Any]] = response.json()
|
response_body: Dict[str, Dict[str, Any]] = response.json() # pyright:ignore
|
||||||
# check if manga exists
|
# check if manga exists
|
||||||
if response_body["result"] != "ok":
|
if response_body["result"] != "ok": # type:ignore
|
||||||
log.error("Manga not found")
|
log.error("Manga not found")
|
||||||
raise KeyError
|
raise KeyError
|
||||||
|
|
||||||
|
@ -98,35 +102,32 @@ class Mangadex:
|
||||||
attributes = self.manga_data["attributes"]
|
attributes = self.manga_data["attributes"]
|
||||||
# try to get the title in requested language
|
# try to get the title in requested language
|
||||||
try:
|
try:
|
||||||
found_title = attributes["title"][self.language]
|
title = attributes["title"][self.language]
|
||||||
title = utils.fix_name(found_title)
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
log.info("Manga title not found in requested language. Trying alt titles")
|
log.info("Manga title not found in requested language. Trying alt titles")
|
||||||
else:
|
else:
|
||||||
log.debug(f"Language={self.language}, Title='{title}'")
|
log.debug(f"Language={self.language}, Title='{title}'")
|
||||||
return title # type: ignore
|
return utils.fix_name(title)
|
||||||
|
|
||||||
# search in alt titles
|
# search in alt titles
|
||||||
try:
|
try:
|
||||||
log.debug(f"Alt titles: {attributes['altTitles']}")
|
log.debug(f"Alt titles: {attributes['altTitles']}")
|
||||||
for item in attributes["altTitles"]:
|
for item in attributes["altTitles"]:
|
||||||
if item.get(self.language):
|
if item.get(self.language):
|
||||||
alt_title_item = item
|
alt_title = item
|
||||||
break
|
break
|
||||||
found_title = alt_title_item[self.language]
|
title = alt_title[self.language] # pyright:ignore
|
||||||
except (KeyError, UnboundLocalError):
|
except (KeyError, UnboundLocalError):
|
||||||
log.warning("Manga title also not found in alt titles. Falling back to english title")
|
log.warning(
|
||||||
|
"Manga title also not found in alt titles. Falling back to english title"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
title = utils.fix_name(found_title)
|
log.debug(f"Language={self.language}, Alt-title='{title}'")
|
||||||
log.debug(f"Language={self.language}, Alt-title='{found_title}'")
|
return utils.fix_name(title)
|
||||||
return title # type: ignore
|
|
||||||
|
|
||||||
found_title = attributes["title"]["en"]
|
|
||||||
title = utils.fix_name(found_title)
|
|
||||||
|
|
||||||
|
title = attributes["title"]["en"]
|
||||||
log.debug(f"Language=en, Fallback-title='{title}'")
|
log.debug(f"Language=en, Fallback-title='{title}'")
|
||||||
|
return utils.fix_name(title)
|
||||||
return title # type: ignore
|
|
||||||
|
|
||||||
# check if chapters are available in requested language
|
# check if chapters are available in requested language
|
||||||
def check_chapter_lang(self) -> int:
|
def check_chapter_lang(self) -> int:
|
||||||
|
@ -138,7 +139,9 @@ class Mangadex:
|
||||||
try:
|
try:
|
||||||
total_chapters: int = r.json()["total"]
|
total_chapters: int = r.json()["total"]
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
log.error("Error retrieving the chapters list. Did you specify a valid language code?")
|
log.error(
|
||||||
|
"Error retrieving the chapters list. Did you specify a valid language code?"
|
||||||
|
)
|
||||||
raise exc
|
raise exc
|
||||||
if total_chapters == 0:
|
if total_chapters == 0:
|
||||||
log.error("No chapters available to download in specified language")
|
log.error("No chapters available to download in specified language")
|
||||||
|
@ -154,7 +157,7 @@ class Mangadex:
|
||||||
# check for chapters in specified lang
|
# check for chapters in specified lang
|
||||||
total_chapters = self.check_chapter_lang()
|
total_chapters = self.check_chapter_lang()
|
||||||
|
|
||||||
chapter_data: Dict[str, ChapterData] = {}
|
chapter_data: dict[str, ChapterData] = {}
|
||||||
last_volume, last_chapter = ("", "")
|
last_volume, last_chapter = ("", "")
|
||||||
offset = 0
|
offset = 0
|
||||||
while offset < total_chapters: # if more than 500 chapters
|
while offset < total_chapters: # if more than 500 chapters
|
||||||
|
@ -187,7 +190,9 @@ class Mangadex:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# export chapter data as a dict
|
# export chapter data as a dict
|
||||||
chapter_index = chapter_num if not self.forcevol else f"{chapter_vol}:{chapter_num}"
|
chapter_index = (
|
||||||
|
chapter_num if not self.forcevol else f"{chapter_vol}:{chapter_num}"
|
||||||
|
)
|
||||||
chapter_data[chapter_index] = {
|
chapter_data[chapter_index] = {
|
||||||
"uuid": chapter_uuid,
|
"uuid": chapter_uuid,
|
||||||
"volume": chapter_vol,
|
"volume": chapter_vol,
|
||||||
|
@ -238,8 +243,8 @@ class Mangadex:
|
||||||
if api_error:
|
if api_error:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
chapter_hash = api_data["chapter"]["hash"]
|
chapter_hash = api_data["chapter"]["hash"] # pyright:ignore
|
||||||
chapter_img_data = api_data["chapter"]["data"]
|
chapter_img_data = api_data["chapter"]["data"] # pyright:ignore
|
||||||
|
|
||||||
# get list of image urls
|
# get list of image urls
|
||||||
image_urls: List[str] = []
|
image_urls: List[str] = []
|
|
@ -10,7 +10,7 @@ from mangadlp.api.mangadex import Mangadex
|
||||||
from mangadlp.cache import CacheDB
|
from mangadlp.cache import CacheDB
|
||||||
from mangadlp.hooks import run_hook
|
from mangadlp.hooks import run_hook
|
||||||
from mangadlp.metadata import write_metadata
|
from mangadlp.metadata import write_metadata
|
||||||
from mangadlp.models import ChapterData
|
from mangadlp.types import ChapterData
|
||||||
from mangadlp.utils import get_file_format
|
from mangadlp.utils import get_file_format
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ class MangaDLP:
|
||||||
add_metadata: Flag to toggle creation & inclusion of metadata
|
add_metadata: Flag to toggle creation & inclusion of metadata
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__( # noqa
|
def __init__( # pylint: disable=too-many-locals
|
||||||
self,
|
self,
|
||||||
url_uuid: str,
|
url_uuid: str,
|
||||||
language: str = "en",
|
language: str = "en",
|
||||||
|
@ -139,7 +139,9 @@ class MangaDLP:
|
||||||
# prechecks userinput/options
|
# prechecks userinput/options
|
||||||
# no url and no readin list given
|
# no url and no readin list given
|
||||||
if not self.url_uuid:
|
if not self.url_uuid:
|
||||||
log.error('You need to specify a manga url/uuid with "-u" or a list with "--read"')
|
log.error(
|
||||||
|
'You need to specify a manga url/uuid with "-u" or a list with "--read"'
|
||||||
|
)
|
||||||
raise ValueError
|
raise ValueError
|
||||||
# checks if --list is not used
|
# checks if --list is not used
|
||||||
if not self.list_chapters:
|
if not self.list_chapters:
|
||||||
|
@ -159,7 +161,7 @@ class MangaDLP:
|
||||||
raise ValueError
|
raise ValueError
|
||||||
|
|
||||||
# once called per manga
|
# once called per manga
|
||||||
def get_manga(self) -> None: # noqa
|
def get_manga(self) -> None:
|
||||||
print_divider = "========================================="
|
print_divider = "========================================="
|
||||||
# show infos
|
# show infos
|
||||||
log.info(f"{print_divider}")
|
log.info(f"{print_divider}")
|
||||||
|
@ -177,7 +179,9 @@ class MangaDLP:
|
||||||
if self.chapters.lower() == "all":
|
if self.chapters.lower() == "all":
|
||||||
chapters_to_download = self.manga_chapter_list
|
chapters_to_download = self.manga_chapter_list
|
||||||
else:
|
else:
|
||||||
chapters_to_download = utils.get_chapter_list(self.chapters, self.manga_chapter_list)
|
chapters_to_download = utils.get_chapter_list(
|
||||||
|
self.chapters, self.manga_chapter_list
|
||||||
|
)
|
||||||
|
|
||||||
# show chapters to download
|
# show chapters to download
|
||||||
log.info(f"Chapters selected: {', '.join(chapters_to_download)}")
|
log.info(f"Chapters selected: {', '.join(chapters_to_download)}")
|
||||||
|
@ -188,7 +192,9 @@ class MangaDLP:
|
||||||
|
|
||||||
# prepare cache if specified
|
# prepare cache if specified
|
||||||
if self.cache_path:
|
if self.cache_path:
|
||||||
cache = CacheDB(self.cache_path, self.manga_uuid, self.language, self.manga_title)
|
cache = CacheDB(
|
||||||
|
self.cache_path, self.manga_uuid, self.language, self.manga_title
|
||||||
|
)
|
||||||
cached_chapters = cache.db_uuid_chapters
|
cached_chapters = cache.db_uuid_chapters
|
||||||
log.info(f"Cached chapters: {cached_chapters}")
|
log.info(f"Cached chapters: {cached_chapters}")
|
||||||
|
|
||||||
|
@ -218,10 +224,10 @@ class MangaDLP:
|
||||||
)
|
)
|
||||||
|
|
||||||
# get chapters
|
# get chapters
|
||||||
skipped_chapters: List[Any] = []
|
skipped_chapters: list[Any] = []
|
||||||
error_chapters: List[Any] = []
|
error_chapters: list[Any] = []
|
||||||
for chapter in chapters_to_download:
|
for chapter in chapters_to_download:
|
||||||
if self.cache_path and chapter in cached_chapters:
|
if self.cache_path and chapter in cached_chapters: # pyright:ignore
|
||||||
log.info(f"Chapter '{chapter}' is in cache. Skipping download")
|
log.info(f"Chapter '{chapter}' is in cache. Skipping download")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -235,7 +241,7 @@ class MangaDLP:
|
||||||
skipped_chapters.append(chapter)
|
skipped_chapters.append(chapter)
|
||||||
# update cache
|
# update cache
|
||||||
if self.cache_path:
|
if self.cache_path:
|
||||||
cache.add_chapter(chapter)
|
cache.add_chapter(chapter) # pyright:ignore
|
||||||
continue
|
continue
|
||||||
except Exception:
|
except Exception:
|
||||||
# skip download/packing due to an error
|
# skip download/packing due to an error
|
||||||
|
@ -251,7 +257,9 @@ class MangaDLP:
|
||||||
{"Format": self.file_format[1:], **metadata},
|
{"Format": self.file_format[1:], **metadata},
|
||||||
)
|
)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
log.warning(f"Can't write metadata for chapter '{chapter}'. Reason={exc}")
|
log.warning(
|
||||||
|
f"Can't write metadata for chapter '{chapter}'. Reason={exc}"
|
||||||
|
)
|
||||||
|
|
||||||
# pack downloaded folder
|
# pack downloaded folder
|
||||||
if self.file_format:
|
if self.file_format:
|
||||||
|
@ -266,7 +274,7 @@ class MangaDLP:
|
||||||
|
|
||||||
# update cache
|
# update cache
|
||||||
if self.cache_path:
|
if self.cache_path:
|
||||||
cache.add_chapter(chapter)
|
cache.add_chapter(chapter) # pyright:ignore
|
||||||
|
|
||||||
# start chapter post hook
|
# start chapter post hook
|
||||||
run_hook(
|
run_hook(
|
||||||
|
@ -308,7 +316,9 @@ class MangaDLP:
|
||||||
|
|
||||||
# get image urls for chapter
|
# get image urls for chapter
|
||||||
try:
|
try:
|
||||||
chapter_image_urls = self.api.get_chapter_images(chapter, self.download_wait)
|
chapter_image_urls = self.api.get_chapter_images(
|
||||||
|
chapter, self.download_wait
|
||||||
|
)
|
||||||
except KeyboardInterrupt as exc:
|
except KeyboardInterrupt as exc:
|
||||||
log.critical("Keyboard interrupt. Stopping")
|
log.critical("Keyboard interrupt. Stopping")
|
||||||
raise exc
|
raise exc
|
||||||
|
@ -397,7 +407,9 @@ class MangaDLP:
|
||||||
|
|
||||||
# download images
|
# download images
|
||||||
try:
|
try:
|
||||||
downloader.download_chapter(chapter_image_urls, chapter_path, self.download_wait)
|
downloader.download_chapter(
|
||||||
|
chapter_image_urls, chapter_path, self.download_wait
|
||||||
|
)
|
||||||
except KeyboardInterrupt as exc:
|
except KeyboardInterrupt as exc:
|
||||||
log.critical("Keyboard interrupt. Stopping")
|
log.critical("Keyboard interrupt. Stopping")
|
||||||
raise exc
|
raise exc
|
||||||
|
@ -429,7 +441,7 @@ class MangaDLP:
|
||||||
# check if image folder is existing
|
# check if image folder is existing
|
||||||
if not chapter_path.exists():
|
if not chapter_path.exists():
|
||||||
log.error(f"Image folder: {chapter_path} does not exist")
|
log.error(f"Image folder: {chapter_path} does not exist")
|
||||||
raise OSError
|
raise IOError
|
||||||
if self.file_format == ".pdf":
|
if self.file_format == ".pdf":
|
||||||
utils.make_pdf(chapter_path)
|
utils.make_pdf(chapter_path)
|
||||||
else:
|
else:
|
|
@ -1,11 +1,9 @@
|
||||||
import json
|
import json
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Union
|
from typing import Dict, List, Union
|
||||||
|
|
||||||
from loguru import logger as log
|
from loguru import logger as log
|
||||||
|
|
||||||
from mangadlp.models import CacheData, CacheKeyData
|
|
||||||
|
|
||||||
|
|
||||||
class CacheDB:
|
class CacheDB:
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -28,12 +26,14 @@ class CacheDB:
|
||||||
if not self.db_data.get(self.db_key):
|
if not self.db_data.get(self.db_key):
|
||||||
self.db_data[self.db_key] = {}
|
self.db_data[self.db_key] = {}
|
||||||
|
|
||||||
self.db_uuid_data: CacheKeyData = self.db_data[self.db_key]
|
self.db_uuid_data = self.db_data[self.db_key]
|
||||||
if not self.db_uuid_data.get("name"):
|
if not self.db_uuid_data.get("name"):
|
||||||
self.db_uuid_data.update({"name": self.name})
|
self.db_uuid_data.update({"name": self.name})
|
||||||
self._write_db()
|
self._write_db()
|
||||||
|
|
||||||
self.db_uuid_chapters: List[str] = self.db_uuid_data.get("chapters") or []
|
self.db_uuid_chapters: List[str] = (
|
||||||
|
self.db_uuid_data.get("chapters") or [] # type:ignore
|
||||||
|
)
|
||||||
|
|
||||||
def _prepare_db(self) -> None:
|
def _prepare_db(self) -> None:
|
||||||
if self.db_path.exists():
|
if self.db_path.exists():
|
||||||
|
@ -46,11 +46,11 @@ class CacheDB:
|
||||||
log.error("Can't create db-file")
|
log.error("Can't create db-file")
|
||||||
raise exc
|
raise exc
|
||||||
|
|
||||||
def _read_db(self) -> CacheData:
|
def _read_db(self) -> Dict[str, Dict[str, Union[str, List[str]]]]:
|
||||||
log.info(f"Reading cache-db: {self.db_path}")
|
log.info(f"Reading cache-db: {self.db_path}")
|
||||||
try:
|
try:
|
||||||
db_txt = self.db_path.read_text(encoding="utf8")
|
db_txt = self.db_path.read_text(encoding="utf8")
|
||||||
db_dict: CacheData = json.loads(db_txt)
|
db_dict: Dict[str, Dict[str, Union[str, List[str]]]] = json.loads(db_txt)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
log.error("Can't load cache-db")
|
log.error("Can't load cache-db")
|
||||||
raise exc
|
raise exc
|
|
@ -26,8 +26,7 @@ def readin_list(_ctx: click.Context, _param: str, value: str) -> List[str]:
|
||||||
url_str = list_file.read_text(encoding="utf-8")
|
url_str = list_file.read_text(encoding="utf-8")
|
||||||
url_list = url_str.splitlines()
|
url_list = url_str.splitlines()
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
msg = f"Reading in file '{list_file}'"
|
raise click.BadParameter("Can't get links from the file") from exc
|
||||||
raise click.BadParameter(msg) from exc
|
|
||||||
|
|
||||||
# filter empty lines and remove them
|
# filter empty lines and remove them
|
||||||
filtered_list = list(filter(len, url_list))
|
filtered_list = list(filter(len, url_list))
|
||||||
|
@ -40,8 +39,8 @@ def readin_list(_ctx: click.Context, _param: str, value: str) -> List[str]:
|
||||||
@click.help_option()
|
@click.help_option()
|
||||||
@click.version_option(version=__version__, package_name="manga-dlp")
|
@click.version_option(version=__version__, package_name="manga-dlp")
|
||||||
# manga selection
|
# manga selection
|
||||||
@optgroup.group("source", cls=RequiredMutuallyExclusiveOptionGroup)
|
@optgroup.group("source", cls=RequiredMutuallyExclusiveOptionGroup) # type: ignore
|
||||||
@optgroup.option(
|
@optgroup.option( # type: ignore
|
||||||
"-u",
|
"-u",
|
||||||
"--url",
|
"--url",
|
||||||
"--uuid",
|
"--uuid",
|
||||||
|
@ -51,7 +50,7 @@ def readin_list(_ctx: click.Context, _param: str, value: str) -> List[str]:
|
||||||
show_default=True,
|
show_default=True,
|
||||||
help="URL or UUID of the manga",
|
help="URL or UUID of the manga",
|
||||||
)
|
)
|
||||||
@optgroup.option(
|
@optgroup.option( # type: ignore
|
||||||
"--read",
|
"--read",
|
||||||
"read_mangas",
|
"read_mangas",
|
||||||
is_eager=True,
|
is_eager=True,
|
||||||
|
@ -62,8 +61,8 @@ def readin_list(_ctx: click.Context, _param: str, value: str) -> List[str]:
|
||||||
help="Path of file with manga links to download. One per line",
|
help="Path of file with manga links to download. One per line",
|
||||||
)
|
)
|
||||||
# logging options
|
# logging options
|
||||||
@optgroup.group("verbosity", cls=MutuallyExclusiveOptionGroup)
|
@optgroup.group("verbosity", cls=MutuallyExclusiveOptionGroup) # type: ignore
|
||||||
@optgroup.option(
|
@optgroup.option( # type: ignore
|
||||||
"--loglevel",
|
"--loglevel",
|
||||||
"verbosity",
|
"verbosity",
|
||||||
type=int,
|
type=int,
|
||||||
|
@ -71,7 +70,7 @@ def readin_list(_ctx: click.Context, _param: str, value: str) -> List[str]:
|
||||||
show_default=True,
|
show_default=True,
|
||||||
help="Custom log level",
|
help="Custom log level",
|
||||||
)
|
)
|
||||||
@optgroup.option(
|
@optgroup.option( # type: ignore
|
||||||
"--warn",
|
"--warn",
|
||||||
"verbosity",
|
"verbosity",
|
||||||
flag_value=30,
|
flag_value=30,
|
||||||
|
@ -79,7 +78,7 @@ def readin_list(_ctx: click.Context, _param: str, value: str) -> List[str]:
|
||||||
show_default=True,
|
show_default=True,
|
||||||
help="Only log warnings and higher",
|
help="Only log warnings and higher",
|
||||||
)
|
)
|
||||||
@optgroup.option(
|
@optgroup.option( # type: ignore
|
||||||
"--debug",
|
"--debug",
|
||||||
"verbosity",
|
"verbosity",
|
||||||
flag_value=10,
|
flag_value=10,
|
||||||
|
@ -232,7 +231,7 @@ def readin_list(_ctx: click.Context, _param: str, value: str) -> List[str]:
|
||||||
def main(ctx: click.Context, **kwargs: Any) -> None:
|
def main(ctx: click.Context, **kwargs: Any) -> None:
|
||||||
"""Script to download mangas from various sites."""
|
"""Script to download mangas from various sites."""
|
||||||
url_uuid: str = kwargs.pop("url_uuid")
|
url_uuid: str = kwargs.pop("url_uuid")
|
||||||
read_mangas: List[str] = kwargs.pop("read_mangas")
|
read_mangas: list[str] = kwargs.pop("read_mangas")
|
||||||
verbosity: int = kwargs.pop("verbosity")
|
verbosity: int = kwargs.pop("verbosity")
|
||||||
|
|
||||||
# set log level to INFO if not set
|
# set log level to INFO if not set
|
|
@ -48,10 +48,11 @@ def download_chapter(
|
||||||
# write image
|
# write image
|
||||||
try:
|
try:
|
||||||
with image_path.open("wb") as file:
|
with image_path.open("wb") as file:
|
||||||
r.raw.decode_content = True
|
r.raw.decode_content = True # pyright:ignore
|
||||||
shutil.copyfileobj(r.raw, file)
|
shutil.copyfileobj(r.raw, file) # pyright:ignore
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
log.error("Can't write file")
|
log.error("Can't write file")
|
||||||
raise exc
|
raise exc
|
||||||
|
|
||||||
|
image_num += 1
|
||||||
sleep(download_wait)
|
sleep(download_wait)
|
|
@ -31,7 +31,7 @@ def run_hook(command: str, hook_type: str, **kwargs: Any) -> int:
|
||||||
|
|
||||||
# running command
|
# running command
|
||||||
log.info(f"Hook '{hook_type}' - running command: '{command}'")
|
log.info(f"Hook '{hook_type}' - running command: '{command}'")
|
||||||
proc = subprocess.run(command_list, check=False, timeout=15, encoding="utf8") # noqa
|
proc = subprocess.run(command_list, check=False, timeout=15, encoding="utf8")
|
||||||
exit_code = proc.returncode
|
exit_code = proc.returncode
|
||||||
|
|
||||||
if exit_code == 0:
|
if exit_code == 0:
|
|
@ -4,7 +4,6 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
|
|
||||||
LOGURU_FMT = "{time:%Y-%m-%dT%H:%M:%S%z} | <level>[{level: <7}]</level> [{name: <10}] [{function: <20}]: {message}"
|
LOGURU_FMT = "{time:%Y-%m-%dT%H:%M:%S%z} | <level>[{level: <7}]</level> [{name: <10}] [{function: <20}]: {message}"
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,20 +20,26 @@ class InterceptHandler(logging.Handler):
|
||||||
|
|
||||||
# Find caller from where originated the logged message
|
# Find caller from where originated the logged message
|
||||||
frame, depth = logging.currentframe(), 2
|
frame, depth = logging.currentframe(), 2
|
||||||
while frame.f_code.co_filename == logging.__file__:
|
while frame.f_code.co_filename == logging.__file__: # pyright:ignore
|
||||||
frame = frame.f_back # type: ignore
|
frame = frame.f_back # type: ignore
|
||||||
depth += 1
|
depth += 1
|
||||||
|
|
||||||
logger.opt(depth=depth, exception=record.exc_info).log(level, record.getMessage())
|
logger.opt(depth=depth, exception=record.exc_info).log(
|
||||||
|
level, record.getMessage()
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# init logger with format and log level
|
# init logger with format and log level
|
||||||
def prepare_logger(loglevel: int = 20) -> None:
|
def prepare_logger(loglevel: int = 20) -> None:
|
||||||
stdout_handler: Dict[str, Any] = {
|
config: Dict[str, Any] = {
|
||||||
"sink": sys.stdout,
|
"handlers": [
|
||||||
"level": loglevel,
|
{
|
||||||
"format": LOGURU_FMT,
|
"sink": sys.stdout,
|
||||||
|
"level": loglevel,
|
||||||
|
"format": LOGURU_FMT,
|
||||||
|
}
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.basicConfig(handlers=[InterceptHandler()], level=loglevel)
|
logging.basicConfig(handlers=[InterceptHandler()], level=loglevel)
|
||||||
logger.configure(handlers=[stdout_handler])
|
logger.configure(**config)
|
|
@ -4,14 +4,15 @@ from typing import Any, Dict, List, Tuple, Union
|
||||||
import xmltodict
|
import xmltodict
|
||||||
from loguru import logger as log
|
from loguru import logger as log
|
||||||
|
|
||||||
from mangadlp.models import ComicInfo
|
from mangadlp.types import ComicInfo
|
||||||
|
|
||||||
|
|
||||||
METADATA_FILENAME = "ComicInfo.xml"
|
METADATA_FILENAME = "ComicInfo.xml"
|
||||||
METADATA_TEMPLATE = Path("mangadlp/metadata/ComicInfo_v2.0.xml")
|
METADATA_TEMPLATE = Path("mangadlp/metadata/ComicInfo_v2.0.xml")
|
||||||
# define metadata types, defaults and valid values. an empty list means no value check
|
# define metadata types, defaults and valid values. an empty list means no value check
|
||||||
# {key: (type, default value, valid values)}
|
# {key: (type, default value, valid values)}
|
||||||
METADATA_TYPES: Dict[str, Tuple[Any, Union[str, int, None], List[Union[str, int, None]]]] = {
|
METADATA_TYPES: Dict[
|
||||||
|
str, Tuple[Any, Union[str, int, None], List[Union[str, int, None]]]
|
||||||
|
] = {
|
||||||
"Title": (str, None, []),
|
"Title": (str, None, []),
|
||||||
"Series": (str, None, []),
|
"Series": (str, None, []),
|
||||||
"Number": (str, None, []),
|
"Number": (str, None, []),
|
||||||
|
@ -65,13 +66,15 @@ METADATA_TYPES: Dict[str, Tuple[Any, Union[str, int, None], List[Union[str, int,
|
||||||
def validate_metadata(metadata_in: ComicInfo) -> Dict[str, ComicInfo]:
|
def validate_metadata(metadata_in: ComicInfo) -> Dict[str, ComicInfo]:
|
||||||
log.info("Validating metadata")
|
log.info("Validating metadata")
|
||||||
|
|
||||||
metadata_valid: Dict[str, ComicInfo] = {"ComicInfo": {}}
|
metadata_valid: dict[str, ComicInfo] = {"ComicInfo": {}}
|
||||||
for key, value in METADATA_TYPES.items():
|
for key, value in METADATA_TYPES.items():
|
||||||
metadata_type, metadata_default, metadata_validation = value
|
metadata_type, metadata_default, metadata_validation = value
|
||||||
|
|
||||||
# add default value if present
|
# add default value if present
|
||||||
if metadata_default:
|
if metadata_default:
|
||||||
log.debug(f"Setting default value for Key:{key} -> value={metadata_default}")
|
log.debug(
|
||||||
|
f"Setting default value for Key:{key} -> value={metadata_default}"
|
||||||
|
)
|
||||||
metadata_valid["ComicInfo"][key] = metadata_default
|
metadata_valid["ComicInfo"][key] = metadata_default
|
||||||
|
|
||||||
# check if metadata key is available
|
# check if metadata key is available
|
||||||
|
@ -86,13 +89,17 @@ def validate_metadata(metadata_in: ComicInfo) -> Dict[str, ComicInfo]:
|
||||||
# check if metadata type is correct
|
# check if metadata type is correct
|
||||||
log.debug(f"Key:{key} -> value={type(md_to_check)} -> check={metadata_type}")
|
log.debug(f"Key:{key} -> value={type(md_to_check)} -> check={metadata_type}")
|
||||||
if not isinstance(md_to_check, metadata_type):
|
if not isinstance(md_to_check, metadata_type):
|
||||||
log.warning(f"Metadata has wrong type: {key}:{metadata_type} -> {md_to_check}")
|
log.warning(
|
||||||
|
f"Metadata has wrong type: {key}:{metadata_type} -> {md_to_check}"
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# check if metadata is valid
|
# check if metadata is valid
|
||||||
log.debug(f"Key:{key} -> value={md_to_check} -> valid={metadata_validation}")
|
log.debug(f"Key:{key} -> value={md_to_check} -> valid={metadata_validation}")
|
||||||
if (len(metadata_validation) > 0) and (md_to_check not in metadata_validation):
|
if (len(metadata_validation) > 0) and (md_to_check not in metadata_validation):
|
||||||
log.warning(f"Metadata is invalid: {key}:{metadata_validation} -> {md_to_check}")
|
log.warning(
|
||||||
|
f"Metadata is invalid: {key}:{metadata_validation} -> {md_to_check}"
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
log.debug(f"Updating metadata: '{key}' = '{md_to_check}'")
|
log.debug(f"Updating metadata: '{key}' = '{md_to_check}'")
|
||||||
|
@ -102,7 +109,7 @@ def validate_metadata(metadata_in: ComicInfo) -> Dict[str, ComicInfo]:
|
||||||
|
|
||||||
|
|
||||||
def write_metadata(chapter_path: Path, metadata: ComicInfo) -> None:
|
def write_metadata(chapter_path: Path, metadata: ComicInfo) -> None:
|
||||||
if metadata["Format"] == "pdf":
|
if metadata["Format"] == "pdf": # pyright:ignore
|
||||||
log.warning("Can't add metadata for pdf format. Skipping")
|
log.warning("Can't add metadata for pdf format. Skipping")
|
||||||
return
|
return
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import List, Optional, TypedDict
|
from typing import Optional, TypedDict
|
||||||
|
|
||||||
|
|
||||||
class ComicInfo(TypedDict, total=False):
|
class ComicInfo(TypedDict, total=False):
|
||||||
|
@ -48,12 +48,3 @@ class ChapterData(TypedDict):
|
||||||
chapter: str
|
chapter: str
|
||||||
name: str
|
name: str
|
||||||
pages: int
|
pages: int
|
||||||
|
|
||||||
|
|
||||||
class CacheKeyData(TypedDict):
|
|
||||||
chapters: List[str]
|
|
||||||
name: str
|
|
||||||
|
|
||||||
|
|
||||||
class CacheData(TypedDict):
|
|
||||||
__root__: CacheKeyData
|
|
|
@ -4,7 +4,6 @@ from pathlib import Path
|
||||||
from typing import Any, List
|
from typing import Any, List
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
|
|
||||||
import pytz
|
|
||||||
from loguru import logger as log
|
from loguru import logger as log
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,17 +24,17 @@ def make_archive(chapter_path: Path, file_format: str) -> None:
|
||||||
|
|
||||||
def make_pdf(chapter_path: Path) -> None:
|
def make_pdf(chapter_path: Path) -> None:
|
||||||
try:
|
try:
|
||||||
import img2pdf # pylint: disable=import-outside-toplevel
|
import img2pdf # pylint: disable=import-outside-toplevel # pyright:ignore
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
log.error("Cant import img2pdf. Please install it first")
|
log.error("Cant import img2pdf. Please install it first")
|
||||||
raise exc
|
raise exc
|
||||||
|
|
||||||
pdf_path = Path(f"{chapter_path}.pdf")
|
pdf_path = Path(f"{chapter_path}.pdf")
|
||||||
images: List[str] = []
|
images: list[str] = []
|
||||||
for file in chapter_path.iterdir():
|
for file in chapter_path.iterdir():
|
||||||
images.append(str(file))
|
images.append(str(file))
|
||||||
try:
|
try:
|
||||||
pdf_path.write_bytes(img2pdf.convert(images))
|
pdf_path.write_bytes(img2pdf.convert(images)) # pyright:ignore
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
log.error("Can't create '.pdf' archive")
|
log.error("Can't create '.pdf' archive")
|
||||||
raise exc
|
raise exc
|
||||||
|
@ -44,13 +43,13 @@ def make_pdf(chapter_path: Path) -> None:
|
||||||
# create a list of chapters
|
# create a list of chapters
|
||||||
def get_chapter_list(chapters: str, available_chapters: List[str]) -> List[str]:
|
def get_chapter_list(chapters: str, available_chapters: List[str]) -> List[str]:
|
||||||
# check if there are available chapter
|
# check if there are available chapter
|
||||||
chapter_list: List[str] = []
|
chapter_list: list[str] = []
|
||||||
for chapter in chapters.split(","):
|
for chapter in chapters.split(","):
|
||||||
# check if chapter list is with volumes and ranges (forcevol)
|
# check if chapter list is with volumes and ranges (forcevol)
|
||||||
if "-" in chapter and ":" in chapter:
|
if "-" in chapter and ":" in chapter:
|
||||||
# split chapters and volumes apart for list generation
|
# split chapters and volumes apart for list generation
|
||||||
lower_num_fv: List[str] = chapter.split("-")[0].split(":")
|
lower_num_fv: list[str] = chapter.split("-")[0].split(":")
|
||||||
upper_num_fv: List[str] = chapter.split("-")[1].split(":")
|
upper_num_fv: list[str] = chapter.split("-")[1].split(":")
|
||||||
vol_fv: str = lower_num_fv[0]
|
vol_fv: str = lower_num_fv[0]
|
||||||
chap_beg_fv: int = int(lower_num_fv[1])
|
chap_beg_fv: int = int(lower_num_fv[1])
|
||||||
chap_end_fv: int = int(upper_num_fv[1])
|
chap_end_fv: int = int(upper_num_fv[1])
|
||||||
|
@ -71,7 +70,7 @@ def get_chapter_list(chapters: str, available_chapters: List[str]) -> List[str]:
|
||||||
# select all chapters from the volume --> 1: == 1:1,1:2,1:3...
|
# select all chapters from the volume --> 1: == 1:1,1:2,1:3...
|
||||||
if vol_num and not chap_num:
|
if vol_num and not chap_num:
|
||||||
regex: Any = re.compile(f"{vol_num}:[0-9]{{1,4}}")
|
regex: Any = re.compile(f"{vol_num}:[0-9]{{1,4}}")
|
||||||
vol_list: List[str] = [n for n in available_chapters if regex.match(n)]
|
vol_list: list[str] = [n for n in available_chapters if regex.match(n)]
|
||||||
chapter_list.extend(vol_list)
|
chapter_list.extend(vol_list)
|
||||||
else:
|
else:
|
||||||
chapter_list.append(chapter)
|
chapter_list.append(chapter)
|
||||||
|
@ -161,7 +160,7 @@ def get_file_format(file_format: str) -> str:
|
||||||
|
|
||||||
|
|
||||||
def progress_bar(progress: float, total: float) -> None:
|
def progress_bar(progress: float, total: float) -> None:
|
||||||
time = datetime.now(tz=pytz.timezone("Europe/Zurich")).strftime("%Y-%m-%dT%H:%M:%S")
|
time = datetime.now().strftime("%Y-%m-%dT%H:%M:%S")
|
||||||
percent = int(progress / (int(total) / 100))
|
percent = int(progress / (int(total) / 100))
|
||||||
bar_length = 50
|
bar_length = 50
|
||||||
bar_progress = int(progress / (int(total) / bar_length))
|
bar_progress = int(progress / (int(total) / bar_length))
|
||||||
|
@ -169,9 +168,9 @@ def progress_bar(progress: float, total: float) -> None:
|
||||||
whitespace_texture = " " * (bar_length - bar_progress)
|
whitespace_texture = " " * (bar_length - bar_progress)
|
||||||
if progress == total:
|
if progress == total:
|
||||||
full_bar = "■" * bar_length
|
full_bar = "■" * bar_length
|
||||||
print(f"\r{time}{' '*6}| [BAR ] ❙{full_bar}❙ 100%", end="\n") # noqa
|
print(f"\r{time}{' '*6}| [BAR ] ❙{full_bar}❙ 100%", end="\n")
|
||||||
else:
|
else:
|
||||||
print( # noqa
|
print(
|
||||||
f"\r{time}{' '*6}| [BAR ] ❙{bar_texture}{whitespace_texture}❙ {percent}%",
|
f"\r{time}{' '*6}| [BAR ] ❙{bar_texture}{whitespace_texture}❙ {percent}%",
|
||||||
end="\r",
|
end="\r",
|
||||||
)
|
)
|
237
pyproject.toml
237
pyproject.toml
|
@ -1,14 +1,14 @@
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["hatchling>=1.18", "hatch-regex-commit>=0.0.3"]
|
requires = ["hatchling>=1.11.0"]
|
||||||
build-backend = "hatchling.build"
|
build-backend = "hatchling.build"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
|
dynamic = ["version"]
|
||||||
name = "manga-dlp"
|
name = "manga-dlp"
|
||||||
description = "A cli manga downloader"
|
description = "A cli manga downloader"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
requires-python = ">=3.8"
|
requires-python = ">=3.8"
|
||||||
dynamic = ["version"]
|
|
||||||
authors = [{ name = "Ivan Schaller", email = "ivan@schaller.sh" }]
|
authors = [{ name = "Ivan Schaller", email = "ivan@schaller.sh" }]
|
||||||
keywords = ["manga", "downloader", "mangadex"]
|
keywords = ["manga", "downloader", "mangadex"]
|
||||||
classifiers = [
|
classifiers = [
|
||||||
|
@ -18,7 +18,6 @@ classifiers = [
|
||||||
"Programming Language :: Python :: 3.8",
|
"Programming Language :: Python :: 3.8",
|
||||||
"Programming Language :: Python :: 3.9",
|
"Programming Language :: Python :: 3.9",
|
||||||
"Programming Language :: Python :: 3.10",
|
"Programming Language :: Python :: 3.10",
|
||||||
"Programming Language :: Python :: 3.11",
|
|
||||||
]
|
]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"requests>=2.28.0",
|
"requests>=2.28.0",
|
||||||
|
@ -26,221 +25,125 @@ dependencies = [
|
||||||
"click>=8.1.3",
|
"click>=8.1.3",
|
||||||
"click-option-group>=0.5.5",
|
"click-option-group>=0.5.5",
|
||||||
"xmltodict>=0.13.0",
|
"xmltodict>=0.13.0",
|
||||||
"img2pdf>=0.4.4",
|
|
||||||
"pytz>=2022.1",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
Homepage = "https://github.com/olofvndrhr/manga-dlp"
|
Homepage = "https://github.com/olofvndrhr/manga-dlp"
|
||||||
History = "https://github.com/olofvndrhr/manga-dlp/commits/master"
|
History = "https://github.com/olofvndrhr/manga-dlp/commits/master"
|
||||||
Tracker = "https://github.com/olofvndrhr/manga-dlp/issues"
|
Tracker = "https://github.com/olofvndrhr/manga-dlp/issues"
|
||||||
Source = "https://github.com/olofvndrhr/manga-dlp"
|
Source = "https://github.com/olofvndrhr/manga-dlp"
|
||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
mangadlp = "mangadlp.cli:main"
|
mangadlp = "mangadlp.cli:main"
|
||||||
manga-dlp = "mangadlp.cli:main"
|
manga-dlp = "mangadlp.cli:main"
|
||||||
|
|
||||||
[tool.hatch.version]
|
[tool.hatch.version]
|
||||||
source = "regex_commit"
|
path = "mangadlp/__about__.py"
|
||||||
path = "src/mangadlp/__about__.py"
|
|
||||||
tag_sign = false
|
[tool.hatch.build]
|
||||||
|
ignore-vcs = true
|
||||||
|
|
||||||
[tool.hatch.build.targets.sdist]
|
[tool.hatch.build.targets.sdist]
|
||||||
packages = ["src/mangadlp"]
|
packages = ["mangadlp"]
|
||||||
|
|
||||||
[tool.hatch.build.targets.wheel]
|
[tool.hatch.build.targets.wheel]
|
||||||
packages = ["src/mangadlp"]
|
packages = ["mangadlp"]
|
||||||
|
|
||||||
###
|
|
||||||
### envs
|
|
||||||
###
|
|
||||||
|
|
||||||
[tool.hatch.envs.default]
|
[tool.hatch.envs.default]
|
||||||
python = "3.11"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"pytest==7.4.3",
|
"requests>=2.28.0",
|
||||||
"coverage==7.3.2",
|
"loguru>=0.6.0",
|
||||||
|
"click>=8.1.3",
|
||||||
|
"click-option-group>=0.5.5",
|
||||||
"xmltodict>=0.13.0",
|
"xmltodict>=0.13.0",
|
||||||
"xmlschema>=2.2.1",
|
"xmlschema>=2.2.1",
|
||||||
|
"img2pdf>=0.4.4",
|
||||||
|
"hatch>=1.6.0",
|
||||||
|
"hatchling>=1.11.0",
|
||||||
|
"pytest>=7.0.0",
|
||||||
|
"coverage>=6.3.1",
|
||||||
|
"black>=22.1.0",
|
||||||
|
"mypy>=0.940",
|
||||||
|
"tox>=3.24.5",
|
||||||
|
"ruff>=0.0.247",
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.hatch.envs.default.scripts]
|
# pyright
|
||||||
test = "pytest {args:tests}"
|
|
||||||
test-cov = ["coverage erase", "coverage run -m pytest {args:tests}"]
|
|
||||||
cov-report = ["- coverage combine", "coverage report", "coverage xml"]
|
|
||||||
cov = ["test-cov", "cov-report"]
|
|
||||||
|
|
||||||
[[tool.hatch.envs.lint.matrix]]
|
[tool.pyright]
|
||||||
python = ["3.8", "3.9", "3.10", "3.11"]
|
typeCheckingMode = "strict"
|
||||||
|
pythonVersion = "3.9"
|
||||||
|
reportUnnecessaryTypeIgnoreComment = true
|
||||||
|
reportShadowedImports = true
|
||||||
|
reportUnusedExpression = true
|
||||||
|
reportMatchNotExhaustive = true
|
||||||
|
# venvPath = "."
|
||||||
|
# venv = "venv"
|
||||||
|
|
||||||
[tool.hatch.envs.lint]
|
# ruff
|
||||||
detached = true
|
|
||||||
dependencies = [
|
|
||||||
"mypy==1.8.0",
|
|
||||||
"ruff==0.2.2",
|
|
||||||
]
|
|
||||||
|
|
||||||
[tool.hatch.envs.lint.scripts]
|
|
||||||
typing = "mypy --non-interactive --install-types {args:src/mangadlp}"
|
|
||||||
style = [
|
|
||||||
"ruff check --diff {args:.}",
|
|
||||||
"ruff format --check --diff {args:.}"
|
|
||||||
]
|
|
||||||
fmt = [
|
|
||||||
"ruff check --fix {args:.}",
|
|
||||||
"ruff format {args:.}",
|
|
||||||
"style"
|
|
||||||
]
|
|
||||||
all = ["style", "typing"]
|
|
||||||
|
|
||||||
###
|
|
||||||
### ruff
|
|
||||||
###
|
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
target-version = "py38"
|
target-version = "py39"
|
||||||
line-length = 100
|
select = [
|
||||||
indent-width = 4
|
"E", # pycodetyle err
|
||||||
|
"W", # pycodetyle warn
|
||||||
|
"D", # pydocstyle
|
||||||
|
"C90", # mccabe
|
||||||
|
"I", # isort
|
||||||
|
"PLE", # pylint err
|
||||||
|
"PLW", # pylint warn
|
||||||
|
"PLC", # pylint convention
|
||||||
|
"PLR", # pylint refactor
|
||||||
|
"F", # pyflakes
|
||||||
|
"RUF", # ruff specific
|
||||||
|
]
|
||||||
|
line-length = 88
|
||||||
fix = true
|
fix = true
|
||||||
show-fixes = true
|
show-fixes = true
|
||||||
|
format = "grouped"
|
||||||
|
ignore-init-module-imports = true
|
||||||
respect-gitignore = true
|
respect-gitignore = true
|
||||||
src = ["src", "tests"]
|
ignore = ["E501", "D103", "D100", "D102", "PLR2004"]
|
||||||
exclude = [
|
exclude = [
|
||||||
".direnv",
|
".direnv",
|
||||||
".git",
|
".git",
|
||||||
".mypy_cache",
|
".mypy_cache",
|
||||||
".ruff_cache",
|
".ruff_cache",
|
||||||
".svn",
|
".svn",
|
||||||
".tox",
|
|
||||||
".nox",
|
|
||||||
".venv",
|
".venv",
|
||||||
"venv",
|
"venv",
|
||||||
"__pypackages__",
|
"__pypackages__",
|
||||||
"build",
|
"build",
|
||||||
"dist",
|
"dist",
|
||||||
"node_modules",
|
|
||||||
"venv",
|
"venv",
|
||||||
"contrib"
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.ruff.lint]
|
[tool.ruff.per-file-ignores]
|
||||||
select = [
|
|
||||||
"A",
|
|
||||||
"ARG",
|
|
||||||
"B",
|
|
||||||
"C",
|
|
||||||
"DTZ",
|
|
||||||
"E",
|
|
||||||
"EM",
|
|
||||||
"F",
|
|
||||||
"FBT",
|
|
||||||
"I",
|
|
||||||
"ICN",
|
|
||||||
"ISC",
|
|
||||||
"N",
|
|
||||||
"PLC",
|
|
||||||
"PLE",
|
|
||||||
"PLR",
|
|
||||||
"PLW",
|
|
||||||
"Q",
|
|
||||||
"RUF",
|
|
||||||
"S",
|
|
||||||
"T",
|
|
||||||
"TID",
|
|
||||||
"UP",
|
|
||||||
"W",
|
|
||||||
"YTT",
|
|
||||||
]
|
|
||||||
ignore-init-module-imports = true
|
|
||||||
ignore = ["E501", "D103", "D100", "D102", "PLR2004", "D403", "ISC001", "FBT001", "FBT002", "FBT003", "W505"]
|
|
||||||
unfixable = ["F401"]
|
|
||||||
|
|
||||||
[tool.ruff.format]
|
|
||||||
quote-style = "double"
|
|
||||||
indent-style = "space"
|
|
||||||
skip-magic-trailing-comma = false
|
|
||||||
line-ending = "lf"
|
|
||||||
docstring-code-format = true
|
|
||||||
|
|
||||||
[tool.ruff.lint.per-file-ignores]
|
|
||||||
"__init__.py" = ["D104"]
|
"__init__.py" = ["D104"]
|
||||||
"__about__.py" = ["D104", "F841"]
|
|
||||||
"tests/**/*" = ["PLR2004", "S101", "TID252", "T201", "ARG001", "S603", "S605"]
|
|
||||||
|
|
||||||
[tool.ruff.lint.pyupgrade]
|
[tool.ruff.pylint]
|
||||||
keep-runtime-typing = true
|
max-args = 10
|
||||||
|
|
||||||
[tool.ruff.lint.isort]
|
[tool.ruff.mccabe]
|
||||||
lines-after-imports = 2
|
max-complexity = 10
|
||||||
known-first-party = ["mangadlp"]
|
|
||||||
|
|
||||||
[tool.ruff.lint.flake8-tidy-imports]
|
[tool.ruff.pydocstyle]
|
||||||
ban-relative-imports = "all"
|
|
||||||
|
|
||||||
[tool.ruff.lint.pylint]
|
|
||||||
max-branches = 24
|
|
||||||
max-returns = 12
|
|
||||||
max-statements = 100
|
|
||||||
max-args = 15
|
|
||||||
allow-magic-value-types = ["str", "bytes", "complex", "float", "int"]
|
|
||||||
|
|
||||||
[tool.ruff.lint.mccabe]
|
|
||||||
max-complexity = 15
|
|
||||||
|
|
||||||
[tool.ruff.lint.pydocstyle]
|
|
||||||
convention = "google"
|
convention = "google"
|
||||||
|
|
||||||
[tool.ruff.lint.pycodestyle]
|
[tool.ruff.pycodestyle]
|
||||||
max-doc-length = 100
|
max-doc-length = 88
|
||||||
|
|
||||||
###
|
# pytest
|
||||||
### mypy
|
|
||||||
###
|
|
||||||
|
|
||||||
[tool.mypy]
|
|
||||||
#plugins = ["pydantic.mypy"]
|
|
||||||
follow_imports = "silent"
|
|
||||||
warn_redundant_casts = true
|
|
||||||
warn_unused_ignores = true
|
|
||||||
disallow_any_generics = true
|
|
||||||
check_untyped_defs = true
|
|
||||||
no_implicit_reexport = true
|
|
||||||
ignore_missing_imports = true
|
|
||||||
warn_return_any = true
|
|
||||||
pretty = true
|
|
||||||
show_column_numbers = true
|
|
||||||
show_error_codes = true
|
|
||||||
show_error_context = true
|
|
||||||
|
|
||||||
#[tool.pydantic-mypy]
|
|
||||||
#init_forbid_extra = true
|
|
||||||
#init_typed = true
|
|
||||||
#warn_required_dynamic_aliases = true
|
|
||||||
|
|
||||||
###
|
|
||||||
### pytest
|
|
||||||
###
|
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
pythonpath = ["src"]
|
pythonpath = ["."]
|
||||||
addopts = "--color=yes --exitfirst --verbose -ra"
|
|
||||||
filterwarnings = [
|
|
||||||
'ignore:Jupyter is migrating its paths to use standard platformdirs:DeprecationWarning',
|
|
||||||
]
|
|
||||||
|
|
||||||
###
|
# coverage
|
||||||
### coverage
|
|
||||||
###
|
|
||||||
|
|
||||||
[tool.coverage.run]
|
[tool.coverage.run]
|
||||||
source_pkgs = ["mangadlp", "tests"]
|
source = ["mangadlp"]
|
||||||
branch = true
|
branch = true
|
||||||
parallel = true
|
command_line = "-m pytest --exitfirst"
|
||||||
omit = ["src/mangadlp/__about__.py"]
|
|
||||||
|
|
||||||
[tool.coverage.paths]
|
|
||||||
mangadlp = ["src/mangadlp", "*/manga-dlp/src/mangadlp"]
|
|
||||||
tests = ["tests", "*/manga-dlp/tests"]
|
|
||||||
|
|
||||||
[tool.coverage.report]
|
[tool.coverage.report]
|
||||||
# Regexes for lines to exclude from consideration
|
# Regexes for lines to exclude from consideration
|
||||||
|
@ -258,7 +161,5 @@ exclude_lines = [
|
||||||
"if __name__ == .__main__.:",
|
"if __name__ == .__main__.:",
|
||||||
# Don't complain about abstract methods, they aren't run:
|
# Don't complain about abstract methods, they aren't run:
|
||||||
"@(abc.)?abstractmethod",
|
"@(abc.)?abstractmethod",
|
||||||
"no cov",
|
|
||||||
"if TYPE_CHECKING:",
|
|
||||||
]
|
]
|
||||||
# ignore_errors = true
|
ignore_errors = true
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
"extends": ["local>44net/renovate"]
|
"extends": [
|
||||||
|
"local>44net-assets/docker-renovate-conf"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,8 @@ sonar.links.scm=https://github.com/olofvndrhr/manga-dlp
|
||||||
sonar.links.issue=https://github.com/olofvndrhr/manga-dlp/issues
|
sonar.links.issue=https://github.com/olofvndrhr/manga-dlp/issues
|
||||||
sonar.links.ci=https://ci.44net.ch/olofvndrhr/manga-dlp
|
sonar.links.ci=https://ci.44net.ch/olofvndrhr/manga-dlp
|
||||||
#
|
#
|
||||||
sonar.python.version=3.9
|
sonar.sources=mangadlp
|
||||||
sonar.sources=src/mangadlp
|
|
||||||
sonar.tests=tests
|
sonar.tests=tests
|
||||||
#sonar.exclusions=
|
sonar.exclusions=docker/**,contrib/**
|
||||||
|
sonar.python.version=3.9
|
||||||
sonar.python.coverage.reportPaths=coverage.xml
|
sonar.python.coverage.reportPaths=coverage.xml
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
__version__ = "2.4.1"
|
|
|
@ -1,7 +0,0 @@
|
||||||
import sys
|
|
||||||
|
|
||||||
import mangadlp.cli
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
sys.exit(mangadlp.cli.main())
|
|
|
@ -5,9 +5,7 @@ from mangadlp.app import MangaDLP
|
||||||
|
|
||||||
|
|
||||||
def test_check_api_mangadex():
|
def test_check_api_mangadex():
|
||||||
url = (
|
url = "https://mangadex.org/title/a96676e5-8ae2-425e-b549-7f15dd34a6d8/komi-san-wa-komyushou-desu"
|
||||||
"https://mangadex.org/title/a96676e5-8ae2-425e-b549-7f15dd34a6d8/komi-san-wa-komyushou-desu"
|
|
||||||
)
|
|
||||||
test = MangaDLP(url_uuid=url, list_chapters=True, download_wait=2)
|
test = MangaDLP(url_uuid=url, list_chapters=True, download_wait=2)
|
||||||
|
|
||||||
assert test.api_used == Mangadex
|
assert test.api_used == Mangadex
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
import shutil
|
import shutil
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import requests
|
import requests
|
||||||
from pytest import MonkeyPatch
|
|
||||||
|
|
||||||
from mangadlp import downloader
|
from mangadlp import downloader
|
||||||
|
|
||||||
|
@ -19,7 +17,7 @@ def test_downloader():
|
||||||
]
|
]
|
||||||
chapter_path = Path("tests/test_folder1")
|
chapter_path = Path("tests/test_folder1")
|
||||||
chapter_path.mkdir(parents=True, exist_ok=True)
|
chapter_path.mkdir(parents=True, exist_ok=True)
|
||||||
images: List[str] = []
|
images = []
|
||||||
downloader.download_chapter(urls, str(chapter_path), 2)
|
downloader.download_chapter(urls, str(chapter_path), 2)
|
||||||
for file in chapter_path.iterdir():
|
for file in chapter_path.iterdir():
|
||||||
images.append(file.name)
|
images.append(file.name)
|
||||||
|
@ -30,7 +28,7 @@ def test_downloader():
|
||||||
shutil.rmtree(chapter_path, ignore_errors=True)
|
shutil.rmtree(chapter_path, ignore_errors=True)
|
||||||
|
|
||||||
|
|
||||||
def test_downloader_fail(monkeypatch: MonkeyPatch):
|
def test_downloader_fail(monkeypatch):
|
||||||
images = [
|
images = [
|
||||||
"https://uploads.mangadex.org/data/f1117c5e7aff315bc3429a8791c89d63/A1-c111d78b798f1dda1879334a3478f7ae4503578e8adf1af0fcc4e14d2a396ad4.png",
|
"https://uploads.mangadex.org/data/f1117c5e7aff315bc3429a8791c89d63/A1-c111d78b798f1dda1879334a3478f7ae4503578e8adf1af0fcc4e14d2a396ad4.png",
|
||||||
"https://uploads.mangadex.org/data/f1117c5e7aff315bc3429a8791c89d63/A2-717ec3c83e8e05ed7b505941431a417ebfed6a005f78b89650efd3b088b951ec.png",
|
"https://uploads.mangadex.org/data/f1117c5e7aff315bc3429a8791c89d63/A2-717ec3c83e8e05ed7b505941431a417ebfed6a005f78b89650efd3b088b951ec.png",
|
||||||
|
|
|
@ -20,9 +20,7 @@ def test_no_read_and_url():
|
||||||
chapters = "1"
|
chapters = "1"
|
||||||
file_format = "cbz"
|
file_format = "cbz"
|
||||||
download_path = "tests"
|
download_path = "tests"
|
||||||
command_args = (
|
command_args = f"-l {language} -c {chapters} --path {download_path} --format {file_format} --debug"
|
||||||
f"-l {language} -c {chapters} --path {download_path} --format {file_format} --debug"
|
|
||||||
)
|
|
||||||
script_path = "manga-dlp.py"
|
script_path = "manga-dlp.py"
|
||||||
assert os.system(f"python3 {script_path} {command_args}") != 0
|
assert os.system(f"python3 {script_path} {command_args}") != 0
|
||||||
|
|
||||||
|
@ -32,9 +30,7 @@ def test_no_chaps():
|
||||||
language = "en"
|
language = "en"
|
||||||
file_format = "cbz"
|
file_format = "cbz"
|
||||||
download_path = "tests"
|
download_path = "tests"
|
||||||
command_args = (
|
command_args = f"-u {url_uuid} -l {language} --path {download_path} --format {file_format} --debug"
|
||||||
f"-u {url_uuid} -l {language} --path {download_path} --format {file_format} --debug"
|
|
||||||
)
|
|
||||||
script_path = "manga-dlp.py"
|
script_path = "manga-dlp.py"
|
||||||
assert os.system(f"python3 {script_path} {command_args}") != 0
|
assert os.system(f"python3 {script_path} {command_args}") != 0
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from pytest import MonkeyPatch
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
@ -19,7 +18,7 @@ def wait_20s():
|
||||||
time.sleep(20)
|
time.sleep(20)
|
||||||
|
|
||||||
|
|
||||||
def test_manga_pre_hook(wait_10s: MonkeyPatch):
|
def test_manga_pre_hook(wait_10s):
|
||||||
url_uuid = "https://mangadex.org/title/0aea9f43-d4a9-4bf7-bebc-550a512f9b95/shikimori-s-not-just-a-cutie"
|
url_uuid = "https://mangadex.org/title/0aea9f43-d4a9-4bf7-bebc-550a512f9b95/shikimori-s-not-just-a-cutie"
|
||||||
manga_path = Path("tests/Shikimori's Not Just a Cutie")
|
manga_path = Path("tests/Shikimori's Not Just a Cutie")
|
||||||
language = "en"
|
language = "en"
|
||||||
|
@ -51,7 +50,7 @@ def test_manga_pre_hook(wait_10s: MonkeyPatch):
|
||||||
hook_file.unlink()
|
hook_file.unlink()
|
||||||
|
|
||||||
|
|
||||||
def test_manga_post_hook(wait_10s: MonkeyPatch):
|
def test_manga_post_hook(wait_10s):
|
||||||
url_uuid = "https://mangadex.org/title/0aea9f43-d4a9-4bf7-bebc-550a512f9b95/shikimori-s-not-just-a-cutie"
|
url_uuid = "https://mangadex.org/title/0aea9f43-d4a9-4bf7-bebc-550a512f9b95/shikimori-s-not-just-a-cutie"
|
||||||
manga_path = Path("tests/Shikimori's Not Just a Cutie")
|
manga_path = Path("tests/Shikimori's Not Just a Cutie")
|
||||||
language = "en"
|
language = "en"
|
||||||
|
@ -83,7 +82,7 @@ def test_manga_post_hook(wait_10s: MonkeyPatch):
|
||||||
hook_file.unlink()
|
hook_file.unlink()
|
||||||
|
|
||||||
|
|
||||||
def test_chapter_pre_hook(wait_10s: MonkeyPatch):
|
def test_chapter_pre_hook(wait_10s):
|
||||||
url_uuid = "https://mangadex.org/title/0aea9f43-d4a9-4bf7-bebc-550a512f9b95/shikimori-s-not-just-a-cutie"
|
url_uuid = "https://mangadex.org/title/0aea9f43-d4a9-4bf7-bebc-550a512f9b95/shikimori-s-not-just-a-cutie"
|
||||||
manga_path = Path("tests/Shikimori's Not Just a Cutie")
|
manga_path = Path("tests/Shikimori's Not Just a Cutie")
|
||||||
language = "en"
|
language = "en"
|
||||||
|
@ -115,7 +114,7 @@ def test_chapter_pre_hook(wait_10s: MonkeyPatch):
|
||||||
hook_file.unlink()
|
hook_file.unlink()
|
||||||
|
|
||||||
|
|
||||||
def test_chapter_post_hook(wait_10s: MonkeyPatch):
|
def test_chapter_post_hook(wait_10s):
|
||||||
url_uuid = "https://mangadex.org/title/0aea9f43-d4a9-4bf7-bebc-550a512f9b95/shikimori-s-not-just-a-cutie"
|
url_uuid = "https://mangadex.org/title/0aea9f43-d4a9-4bf7-bebc-550a512f9b95/shikimori-s-not-just-a-cutie"
|
||||||
manga_path = Path("tests/Shikimori's Not Just a Cutie")
|
manga_path = Path("tests/Shikimori's Not Just a Cutie")
|
||||||
language = "en"
|
language = "en"
|
||||||
|
@ -147,7 +146,7 @@ def test_chapter_post_hook(wait_10s: MonkeyPatch):
|
||||||
hook_file.unlink()
|
hook_file.unlink()
|
||||||
|
|
||||||
|
|
||||||
def test_all_hooks(wait_10s: MonkeyPatch):
|
def test_all_hooks(wait_10s):
|
||||||
url_uuid = "https://mangadex.org/title/0aea9f43-d4a9-4bf7-bebc-550a512f9b95/shikimori-s-not-just-a-cutie"
|
url_uuid = "https://mangadex.org/title/0aea9f43-d4a9-4bf7-bebc-550a512f9b95/shikimori-s-not-just-a-cutie"
|
||||||
manga_path = Path("tests/Shikimori's Not Just a Cutie")
|
manga_path = Path("tests/Shikimori's Not Just a Cutie")
|
||||||
language = "en"
|
language = "en"
|
||||||
|
|
|
@ -5,7 +5,6 @@ from pathlib import Path
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import xmlschema
|
import xmlschema
|
||||||
from pytest import MonkeyPatch
|
|
||||||
|
|
||||||
from mangadlp.metadata import validate_metadata, write_metadata
|
from mangadlp.metadata import validate_metadata, write_metadata
|
||||||
|
|
||||||
|
@ -111,10 +110,8 @@ def test_metadata_validation_values2():
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def test_metadata_chapter_validity(wait_20s: MonkeyPatch):
|
def test_metadata_chapter_validity(wait_20s):
|
||||||
url_uuid = (
|
url_uuid = "https://mangadex.org/title/76ee7069-23b4-493c-bc44-34ccbf3051a8/tomo-chan-wa-onna-no-ko"
|
||||||
"https://mangadex.org/title/76ee7069-23b4-493c-bc44-34ccbf3051a8/tomo-chan-wa-onna-no-ko"
|
|
||||||
)
|
|
||||||
manga_path = Path("tests/Tomo-chan wa Onna no ko")
|
manga_path = Path("tests/Tomo-chan wa Onna no ko")
|
||||||
metadata_path = manga_path / "Ch. 1 - Once In A Life Time Misfire/ComicInfo.xml"
|
metadata_path = manga_path / "Ch. 1 - Once In A Life Time Misfire/ComicInfo.xml"
|
||||||
language = "en"
|
language = "en"
|
||||||
|
@ -133,7 +130,7 @@ def test_metadata_chapter_validity(wait_20s: MonkeyPatch):
|
||||||
"",
|
"",
|
||||||
"--debug",
|
"--debug",
|
||||||
]
|
]
|
||||||
schema = xmlschema.XMLSchema("src/mangadlp/metadata/ComicInfo_v2.0.xsd")
|
schema = xmlschema.XMLSchema("mangadlp/metadata/ComicInfo_v2.0.xsd")
|
||||||
|
|
||||||
script_path = "manga-dlp.py"
|
script_path = "manga-dlp.py"
|
||||||
command = ["python3", script_path, *command_args]
|
command = ["python3", script_path, *command_args]
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
import pytest
|
import pytest
|
||||||
import requests
|
import requests
|
||||||
from pytest import MonkeyPatch
|
|
||||||
|
|
||||||
from mangadlp.api.mangadex import Mangadex
|
from mangadlp.api.mangadex import Mangadex
|
||||||
|
|
||||||
|
|
||||||
def test_uuid_link():
|
def test_uuid_link():
|
||||||
url_uuid = (
|
url_uuid = "https://mangadex.org/title/a96676e5-8ae2-425e-b549-7f15dd34a6d8/komi-san-wa-komyushou-desu"
|
||||||
"https://mangadex.org/title/a96676e5-8ae2-425e-b549-7f15dd34a6d8/komi-san-wa-komyushou-desu"
|
|
||||||
)
|
|
||||||
language = "en"
|
language = "en"
|
||||||
forcevol = False
|
forcevol = False
|
||||||
test = Mangadex(url_uuid, language, forcevol)
|
test = Mangadex(url_uuid, language, forcevol)
|
||||||
|
@ -36,9 +33,7 @@ def test_uuid_link_false():
|
||||||
|
|
||||||
|
|
||||||
def test_title():
|
def test_title():
|
||||||
url_uuid = (
|
url_uuid = "https://mangadex.org/title/a96676e5-8ae2-425e-b549-7f15dd34a6d8/komi-san-wa-komyushou-desu"
|
||||||
"https://mangadex.org/title/a96676e5-8ae2-425e-b549-7f15dd34a6d8/komi-san-wa-komyushou-desu"
|
|
||||||
)
|
|
||||||
language = "en"
|
language = "en"
|
||||||
forcevol = False
|
forcevol = False
|
||||||
test = Mangadex(url_uuid, language, forcevol)
|
test = Mangadex(url_uuid, language, forcevol)
|
||||||
|
@ -56,9 +51,7 @@ def test_alt_title():
|
||||||
|
|
||||||
|
|
||||||
def test_alt_title_fallback():
|
def test_alt_title_fallback():
|
||||||
url_uuid = (
|
url_uuid = "https://mangadex.org/title/d7037b2a-874a-4360-8a7b-07f2899152fd/mairimashita-iruma-kun"
|
||||||
"https://mangadex.org/title/d7037b2a-874a-4360-8a7b-07f2899152fd/mairimashita-iruma-kun"
|
|
||||||
)
|
|
||||||
language = "fr"
|
language = "fr"
|
||||||
forcevol = False
|
forcevol = False
|
||||||
test = Mangadex(url_uuid, language, forcevol)
|
test = Mangadex(url_uuid, language, forcevol)
|
||||||
|
@ -67,9 +60,7 @@ def test_alt_title_fallback():
|
||||||
|
|
||||||
|
|
||||||
def test_chapter_infos():
|
def test_chapter_infos():
|
||||||
url_uuid = (
|
url_uuid = "https://mangadex.org/title/a96676e5-8ae2-425e-b549-7f15dd34a6d8/komi-san-wa-komyushou-desu"
|
||||||
"https://mangadex.org/title/a96676e5-8ae2-425e-b549-7f15dd34a6d8/komi-san-wa-komyushou-desu"
|
|
||||||
)
|
|
||||||
language = "en"
|
language = "en"
|
||||||
forcevol = False
|
forcevol = False
|
||||||
test = Mangadex(url_uuid, language, forcevol)
|
test = Mangadex(url_uuid, language, forcevol)
|
||||||
|
@ -88,9 +79,7 @@ def test_chapter_infos():
|
||||||
|
|
||||||
|
|
||||||
def test_non_existing_manga():
|
def test_non_existing_manga():
|
||||||
url_uuid = (
|
url_uuid = "https://mangadex.org/title/a96676e5-8ae2-425e-b549-999999999999/komi-san-wa-komyushou-desu"
|
||||||
"https://mangadex.org/title/a96676e5-8ae2-425e-b549-999999999999/komi-san-wa-komyushou-desu"
|
|
||||||
)
|
|
||||||
language = "en"
|
language = "en"
|
||||||
forcevol = False
|
forcevol = False
|
||||||
|
|
||||||
|
@ -99,12 +88,12 @@ def test_non_existing_manga():
|
||||||
assert e.type == KeyError
|
assert e.type == KeyError
|
||||||
|
|
||||||
|
|
||||||
def test_api_failure(monkeypatch: MonkeyPatch):
|
def test_api_failure(monkeypatch):
|
||||||
fail_url = "https://api.mangadex.nonexistant/manga/a96676e5-8ae2-425e-b549-7f15dd34a6d8"
|
fail_url = (
|
||||||
monkeypatch.setattr(requests, "get", fail_url)
|
"https://api.mangadex.nonexistant/manga/a96676e5-8ae2-425e-b549-7f15dd34a6d8"
|
||||||
url_uuid = (
|
|
||||||
"https://mangadex.org/title/a96676e5-8ae2-425e-b549-7f15dd34a6d8/komi-san-wa-komyushou-desu"
|
|
||||||
)
|
)
|
||||||
|
monkeypatch.setattr(requests, "get", fail_url)
|
||||||
|
url_uuid = "https://mangadex.org/title/a96676e5-8ae2-425e-b549-7f15dd34a6d8/komi-san-wa-komyushou-desu"
|
||||||
language = "en"
|
language = "en"
|
||||||
forcevol = False
|
forcevol = False
|
||||||
|
|
||||||
|
@ -114,9 +103,7 @@ def test_api_failure(monkeypatch: MonkeyPatch):
|
||||||
|
|
||||||
|
|
||||||
def test_chapter_lang_en():
|
def test_chapter_lang_en():
|
||||||
url_uuid = (
|
url_uuid = "https://mangadex.org/title/a96676e5-8ae2-425e-b549-7f15dd34a6d8/komi-san-wa-komyushou-desu"
|
||||||
"https://mangadex.org/title/a96676e5-8ae2-425e-b549-7f15dd34a6d8/komi-san-wa-komyushou-desu"
|
|
||||||
)
|
|
||||||
language = "en"
|
language = "en"
|
||||||
forcevol = False
|
forcevol = False
|
||||||
test = Mangadex(url_uuid, language, forcevol)
|
test = Mangadex(url_uuid, language, forcevol)
|
||||||
|
@ -125,9 +112,7 @@ def test_chapter_lang_en():
|
||||||
|
|
||||||
|
|
||||||
def test_empty_chapter_lang():
|
def test_empty_chapter_lang():
|
||||||
url_uuid = (
|
url_uuid = "https://mangadex.org/title/a96676e5-8ae2-425e-b549-7f15dd34a6d8/komi-san-wa-komyushou-desu"
|
||||||
"https://mangadex.org/title/a96676e5-8ae2-425e-b549-7f15dd34a6d8/komi-san-wa-komyushou-desu"
|
|
||||||
)
|
|
||||||
language = "ch"
|
language = "ch"
|
||||||
forcevol = False
|
forcevol = False
|
||||||
|
|
||||||
|
@ -137,9 +122,7 @@ def test_empty_chapter_lang():
|
||||||
|
|
||||||
|
|
||||||
def test_not_existing_lang():
|
def test_not_existing_lang():
|
||||||
url_uuid = (
|
url_uuid = "https://mangadex.org/title/a96676e5-8ae2-425e-b549-7f15dd34a6d8/komi-san-wa-komyushou-desu"
|
||||||
"https://mangadex.org/title/a96676e5-8ae2-425e-b549-7f15dd34a6d8/komi-san-wa-komyushou-desu"
|
|
||||||
)
|
|
||||||
language = "zz"
|
language = "zz"
|
||||||
forcevol = False
|
forcevol = False
|
||||||
|
|
||||||
|
@ -149,7 +132,9 @@ def test_not_existing_lang():
|
||||||
|
|
||||||
|
|
||||||
def test_create_chapter_list():
|
def test_create_chapter_list():
|
||||||
url_uuid = "https://mangadex.org/title/6fef1f74-a0ad-4f0d-99db-d32a7cd24098/fire-punch"
|
url_uuid = (
|
||||||
|
"https://mangadex.org/title/6fef1f74-a0ad-4f0d-99db-d32a7cd24098/fire-punch"
|
||||||
|
)
|
||||||
language = "en"
|
language = "en"
|
||||||
forcevol = False
|
forcevol = False
|
||||||
test = Mangadex(url_uuid, language, forcevol)
|
test = Mangadex(url_uuid, language, forcevol)
|
||||||
|
@ -175,76 +160,15 @@ def test_create_chapter_list():
|
||||||
"19",
|
"19",
|
||||||
"20",
|
"20",
|
||||||
"21",
|
"21",
|
||||||
"22",
|
|
||||||
"23",
|
|
||||||
"24",
|
|
||||||
"25",
|
|
||||||
"26",
|
|
||||||
"27",
|
|
||||||
"28",
|
|
||||||
"29",
|
|
||||||
"30",
|
|
||||||
"31",
|
|
||||||
"32",
|
|
||||||
"33",
|
|
||||||
"34",
|
|
||||||
"34.5",
|
|
||||||
"35",
|
|
||||||
"36",
|
|
||||||
"37",
|
|
||||||
"38",
|
|
||||||
"39",
|
|
||||||
"40",
|
|
||||||
"41",
|
|
||||||
"42",
|
|
||||||
"43",
|
|
||||||
"44",
|
|
||||||
"45",
|
|
||||||
"46",
|
|
||||||
"47",
|
|
||||||
"48",
|
|
||||||
"49",
|
|
||||||
"50",
|
|
||||||
"51",
|
|
||||||
"52",
|
|
||||||
"53",
|
|
||||||
"54",
|
|
||||||
"55",
|
|
||||||
"56",
|
|
||||||
"57",
|
|
||||||
"58",
|
|
||||||
"59",
|
|
||||||
"60",
|
|
||||||
"61",
|
|
||||||
"62",
|
|
||||||
"63",
|
|
||||||
"64",
|
|
||||||
"65",
|
|
||||||
"66",
|
|
||||||
"67",
|
|
||||||
"68",
|
|
||||||
"69",
|
|
||||||
"70",
|
|
||||||
"71",
|
|
||||||
"72",
|
|
||||||
"73",
|
|
||||||
"74",
|
|
||||||
"75",
|
|
||||||
"76",
|
|
||||||
"77",
|
|
||||||
"78",
|
|
||||||
"79",
|
|
||||||
"80",
|
|
||||||
"81",
|
|
||||||
"82",
|
|
||||||
"83",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
assert test.create_chapter_list() == test_list
|
assert test.create_chapter_list() == test_list
|
||||||
|
|
||||||
|
|
||||||
def test_create_chapter_list_forcevol():
|
def test_create_chapter_list_forcevol():
|
||||||
url_uuid = "https://mangadex.org/title/6fef1f74-a0ad-4f0d-99db-d32a7cd24098/fire-punch"
|
url_uuid = (
|
||||||
|
"https://mangadex.org/title/6fef1f74-a0ad-4f0d-99db-d32a7cd24098/fire-punch"
|
||||||
|
)
|
||||||
language = "en"
|
language = "en"
|
||||||
forcevol = True
|
forcevol = True
|
||||||
test = Mangadex(url_uuid, language, forcevol)
|
test = Mangadex(url_uuid, language, forcevol)
|
||||||
|
@ -270,78 +194,13 @@ def test_create_chapter_list_forcevol():
|
||||||
"3:19",
|
"3:19",
|
||||||
"3:20",
|
"3:20",
|
||||||
"3:21",
|
"3:21",
|
||||||
"3:22",
|
|
||||||
"3:23",
|
|
||||||
"3:24",
|
|
||||||
"3:25",
|
|
||||||
"3:26",
|
|
||||||
"3:27",
|
|
||||||
"3:28",
|
|
||||||
"4:29",
|
|
||||||
"4:30",
|
|
||||||
"4:31",
|
|
||||||
"4:32",
|
|
||||||
"4:33",
|
|
||||||
"4:34",
|
|
||||||
"4:34.5",
|
|
||||||
"4:35",
|
|
||||||
"4:36",
|
|
||||||
"4:37",
|
|
||||||
"4:38",
|
|
||||||
"4:39",
|
|
||||||
"5:40",
|
|
||||||
"5:41",
|
|
||||||
"5:42",
|
|
||||||
"5:43",
|
|
||||||
"5:44",
|
|
||||||
"5:45",
|
|
||||||
"5:46",
|
|
||||||
"5:47",
|
|
||||||
"5:48",
|
|
||||||
"5:49",
|
|
||||||
"6:50",
|
|
||||||
"6:51",
|
|
||||||
"6:52",
|
|
||||||
"6:53",
|
|
||||||
"6:54",
|
|
||||||
"6:55",
|
|
||||||
"6:56",
|
|
||||||
"6:57",
|
|
||||||
"6:58",
|
|
||||||
"6:59",
|
|
||||||
"6:60",
|
|
||||||
"7:61",
|
|
||||||
"7:62",
|
|
||||||
"7:63",
|
|
||||||
"7:64",
|
|
||||||
"7:65",
|
|
||||||
"7:66",
|
|
||||||
"7:67",
|
|
||||||
"7:68",
|
|
||||||
"7:69",
|
|
||||||
"7:70",
|
|
||||||
"8:71",
|
|
||||||
"8:72",
|
|
||||||
"8:73",
|
|
||||||
"8:74",
|
|
||||||
"8:75",
|
|
||||||
"8:76",
|
|
||||||
"8:77",
|
|
||||||
"8:78",
|
|
||||||
"8:79",
|
|
||||||
"8:80",
|
|
||||||
"8:81",
|
|
||||||
"8:82",
|
|
||||||
"8:83",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
assert test.create_chapter_list() == test_list
|
assert test.create_chapter_list() == test_list
|
||||||
|
|
||||||
|
|
||||||
def test_get_chapter_images():
|
def test_get_chapter_images():
|
||||||
url_uuid = (
|
url_uuid = "https://mangadex.org/title/a96676e5-8ae2-425e-b549-7f15dd34a6d8/komi-san-wa-komyushou-desu"
|
||||||
"https://mangadex.org/title/a96676e5-8ae2-425e-b549-7f15dd34a6d8/komi-san-wa-komyushou-desu"
|
|
||||||
)
|
|
||||||
language = "en"
|
language = "en"
|
||||||
forcevol = False
|
forcevol = False
|
||||||
test = Mangadex(url_uuid, language, forcevol)
|
test = Mangadex(url_uuid, language, forcevol)
|
||||||
|
@ -367,11 +226,11 @@ def test_get_chapter_images():
|
||||||
assert test.get_chapter_images(chapter_num, 2) == test_list
|
assert test.get_chapter_images(chapter_num, 2) == test_list
|
||||||
|
|
||||||
|
|
||||||
def test_get_chapter_images_error(monkeypatch: MonkeyPatch):
|
def test_get_chapter_images_error(monkeypatch):
|
||||||
fail_url = "https://api.mangadex.org/at-home/server/e86ec2c4-c5e4-4710-bfaa-999999999999"
|
fail_url = (
|
||||||
url_uuid = (
|
"https://api.mangadex.org/at-home/server/e86ec2c4-c5e4-4710-bfaa-999999999999"
|
||||||
"https://mangadex.org/title/a96676e5-8ae2-425e-b549-7f15dd34a6d8/komi-san-wa-komyushou-desu"
|
|
||||||
)
|
)
|
||||||
|
url_uuid = "https://mangadex.org/title/a96676e5-8ae2-425e-b549-7f15dd34a6d8/komi-san-wa-komyushou-desu"
|
||||||
language = "en"
|
language = "en"
|
||||||
forcevol = False
|
forcevol = False
|
||||||
test = Mangadex(url_uuid, language, forcevol)
|
test = Mangadex(url_uuid, language, forcevol)
|
||||||
|
@ -382,9 +241,7 @@ def test_get_chapter_images_error(monkeypatch: MonkeyPatch):
|
||||||
|
|
||||||
|
|
||||||
def test_chapter_metadata():
|
def test_chapter_metadata():
|
||||||
url_uuid = (
|
url_uuid = "https://mangadex.org/title/a96676e5-8ae2-425e-b549-7f15dd34a6d8/komi-san-wa-komyushou-desu"
|
||||||
"https://mangadex.org/title/a96676e5-8ae2-425e-b549-7f15dd34a6d8/komi-san-wa-komyushou-desu"
|
|
||||||
)
|
|
||||||
language = "en"
|
language = "en"
|
||||||
forcevol = False
|
forcevol = False
|
||||||
test = Mangadex(url_uuid, language, forcevol)
|
test = Mangadex(url_uuid, language, forcevol)
|
||||||
|
|
|
@ -3,10 +3,8 @@ import platform
|
||||||
import shutil
|
import shutil
|
||||||
import time
|
import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from pytest import MonkeyPatch
|
|
||||||
|
|
||||||
from mangadlp import app
|
from mangadlp import app
|
||||||
|
|
||||||
|
@ -23,9 +21,11 @@ def wait_20s():
|
||||||
time.sleep(20)
|
time.sleep(20)
|
||||||
|
|
||||||
|
|
||||||
def test_full_api_mangadex(wait_20s: MonkeyPatch):
|
def test_full_api_mangadex(wait_20s):
|
||||||
manga_path = Path("tests/Tomo-chan wa Onna no ko")
|
manga_path = Path("tests/Tomo-chan wa Onna no ko")
|
||||||
chapter_path = Path("tests/Tomo-chan wa Onna no ko/Ch. 1 - Once In A Life Time Misfire.cbz")
|
chapter_path = Path(
|
||||||
|
"tests/Tomo-chan wa Onna no ko/Ch. 1 - Once In A Life Time Misfire.cbz"
|
||||||
|
)
|
||||||
mdlp = app.MangaDLP(
|
mdlp = app.MangaDLP(
|
||||||
url_uuid="https://mangadex.org/title/76ee7069-23b4-493c-bc44-34ccbf3051a8/tomo-chan-wa-onna-no-ko",
|
url_uuid="https://mangadex.org/title/76ee7069-23b4-493c-bc44-34ccbf3051a8/tomo-chan-wa-onna-no-ko",
|
||||||
language="en",
|
language="en",
|
||||||
|
@ -44,16 +44,16 @@ def test_full_api_mangadex(wait_20s: MonkeyPatch):
|
||||||
shutil.rmtree(manga_path, ignore_errors=True)
|
shutil.rmtree(manga_path, ignore_errors=True)
|
||||||
|
|
||||||
|
|
||||||
def test_full_with_input_cbz(wait_20s: MonkeyPatch):
|
def test_full_with_input_cbz(wait_20s):
|
||||||
url_uuid = (
|
url_uuid = "https://mangadex.org/title/76ee7069-23b4-493c-bc44-34ccbf3051a8/tomo-chan-wa-onna-no-ko"
|
||||||
"https://mangadex.org/title/76ee7069-23b4-493c-bc44-34ccbf3051a8/tomo-chan-wa-onna-no-ko"
|
|
||||||
)
|
|
||||||
language = "en"
|
language = "en"
|
||||||
chapters = "1"
|
chapters = "1"
|
||||||
file_format = "cbz"
|
file_format = "cbz"
|
||||||
download_path = "tests"
|
download_path = "tests"
|
||||||
manga_path = Path("tests/Tomo-chan wa Onna no ko")
|
manga_path = Path("tests/Tomo-chan wa Onna no ko")
|
||||||
chapter_path = Path("tests/Tomo-chan wa Onna no ko/Ch. 1 - Once In A Life Time Misfire.cbz")
|
chapter_path = Path(
|
||||||
|
"tests/Tomo-chan wa Onna no ko/Ch. 1 - Once In A Life Time Misfire.cbz"
|
||||||
|
)
|
||||||
command_args = f"-u {url_uuid} -l {language} -c {chapters} --path {download_path} --format {file_format} --debug --wait 2"
|
command_args = f"-u {url_uuid} -l {language} -c {chapters} --path {download_path} --format {file_format} --debug --wait 2"
|
||||||
script_path = "manga-dlp.py"
|
script_path = "manga-dlp.py"
|
||||||
os.system(f"python3 {script_path} {command_args}")
|
os.system(f"python3 {script_path} {command_args}")
|
||||||
|
@ -64,16 +64,16 @@ def test_full_with_input_cbz(wait_20s: MonkeyPatch):
|
||||||
shutil.rmtree(manga_path, ignore_errors=True)
|
shutil.rmtree(manga_path, ignore_errors=True)
|
||||||
|
|
||||||
|
|
||||||
def test_full_with_input_cbz_info(wait_20s: MonkeyPatch):
|
def test_full_with_input_cbz_info(wait_20s):
|
||||||
url_uuid = (
|
url_uuid = "https://mangadex.org/title/76ee7069-23b4-493c-bc44-34ccbf3051a8/tomo-chan-wa-onna-no-ko"
|
||||||
"https://mangadex.org/title/76ee7069-23b4-493c-bc44-34ccbf3051a8/tomo-chan-wa-onna-no-ko"
|
|
||||||
)
|
|
||||||
language = "en"
|
language = "en"
|
||||||
chapters = "1"
|
chapters = "1"
|
||||||
file_format = "cbz"
|
file_format = "cbz"
|
||||||
download_path = "tests"
|
download_path = "tests"
|
||||||
manga_path = Path("tests/Tomo-chan wa Onna no ko")
|
manga_path = Path("tests/Tomo-chan wa Onna no ko")
|
||||||
chapter_path = Path("tests/Tomo-chan wa Onna no ko/Ch. 1 - Once In A Life Time Misfire.cbz")
|
chapter_path = Path(
|
||||||
|
"tests/Tomo-chan wa Onna no ko/Ch. 1 - Once In A Life Time Misfire.cbz"
|
||||||
|
)
|
||||||
command_args = f"-u {url_uuid} -l {language} -c {chapters} --path {download_path} --format {file_format} --wait 2"
|
command_args = f"-u {url_uuid} -l {language} -c {chapters} --path {download_path} --format {file_format} --wait 2"
|
||||||
script_path = "manga-dlp.py"
|
script_path = "manga-dlp.py"
|
||||||
os.system(f"python3 {script_path} {command_args}")
|
os.system(f"python3 {script_path} {command_args}")
|
||||||
|
@ -84,17 +84,19 @@ def test_full_with_input_cbz_info(wait_20s: MonkeyPatch):
|
||||||
shutil.rmtree(manga_path, ignore_errors=True)
|
shutil.rmtree(manga_path, ignore_errors=True)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(platform.machine() != "x86_64", reason="pdf only supported on amd64")
|
@pytest.mark.skipif(
|
||||||
def test_full_with_input_pdf(wait_20s: MonkeyPatch):
|
platform.machine() != "x86_64", reason="pdf only supported on amd64"
|
||||||
url_uuid = (
|
)
|
||||||
"https://mangadex.org/title/76ee7069-23b4-493c-bc44-34ccbf3051a8/tomo-chan-wa-onna-no-ko"
|
def test_full_with_input_pdf(wait_20s):
|
||||||
)
|
url_uuid = "https://mangadex.org/title/76ee7069-23b4-493c-bc44-34ccbf3051a8/tomo-chan-wa-onna-no-ko"
|
||||||
language = "en"
|
language = "en"
|
||||||
chapters = "1"
|
chapters = "1"
|
||||||
file_format = "pdf"
|
file_format = "pdf"
|
||||||
download_path = "tests"
|
download_path = "tests"
|
||||||
manga_path = Path("tests/Tomo-chan wa Onna no ko")
|
manga_path = Path("tests/Tomo-chan wa Onna no ko")
|
||||||
chapter_path = Path("tests/Tomo-chan wa Onna no ko/Ch. 1 - Once In A Life Time Misfire.pdf")
|
chapter_path = Path(
|
||||||
|
"tests/Tomo-chan wa Onna no ko/Ch. 1 - Once In A Life Time Misfire.pdf"
|
||||||
|
)
|
||||||
command_args = f"-u {url_uuid} -l {language} -c {chapters} --path {download_path} --format {file_format} --debug --wait 2"
|
command_args = f"-u {url_uuid} -l {language} -c {chapters} --path {download_path} --format {file_format} --debug --wait 2"
|
||||||
script_path = "manga-dlp.py"
|
script_path = "manga-dlp.py"
|
||||||
os.system(f"python3 {script_path} {command_args}")
|
os.system(f"python3 {script_path} {command_args}")
|
||||||
|
@ -105,16 +107,16 @@ def test_full_with_input_pdf(wait_20s: MonkeyPatch):
|
||||||
shutil.rmtree(manga_path, ignore_errors=True)
|
shutil.rmtree(manga_path, ignore_errors=True)
|
||||||
|
|
||||||
|
|
||||||
def test_full_with_input_folder(wait_20s: MonkeyPatch):
|
def test_full_with_input_folder(wait_20s):
|
||||||
url_uuid = (
|
url_uuid = "https://mangadex.org/title/76ee7069-23b4-493c-bc44-34ccbf3051a8/tomo-chan-wa-onna-no-ko"
|
||||||
"https://mangadex.org/title/76ee7069-23b4-493c-bc44-34ccbf3051a8/tomo-chan-wa-onna-no-ko"
|
|
||||||
)
|
|
||||||
language = "en"
|
language = "en"
|
||||||
chapters = "1"
|
chapters = "1"
|
||||||
file_format = ""
|
file_format = ""
|
||||||
download_path = "tests"
|
download_path = "tests"
|
||||||
manga_path = Path("tests/Tomo-chan wa Onna no ko")
|
manga_path = Path("tests/Tomo-chan wa Onna no ko")
|
||||||
chapter_path = Path("tests/Tomo-chan wa Onna no ko/Ch. 1 - Once In A Life Time Misfire")
|
chapter_path = Path(
|
||||||
|
"tests/Tomo-chan wa Onna no ko/Ch. 1 - Once In A Life Time Misfire"
|
||||||
|
)
|
||||||
metadata_path = Path(
|
metadata_path = Path(
|
||||||
"tests/Tomo-chan wa Onna no ko/Ch. 1 - Once In A Life Time Misfire/ComicInfo.xml"
|
"tests/Tomo-chan wa Onna no ko/Ch. 1 - Once In A Life Time Misfire/ComicInfo.xml"
|
||||||
)
|
)
|
||||||
|
@ -129,16 +131,16 @@ def test_full_with_input_folder(wait_20s: MonkeyPatch):
|
||||||
shutil.rmtree(manga_path, ignore_errors=True)
|
shutil.rmtree(manga_path, ignore_errors=True)
|
||||||
|
|
||||||
|
|
||||||
def test_full_with_input_skip_cbz(wait_10s: MonkeyPatch):
|
def test_full_with_input_skip_cbz(wait_10s):
|
||||||
url_uuid = (
|
url_uuid = "https://mangadex.org/title/76ee7069-23b4-493c-bc44-34ccbf3051a8/tomo-chan-wa-onna-no-ko"
|
||||||
"https://mangadex.org/title/76ee7069-23b4-493c-bc44-34ccbf3051a8/tomo-chan-wa-onna-no-ko"
|
|
||||||
)
|
|
||||||
language = "en"
|
language = "en"
|
||||||
chapters = "1"
|
chapters = "1"
|
||||||
file_format = "cbz"
|
file_format = "cbz"
|
||||||
download_path = "tests"
|
download_path = "tests"
|
||||||
manga_path = Path("tests/Tomo-chan wa Onna no ko")
|
manga_path = Path("tests/Tomo-chan wa Onna no ko")
|
||||||
chapter_path = Path("tests/Tomo-chan wa Onna no ko/Ch. 1 - Once In A Life Time Misfire.cbz")
|
chapter_path = Path(
|
||||||
|
"tests/Tomo-chan wa Onna no ko/Ch. 1 - Once In A Life Time Misfire.cbz"
|
||||||
|
)
|
||||||
command_args = f"-u {url_uuid} -l {language} -c {chapters} --path {download_path} --format {file_format} --debug --wait 2"
|
command_args = f"-u {url_uuid} -l {language} -c {chapters} --path {download_path} --format {file_format} --debug --wait 2"
|
||||||
script_path = "manga-dlp.py"
|
script_path = "manga-dlp.py"
|
||||||
manga_path.mkdir(parents=True, exist_ok=True)
|
manga_path.mkdir(parents=True, exist_ok=True)
|
||||||
|
@ -151,22 +153,22 @@ def test_full_with_input_skip_cbz(wait_10s: MonkeyPatch):
|
||||||
shutil.rmtree(manga_path, ignore_errors=True)
|
shutil.rmtree(manga_path, ignore_errors=True)
|
||||||
|
|
||||||
|
|
||||||
def test_full_with_input_skip_folder(wait_10s: MonkeyPatch):
|
def test_full_with_input_skip_folder(wait_10s):
|
||||||
url_uuid = (
|
url_uuid = "https://mangadex.org/title/76ee7069-23b4-493c-bc44-34ccbf3051a8/tomo-chan-wa-onna-no-ko"
|
||||||
"https://mangadex.org/title/76ee7069-23b4-493c-bc44-34ccbf3051a8/tomo-chan-wa-onna-no-ko"
|
|
||||||
)
|
|
||||||
language = "en"
|
language = "en"
|
||||||
chapters = "1"
|
chapters = "1"
|
||||||
file_format = ""
|
file_format = ""
|
||||||
download_path = "tests"
|
download_path = "tests"
|
||||||
manga_path = Path("tests/Tomo-chan wa Onna no ko")
|
manga_path = Path("tests/Tomo-chan wa Onna no ko")
|
||||||
chapter_path = Path("tests/Tomo-chan wa Onna no ko/Ch. 1 - Once In A Life Time Misfire")
|
chapter_path = Path(
|
||||||
|
"tests/Tomo-chan wa Onna no ko/Ch. 1 - Once In A Life Time Misfire"
|
||||||
|
)
|
||||||
command_args = f"-u {url_uuid} -l {language} -c {chapters} --path {download_path} --format '{file_format}' --debug --wait 2"
|
command_args = f"-u {url_uuid} -l {language} -c {chapters} --path {download_path} --format '{file_format}' --debug --wait 2"
|
||||||
script_path = "manga-dlp.py"
|
script_path = "manga-dlp.py"
|
||||||
chapter_path.mkdir(parents=True, exist_ok=True)
|
chapter_path.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
os.system(f"python3 {script_path} {command_args}")
|
os.system(f"python3 {script_path} {command_args}")
|
||||||
found_files: List[str] = []
|
found_files = []
|
||||||
for file in chapter_path.iterdir():
|
for file in chapter_path.iterdir():
|
||||||
found_files.append(file.name)
|
found_files.append(file.name)
|
||||||
|
|
||||||
|
@ -182,15 +184,17 @@ def test_full_with_input_skip_folder(wait_10s: MonkeyPatch):
|
||||||
shutil.rmtree(manga_path, ignore_errors=True)
|
shutil.rmtree(manga_path, ignore_errors=True)
|
||||||
|
|
||||||
|
|
||||||
def test_full_with_read_cbz(wait_20s: MonkeyPatch):
|
def test_full_with_read_cbz(wait_20s):
|
||||||
url_list = Path("tests/test_list2.txt")
|
url_list = Path("tests/test_list2.txt")
|
||||||
language = "en"
|
language = "en"
|
||||||
chapters = "1"
|
chapters = "1"
|
||||||
file_format = "cbz"
|
file_format = "cbz"
|
||||||
download_path = "tests"
|
download_path = "tests"
|
||||||
manga_path = Path("tests/Tomo-chan wa Onna no ko")
|
manga_path = Path("tests/Tomo-chan wa Onna no ko")
|
||||||
chapter_path = Path("tests/Tomo-chan wa Onna no ko/Ch. 1 - Once In A Life Time Misfire.cbz")
|
chapter_path = Path(
|
||||||
command_args = f"--read {url_list!s} -l {language} -c {chapters} --path {download_path} --format {file_format} --debug --wait 2"
|
"tests/Tomo-chan wa Onna no ko/Ch. 1 - Once In A Life Time Misfire.cbz"
|
||||||
|
)
|
||||||
|
command_args = f"--read {str(url_list)} -l {language} -c {chapters} --path {download_path} --format {file_format} --debug --wait 2"
|
||||||
script_path = "manga-dlp.py"
|
script_path = "manga-dlp.py"
|
||||||
url_list.write_text(
|
url_list.write_text(
|
||||||
"https://mangadex.org/title/76ee7069-23b4-493c-bc44-34ccbf3051a8/tomo-chan-wa-onna-no-ko"
|
"https://mangadex.org/title/76ee7069-23b4-493c-bc44-34ccbf3051a8/tomo-chan-wa-onna-no-ko"
|
||||||
|
@ -204,15 +208,17 @@ def test_full_with_read_cbz(wait_20s: MonkeyPatch):
|
||||||
shutil.rmtree(manga_path, ignore_errors=True)
|
shutil.rmtree(manga_path, ignore_errors=True)
|
||||||
|
|
||||||
|
|
||||||
def test_full_with_read_skip_cbz(wait_10s: MonkeyPatch):
|
def test_full_with_read_skip_cbz(wait_10s):
|
||||||
url_list = Path("tests/test_list2.txt")
|
url_list = Path("tests/test_list2.txt")
|
||||||
language = "en"
|
language = "en"
|
||||||
chapters = "1"
|
chapters = "1"
|
||||||
file_format = "cbz"
|
file_format = "cbz"
|
||||||
download_path = "tests"
|
download_path = "tests"
|
||||||
manga_path = Path("tests/Tomo-chan wa Onna no ko")
|
manga_path = Path("tests/Tomo-chan wa Onna no ko")
|
||||||
chapter_path = Path("tests/Tomo-chan wa Onna no ko/Ch. 1 - Once In A Life Time Misfire.cbz")
|
chapter_path = Path(
|
||||||
command_args = f"--read {url_list!s} -l {language} -c {chapters} --path {download_path} --format {file_format} --debug --wait 2"
|
"tests/Tomo-chan wa Onna no ko/Ch. 1 - Once In A Life Time Misfire.cbz"
|
||||||
|
)
|
||||||
|
command_args = f"--read {str(url_list)} -l {language} -c {chapters} --path {download_path} --format {file_format} --debug --wait 2"
|
||||||
script_path = "manga-dlp.py"
|
script_path = "manga-dlp.py"
|
||||||
manga_path.mkdir(parents=True, exist_ok=True)
|
manga_path.mkdir(parents=True, exist_ok=True)
|
||||||
chapter_path.touch()
|
chapter_path.touch()
|
||||||
|
|
|
@ -4,7 +4,6 @@ import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from pytest import MonkeyPatch
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
@ -19,7 +18,7 @@ def wait_20s():
|
||||||
time.sleep(20)
|
time.sleep(20)
|
||||||
|
|
||||||
|
|
||||||
def test_full_with_all_flags(wait_20s: MonkeyPatch):
|
def test_full_with_all_flags(wait_20s):
|
||||||
manga_path = Path("tests/Tomo-chan wa Onna no ko")
|
manga_path = Path("tests/Tomo-chan wa Onna no ko")
|
||||||
chapter_path = manga_path / "Ch. 1 - Once In A Life Time Misfire.cbz"
|
chapter_path = manga_path / "Ch. 1 - Once In A Life Time Misfire.cbz"
|
||||||
cache_path = Path("tests/test_cache.json")
|
cache_path = Path("tests/test_cache.json")
|
||||||
|
|
26
tox.ini
Normal file
26
tox.ini
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
[tox]
|
||||||
|
envlist = py38, py39, py310
|
||||||
|
isolated_build = True
|
||||||
|
|
||||||
|
[testenv]
|
||||||
|
deps =
|
||||||
|
-rcontrib/requirements_dev.txt
|
||||||
|
|
||||||
|
commands =
|
||||||
|
pytest --verbose --exitfirst --basetemp="{envtmpdir}" {posargs}
|
||||||
|
|
||||||
|
[testenv:basic]
|
||||||
|
deps =
|
||||||
|
-rcontrib/requirements_dev.txt
|
||||||
|
|
||||||
|
commands =
|
||||||
|
pytest --verbose --exitfirst --basetemp="{envtmpdir}" {posargs}
|
||||||
|
|
||||||
|
[testenv:coverage]
|
||||||
|
deps =
|
||||||
|
-rcontrib/requirements_dev.txt
|
||||||
|
|
||||||
|
commands =
|
||||||
|
coverage erase
|
||||||
|
coverage run
|
||||||
|
coverage xml -i
|
Loading…
Reference in a new issue