From ab3f7863572c2ad3c08708e472b52733e1639b6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Tue, 15 Jun 2021 17:47:26 +0200 Subject: [PATCH] Initial commit --- manga-downloader.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 manga-downloader.sh diff --git a/manga-downloader.sh b/manga-downloader.sh new file mode 100644 index 0000000..e9db5e9 --- /dev/null +++ b/manga-downloader.sh @@ -0,0 +1,31 @@ +#!/bin/env bash +DOWNLOAD_PATH="/srv/dev-disk-by-label-uno/download/comics" +MANGA_FOLDER="/srv/dev-disk-by-label-uno/media/comics/manga/DrStone" + +RESULT=$( + manga-py \ + --rename-pages \ + --cbz \ + --reverse-downloading \ + --max-volumes 1 \ + --print-json \ + --cookies "test=1" \ + --user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0" \ + --destination "$DOWNLOAD_PATH" \ + https://www.funmanga.com/dr-stone \ + 2>/dev/null +) + +echo "$RESULT" >manga-py.log + +FORMAT="Dr. STONE v" +VOLUMES_DOWNLOADED=$(echo "$RESULT" | jq '.volumes | length') +VOLUME_PATH="$(realpath "$(echo "$RESULT" | jq '.volumes[0].path' | tr -d "\"")")" +CHAPTER_NUMBER=$(echo "$VOLUME_PATH" | grep -Po "[0-9]+") + +if [[ "$VOLUMES_DOWNLOADED" -ne 0 ]]; then + apprise --tag "telegram" --title "Manga Download: Dr. Stone" --body "Chapter downloaded: ${CHAPTER_NUMBER}" + mv "$VOLUME_PATH" "${MANGA_FOLDER}/${FORMAT}${CHAPTER_NUMBER}.cbz" + # keep dummy file in place of the downloaded chapter to prevent re-downloading + touch "$VOLUME_PATH" +fi