commit ab3f7863572c2ad3c08708e472b52733e1639b6f Author: Lukáš Kucharczyk Date: Tue Jun 15 17:47:26 2021 +0200 Initial commit 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