Initial commit

This commit is contained in:
Lukáš Kucharczyk 2021-06-15 17:47:26 +02:00
commit ab3f786357
No known key found for this signature in database
GPG Key ID: 65524498C0196B64
1 changed files with 31 additions and 0 deletions

31
manga-downloader.sh Normal file
View File

@ -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