From 0dc5054fd496ff8a8993df4d8902cfa6fb9da4f2 Mon Sep 17 00:00:00 2001 From: AustrianToast Date: Sun, 4 May 2025 23:22:01 +0200 Subject: [PATCH] replaced with a pure C implementation --- add_and_download_url.sh | 48 ----------------------------------- download_website.sh | 56 ----------------------------------------- 2 files changed, 104 deletions(-) delete mode 100755 add_and_download_url.sh delete mode 100755 download_website.sh diff --git a/add_and_download_url.sh b/add_and_download_url.sh deleted file mode 100755 index 4bea789..0000000 --- a/add_and_download_url.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/bash - -source "$HOME"/.config/Hentai.conf - -IGREEN="\033[0;92m" # Intense Green -IYELLOW="\033[0;93m" # Intense Yellow -IRED='\033[0;91m' # Intense Red -NO_COLOR="\033[0m" # Text Reset - -[[ -z $1 ]] && exit 1 - -if [[ -z $2 ]]; then - output=$(Hentai add_url "$1") -else - output=$(Hentai add_custom_name "$1" "$2") -fi - -echo "$output" -[[ $output =~ "#" ]] || exit 1 - -url=$(awk '{print $1}' <<< "$output") -path=$(awk '{print $3}' <<< "$output") - -for ((n=0;n<5;n++)); do - if [[ $url =~ "iwara.tv" ]]; then - echo "command: yt-dlp --config-locations ./yt-dlp/iwara.conf -o ${path}/%(id)s.%(ext)s $url" - - if yt-dlp --config-locations ./yt-dlp/iwara.conf -o "${path}/%(id)s.%(ext)s" "$url"; then - echo -e "${IGREEN}Success${NO_COLOR}" - exit 0 - fi - else - echo "command: gallery-dl --config ./gallery-dl/config.json --directory $path $url" - - if gallery-dl --config ./gallery-dl/config.json --directory "$path" "$url"; then - echo -e "${IGREEN}Success${NO_COLOR}" - exit 0 - fi - fi - echo -e "${IYELLOW}download failed${NO_COLOR}" - - if has_internet; then - echo -e "${IGREEN}has internet${NO_COLOR}" - else - echo -e "${IYELLOW}no internet${NO_COLOR}" - exit 1 - fi -done diff --git a/download_website.sh b/download_website.sh deleted file mode 100755 index 439f383..0000000 --- a/download_website.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/bash - -source "$HOME"/.config/Hentai.conf - -IGREEN="\033[0;92m" # Intense Green -IYELLOW="\033[0;93m" # Intense Yellow -IRED='\033[0;91m' # Intense Red -NO_COLOR="\033[0m" # Text Reset - -IN_FILE="${tmp_dir}/${1}_generated.txt" -SUCCESS_FILE="${log_dir}/${1}_success.txt" -FAIL_FILE="${log_dir}/${1}_failed.txt" - -download() { - for ((n=0;n<5;n++)); do - if [[ $1 =~ "iwara.tv" ]]; then - if yt-dlp --config-locations ./yt-dlp/iwara.conf -o "${2}/%(id)s.%(ext)s" "$1"; then - echo "$1" >> "$SUCCESS_FILE" - return 0 - fi - else - if gallery-dl --config ./gallery-dl/config.json --directory "$2" "$1"; then - echo "$1" >> "$SUCCESS_FILE" - return 0 - fi - fi - echo -e "${IYELLOW}download failed${NO_COLOR}" - - if has_internet; then - echo -e "${IGREEN}has internet${NO_COLOR}" - else - echo -e "${IYELLOW}no internet${NO_COLOR}" - exit 1 - fi - done - - echo "$1" >> "$FAIL_FILE" -} - -mkdir -p "$tmp_dir" "$log_dir" -Hentai generate "$1" "$tmp_dir" || exit 1 - -[[ -f $FAIL_FILE ]] && rm -f "$FAIL_FILE" || touch "$FAIL_FILE" -[[ -f $SUCCESS_FILE ]] && rm -f "$SUCCESS_FILE" || touch "$SUCCESS_FILE" - -while IFS= read -r line; do - url=$(awk '{print $1}' <<< "$line") - path=$(awk '{print $3}' <<< "$line") - - echo "url: $url" - echo "path: $path" - - download $url $path -done < "$IN_FILE" - -[[ -s $FAIL_FILE ]] && echo -e "${IRED}Some links failed!${NO_COLOR}" || echo -e "${IGREEN}Success!${NO_COLOR}"