From 16902415ee6244c8f56b56d68ec6ea90fbf9256f Mon Sep 17 00:00:00 2001 From: AustrianToast Date: Mon, 8 Jul 2024 23:52:55 +0200 Subject: [PATCH] rename Rule34 to gallery-dl --- gallery-dl/.gitignore | 5 +++++ gallery-dl/config.json | 44 ++++++++++++++++++++++++++++++++++++++++++ gallery-dl/rule34.sh | 27 ++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 gallery-dl/.gitignore create mode 100644 gallery-dl/config.json create mode 100755 gallery-dl/rule34.sh diff --git a/gallery-dl/.gitignore b/gallery-dl/.gitignore new file mode 100644 index 0000000..d315d3b --- /dev/null +++ b/gallery-dl/.gitignore @@ -0,0 +1,5 @@ +to_download_r34.txt +downloaded_r34.txt +archive-rule34.sqlite3 +log.txt +Download diff --git a/gallery-dl/config.json b/gallery-dl/config.json new file mode 100644 index 0000000..5e1567e --- /dev/null +++ b/gallery-dl/config.json @@ -0,0 +1,44 @@ +{ + "extractor": + { + "base-directory": "./Download", + "archive": "./archive.sqlite3", + + "rule34": + { + "archive": "./archive-rule34.sqlite3", + + "filename": "{md5}.{extension}", + "directory": ["{search_tags}", "Rule34"] + } + }, + + "downloader": + { + "part-directory": "/tmp", + "rate": "30M", + "retries": 3, + "timeout": 10 + }, + + "output": + { + "ansi": true, + "log": { + "level": "info", + "format": { + "debug" : "\u001b[0;37m{name}: {message}\u001b[0m", + "info" : "\u001b[1;37m{name}: {message}\u001b[0m", + "warning": "\u001b[1;33m{name}: {message}\u001b[0m", + "error" : "\u001b[1;31m{name}: {message}\u001b[0m" + } + }, + "logfile": { + "path": "./log.txt", + "mode": "w", + "format-date": "%Y-%m-%dT%H:%M:%S", + "level": "debug" + } + } +} + diff --git a/gallery-dl/rule34.sh b/gallery-dl/rule34.sh new file mode 100755 index 0000000..72da646 --- /dev/null +++ b/gallery-dl/rule34.sh @@ -0,0 +1,27 @@ +#!/usr/bin/bash + +# for testing only +rm -f ./archive.sqlite3 ./archive-rule34.sqlite3 ./log.txt +rm -rf ./Download/* + +[[ -f downloaded_r34.txt ]] || echo "no file to download from" || exit 1 +cp downloaded_r34.txt to_download_r34.txt + +while [ 1 ] +do + gallery-dl --config ./config.json --input-file-delete to_download_r34.txt + + if [ ! -s to_download_r34.txt ]; then + #success! just exit + echo "file empty" + rm to_download_r34.txt + exit 0 + fi + echo "file not empty" + + if [ $(ping -qc 3 rule34.xxx > /dev/null 2>&1) ]; then + echo "no internet" + exit 1 + fi + echo "has internet" +done