[2.2.20] - 2023-02-12 #39

Merged
olofvndrhr merged 7 commits from dev into master 2023-02-12 04:55:48 +01:00
16 changed files with 200 additions and 106 deletions

View file

@ -11,20 +11,18 @@ depends_on:
clone: clone:
git: git:
when:
#branch: master
event: tag
image: woodpeckerci/plugin-git:v1.6.0 image: woodpeckerci/plugin-git:v1.6.0
when:
event: tag
pipeline: pipeline:
# build and publish docker image for amd64 - x86 # build and publish docker image for amd64 - x86
build-amd64: build-amd64:
when:
#branch: master
event: tag
image: plugins/docker image: plugins/docker
pull: true pull: true
when:
event: tag
settings: settings:
repo: olofvndrhr/manga-dlp repo: olofvndrhr/manga-dlp
platforms: linux/amd64 platforms: linux/amd64

View file

@ -11,20 +11,18 @@ depends_on:
clone: clone:
git: git:
when:
#branch: master
event: tag
image: woodpeckerci/plugin-git:v1.6.0 image: woodpeckerci/plugin-git:v1.6.0
when:
event: tag
pipeline: pipeline:
# build and publish docker image for arm64 # build and publish docker image for arm64
build-arm64: build-arm64:
when:
#branch: master
event: tag
image: plugins/docker image: plugins/docker
pull: true pull: true
when:
event: tag
settings: settings:
repo: olofvndrhr/manga-dlp repo: olofvndrhr/manga-dlp
platforms: linux/arm64 platforms: linux/arm64

View file

@ -12,20 +12,20 @@ depends_on:
clone: clone:
git: git:
when:
#branch: master
event: tag
image: woodpeckerci/plugin-git:v1.6.0 image: woodpeckerci/plugin-git:v1.6.0
when:
event: tag
branch: master
pipeline: pipeline:
# publish docker manifest for automatic multi arch pulls # publish docker manifest for automatic multi arch pulls
publish-manifest: publish-manifest:
when:
#branch: master
event: tag
image: plugins/manifest image: plugins/manifest
pull: true pull: true
when:
event: tag
branch: master
settings: settings:
spec: docker/manifest.tmpl spec: docker/manifest.tmpl
auto_tag: true auto_tag: true

View file

@ -0,0 +1,85 @@
###################
# publish pre-release #
###################
# branch: dev
# event: tag
platform: linux/amd64
depends_on:
- tests
clone:
git:
image: woodpeckerci/plugin-git:v1.6.0
when:
event: tag
tag: "*-dev"
pipeline:
# build wheel and dist
build-pypi:
image: cr.44net.ch/ci-plugins/tests
pull: true
when:
event: tag
tag: "*-dev"
commands:
- python3 -m hatch build --clean
# create pre-release-notes
create-pre-release-notes:
image: cr.44net.ch/baseimages/debian-base
pull: true
when:
event: tag
tag: "*-dev"
commands:
- bash get_release_notes.sh ${CI_COMMIT_TAG%%-dev}
# publish pre-release on github (github.com/olofvndrhr/manga-dlp)
publish-pre-release-github:
image: woodpeckerci/plugin-github-release
pull: true
when:
event: tag
tag: "*-dev"
settings:
api_key:
from_secret: github-olofvndrhr-token
files: dist/*
title: ${CI_COMMIT_TAG}
note: RELEASENOTES.md
prerelease: true
# publish pre-release on gitea (git.44net.ch/olofvndrhr/manga-dlp)
publish-pre-release-gitea:
image: woodpeckerci/plugin-gitea-release
pull: true
when:
event: tag
tag: "*-dev"
settings:
api_key:
from_secret: gitea-olofvndrhr-token
base_url: https://git.44net.ch
files: dist/*
title: ${CI_COMMIT_TAG}
note: RELEASENOTES.md
prerelease: true
# # pre-release pypi
# pre-release-pypi:
# image: cr.44net.ch/ci-plugins/tests
# pull: true
# when:
# event: tag
# tag: "*-dev"
# secrets:
# - source: pypi_username
# target: HATCH_INDEX_USER
# - source: pypi_token
# target: HATCH_INDEX_AUTH
# commands:
# - python3 -m hatch publish --no-prompt --yes

View file

@ -11,40 +11,54 @@ depends_on:
clone: clone:
git: git:
when:
#branch: master
event: tag
image: woodpeckerci/plugin-git:v1.6.0 image: woodpeckerci/plugin-git:v1.6.0
when:
event: tag
branch: master
pipeline: pipeline:
# build wheel and dist # build wheel and dist
build-pypi: build-pypi:
when:
#branch: master
event: tag
image: cr.44net.ch/ci-plugins/tests image: cr.44net.ch/ci-plugins/tests
pull: true pull: true
when:
event: tag
branch: master
commands: commands:
- python3 -m hatch build --clean - python3 -m hatch build --clean
# create release-notes # create release-notes
create-release-notes: create-release-notes:
when:
#branch: master
event: tag
image: cr.44net.ch/baseimages/debian-base image: cr.44net.ch/baseimages/debian-base
pull: true pull: true
when:
event: tag
branch: master
commands: commands:
- bash get_release_notes.sh ${CI_COMMIT_TAG} - bash get_release_notes.sh ${CI_COMMIT_TAG}
# publish release on github (github.com/olofvndrhr/manga-dlp)
publish-release-github:
image: woodpeckerci/plugin-github-release
pull: true
when:
event: tag
branch: master
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 on gitea (git.44net.ch/olofvndrhr/manga-dlp)
publish-release-gitea: publish-release-gitea:
when: image: woodpeckerci/plugin-gitea-release
#branch: master
event: tag
image: plugins/gitea-release
pull: true pull: true
when:
event: tag
branch: master
settings: settings:
api_key: api_key:
from_secret: gitea-olofvndrhr-token from_secret: gitea-olofvndrhr-token
@ -53,27 +67,13 @@ pipeline:
title: ${CI_COMMIT_TAG} title: ${CI_COMMIT_TAG}
note: RELEASENOTES.md note: RELEASENOTES.md
# publish release on github (github.com/olofvndrhr/manga-dlp)
publish-release-github:
when:
#branch: master
event: tag
image: woodpeckerci/plugin-github-release
pull: true
settings:
api_key:
from_secret: github-olofvndrhr-token
files: dist/*
title: ${CI_COMMIT_TAG}
note: RELEASENOTES.md
# release pypi # release pypi
release-pypi: release-pypi:
when:
#branch: master
event: tag
image: cr.44net.ch/ci-plugins/tests image: cr.44net.ch/ci-plugins/tests
pull: true pull: true
when:
event: tag
branch: master
secrets: secrets:
- source: pypi_username - source: pypi_username
target: HATCH_INDEX_USER target: HATCH_INDEX_USER

View file

@ -11,20 +11,20 @@ depends_on:
clone: clone:
git: git:
image: woodpeckerci/plugin-git:v1.6.0
when: when:
branch: master branch: master
event: pull_request event: pull_request
image: woodpeckerci/plugin-git:v1.6.0
pipeline: pipeline:
# build docker image for amd64 - x86 # build docker image for amd64 - x86
test-build-amd64: test-build-amd64:
image: plugins/docker
pull: true
when: when:
branch: master branch: master
event: pull_request event: pull_request
image: plugins/docker
pull: true
settings: settings:
dry_run: true dry_run: true
repo: olofvndrhr/manga-dlp repo: olofvndrhr/manga-dlp

View file

@ -11,20 +11,20 @@ depends_on:
clone: clone:
git: git:
image: woodpeckerci/plugin-git:v1.6.0
when: when:
branch: master branch: master
event: pull_request event: pull_request
image: woodpeckerci/plugin-git:v1.6.0
pipeline: pipeline:
# build docker image for arm64 # build docker image for arm64
test-build-arm64: test-build-arm64:
image: plugins/docker
pull: true
when: when:
branch: master branch: master
event: pull_request event: pull_request
image: plugins/docker
pull: true
settings: settings:
dry_run: true dry_run: true
repo: olofvndrhr/manga-dlp repo: olofvndrhr/manga-dlp

View file

@ -11,30 +11,30 @@ depends_on:
clone: clone:
git: git:
image: woodpeckerci/plugin-git:v1.6.0
when: when:
branch: master branch: master
event: pull_request event: pull_request
image: woodpeckerci/plugin-git:v1.6.0
pipeline: pipeline:
# build wheel and dist # build wheel and dist
test-build-pypi: test-build-pypi:
image: cr.44net.ch/ci-plugins/tests
pull: true
when: when:
branch: master branch: master
event: pull_request event: pull_request
image: cr.44net.ch/ci-plugins/tests
pull: true
commands: commands:
- python3 -m hatch build --clean - python3 -m hatch build --clean
# create release-notes # create release-notes
test-create-release-notes: test-create-release-notes:
image: cr.44net.ch/baseimages/debian-base
pull: true
when: when:
branch: master branch: master
event: pull_request event: pull_request
image: cr.44net.ch/baseimages/debian-base
pull: true
commands: commands:
- bash get_release_notes.sh latest - bash get_release_notes.sh latest
- cat RELEASENOTES.md - cat RELEASENOTES.md

View file

@ -11,19 +11,19 @@ depends_on:
clone: clone:
git: git:
image: woodpeckerci/plugin-git:v1.6.0
when: when:
branch: master branch: master
event: pull_request event: pull_request
image: woodpeckerci/plugin-git:v1.6.0
pipeline: pipeline:
# test code with different python versions - amd64 # test code with different python versions - amd64
test-tox-amd64: test-tox-amd64:
image: cr.44net.ch/ci-plugins/multipy
pull: true
when: when:
branch: master branch: master
event: pull_request event: pull_request
image: cr.44net.ch/ci-plugins/multipy
pull: true
commands: commands:
- python3 -m tox - python3 -m tox

View file

@ -11,20 +11,20 @@ depends_on:
clone: clone:
git: git:
image: woodpeckerci/plugin-git:v1.6.0
when: when:
branch: master branch: master
event: pull_request event: pull_request
image: woodpeckerci/plugin-git:v1.6.0
pipeline: pipeline:
# test code with different python versions - arm64 # test code with different python versions - arm64
test-tox-arm64: test-tox-arm64:
image: cr.44net.ch/ci-plugins/multipy
pull: true
when: when:
branch: master branch: master
event: pull_request event: pull_request
image: cr.44net.ch/ci-plugins/multipy
pull: true
commands: commands:
- grep -v img2pdf contrib/requirements_dev.txt > contrib/requirements_dev_arm64.txt - grep -v img2pdf contrib/requirements_dev.txt > contrib/requirements_dev_arm64.txt
- rm -f contrib/requirements_dev.txt - rm -f contrib/requirements_dev.txt

View file

@ -9,6 +9,12 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- Add support for more sites - Add support for more sites
## [2.2.20] - 2023-02-12
### Fixed
- 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

View file

@ -1 +1 @@
__version__ = "2.2.19" __version__ = "2.2.20"

View file

@ -1,6 +1,5 @@
import re import re
import shutil import shutil
import sys
from pathlib import Path from pathlib import Path
from typing import Any, Union from typing import Any, Union
@ -78,9 +77,9 @@ class MangaDLP:
try: try:
log.debug("Initializing api") log.debug("Initializing api")
self.api = self.api_used(self.url_uuid, self.language, self.forcevol) self.api = self.api_used(self.url_uuid, self.language, self.forcevol)
except Exception: except Exception as exc:
log.error("Can't initialize api. Exiting") log.error("Can't initialize api. Exiting")
sys.exit(1) raise exc
# get manga title and uuid # get manga title and uuid
self.manga_uuid = self.api.manga_uuid self.manga_uuid = self.api.manga_uuid
self.manga_title = self.api.manga_title self.manga_title = self.api.manga_title
@ -96,7 +95,7 @@ class MangaDLP:
log.error( log.error(
'You need to specify a manga url/uuid with "-u" or a list with "--read"' 'You need to specify a manga url/uuid with "-u" or a list with "--read"'
) )
sys.exit(1) raise ValueError
# checks if --list is not used # checks if --list is not used
if not self.list_chapters: if not self.list_chapters:
if not self.chapters: if not self.chapters:
@ -104,15 +103,15 @@ class MangaDLP:
log.error( log.error(
'You need to specify one or more chapters to download. To see all chapters use "--list"' 'You need to specify one or more chapters to download. To see all chapters use "--list"'
) )
sys.exit(1) raise ValueError
# if forcevol is used, but didn't specify a volume in the chapters selected # if forcevol is used, but didn't specify a volume in the chapters selected
if self.forcevol and ":" not in self.chapters: if self.forcevol and ":" not in self.chapters:
log.error("You need to specify the volume if you use --forcevol") log.error("You need to specify the volume if you use --forcevol")
sys.exit(1) raise ValueError
# if forcevol is not used, but a volume is specified # if forcevol is not used, but a volume is specified
if not self.forcevol and ":" in self.chapters: if not self.forcevol and ":" in self.chapters:
log.error("Don't specify the volume without --forcevol") log.error("Don't specify the volume without --forcevol")
sys.exit(1) raise ValueError
# check the api which needs to be used # check the api which needs to be used
def check_api(self, url_uuid: str) -> type: def check_api(self, url_uuid: str) -> type:
@ -129,11 +128,11 @@ class MangaDLP:
# this is only for testing multiple apis # this is only for testing multiple apis
if api_test.search(url_uuid): if api_test.search(url_uuid):
log.critical("Not supported yet") log.critical("Not supported yet")
sys.exit(1) raise ValueError
# no supported api found # no supported api found
log.error(f"No supported api in link/uuid found: {url_uuid}") log.error(f"No supported api in link/uuid found: {url_uuid}")
sys.exit(1) raise ValueError
# once called per manga # once called per manga
def get_manga(self) -> None: def get_manga(self) -> None:
@ -206,6 +205,8 @@ class MangaDLP:
try: try:
chapter_path = self.get_chapter(chapter) chapter_path = self.get_chapter(chapter)
except KeyboardInterrupt as exc:
raise exc
except FileExistsError: except FileExistsError:
skipped_chapters.append(chapter) skipped_chapters.append(chapter)
# update cache # update cache
@ -273,9 +274,9 @@ class MangaDLP:
chapter_image_urls = self.api.get_chapter_images( chapter_image_urls = self.api.get_chapter_images(
chapter, self.download_wait chapter, self.download_wait
) )
except KeyboardInterrupt: except KeyboardInterrupt as exc:
log.critical("Stopping") log.critical("Keyboard interrupt. Stopping")
sys.exit(1) raise exc
# check if the image urls are empty. if yes skip this chapter (for mass downloads) # check if the image urls are empty. if yes skip this chapter (for mass downloads)
if not chapter_image_urls: if not chapter_image_urls:
@ -364,9 +365,9 @@ class MangaDLP:
downloader.download_chapter( downloader.download_chapter(
chapter_image_urls, chapter_path, self.download_wait chapter_image_urls, chapter_path, self.download_wait
) )
except KeyboardInterrupt: except KeyboardInterrupt as exc:
log.critical("Stopping") log.critical("Keyboard interrupt. Stopping")
sys.exit(1) raise exc
except Exception as exc: except Exception as exc:
log.error(f"Cant download: '{chapter_filename}'. Skipping") log.error(f"Cant download: '{chapter_filename}'. Skipping")

View file

@ -1,3 +1,4 @@
import sys
from pathlib import Path from pathlib import Path
import click import click
@ -256,24 +257,32 @@ def main(
requested_mangas = [url_uuid] if url_uuid else read_mangas requested_mangas = [url_uuid] if url_uuid else read_mangas
for manga in requested_mangas: for manga in requested_mangas:
mdlp = app.MangaDLP( try:
url_uuid=manga, mdlp = app.MangaDLP(
language=lang, url_uuid=manga,
chapters=chapters, language=lang,
list_chapters=list_chapters, chapters=chapters,
file_format=chapter_format, list_chapters=list_chapters,
name_format=name_format, file_format=chapter_format,
name_format_none=name_format_none, name_format=name_format,
forcevol=forcevol, name_format_none=name_format_none,
download_path=path, forcevol=forcevol,
download_wait=wait_time, download_path=path,
manga_pre_hook_cmd=hook_manga_pre, download_wait=wait_time,
manga_post_hook_cmd=hook_manga_post, manga_pre_hook_cmd=hook_manga_pre,
chapter_pre_hook_cmd=hook_chapter_pre, manga_post_hook_cmd=hook_manga_post,
chapter_post_hook_cmd=hook_chapter_post, chapter_pre_hook_cmd=hook_chapter_pre,
cache_path=cache_path, chapter_post_hook_cmd=hook_chapter_post,
) cache_path=cache_path,
mdlp.get_manga() )
mdlp.get_manga()
except (KeyboardInterrupt, Exception) as exc:
# if only a single manga is requested and had an error, then exit
if len(requested_mangas) == 1:
log.error(f"Error with manga: {manga}")
sys.exit(1)
# else continue with the other ones
log.error(f"Skipping: {manga}. Reason={exc}")
if __name__ == "__main__": if __name__ == "__main__":

View file

@ -1,6 +1,5 @@
import logging import logging
import shutil import shutil
import sys
from pathlib import Path from pathlib import Path
from time import sleep from time import sleep
from typing import Union from typing import Union
@ -35,9 +34,8 @@ def download_chapter(
if r.status_code != 200: if r.status_code != 200:
log.error(f"Request for image {image} failed, retrying") log.error(f"Request for image {image} failed, retrying")
raise ConnectionError raise ConnectionError
except KeyboardInterrupt: except KeyboardInterrupt as exc:
log.critical("Stopping") raise exc
sys.exit(1)
except Exception as exc: except Exception as exc:
if counter >= 3: if counter >= 3:
log.error("Maybe the MangaDex Servers are down?") log.error("Maybe the MangaDex Servers are down?")

View file

@ -13,7 +13,6 @@ def test_check_api_mangadex():
def test_check_api_none(): def test_check_api_none():
url = "https://abc.defghjk/title/abc/def" url = "https://abc.defghjk/title/abc/def"
with pytest.raises(SystemExit) as e: with pytest.raises(ValueError) as e:
MangaDLP(url_uuid=url, list_chapters=True, download_wait=2) MangaDLP(url_uuid=url, list_chapters=True, download_wait=2)
assert e.type == SystemExit assert e.type == ValueError
assert e.value.code == 1