From f7298e9c2b013149c6ec0e2d11459100101b2bfa Mon Sep 17 00:00:00 2001 From: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Date: Fri, 16 Aug 2024 22:20:58 -0500 Subject: [PATCH 1/3] (feat) xseed.sh: add LOGID_FILE to track downloaded ids Move from log file to db --- xseed.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xseed.sh b/xseed.sh index 54b39ed..8b062ee 100755 --- a/xseed.sh +++ b/xseed.sh @@ -8,7 +8,7 @@ # Load environment variables from .env file if it exists # in the same directory as this bash script -VERSION='2.1.1' +VERSION='2.2.1' SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ENV_PATH="$SCRIPT_DIR/.env" @@ -48,6 +48,7 @@ USENET_CLIENT_NAME=${USENET_CLIENT_NAME:-SABnzbd} XSEED_HOST=${XSEED_HOST:-crossseed} XSEED_PORT=${XSEED_PORT:-8080} LOG_FILE=${LOG_FILE:-/config/xseed.log} +LOGID_FILE=${LOG_FILE:-/config/xseed-id.log} XSEED_APIKEY=${XSEED_APIKEY:-} log_message "DEBUG" "Using '.env' file for config?: $EVAR" log_message "INFO" "Using Configuration:" @@ -56,6 +57,7 @@ log_message "INFO" "USENET_CLIENT_NAME=$USENET_CLIENT_NAME" log_message "INFO" "XSEED_HOST=$XSEED_HOST" log_message "INFO" "XSEED_PORT=$XSEED_PORT" log_message "INFO" "LOG_FILE=$LOG_FILE" +log_message "INFO" "LOGID_FILE=$LOGID_FILE" # Function to send a request to Cross Seed API cross_seed_request() { @@ -199,7 +201,7 @@ handle_operations() { log_message "INFO" "Cross-seed API response: $xseed_resp" if [ "$xseed_resp" == "204" ]; then - echo "$unique_id" >>"$LOG_FILE" + echo "$unique_id" >>"$LOGID_FILE" log_message "INFO" "Process completed successfully." else if [ "$xseed_resp" == "000" ]; then From 7221204c80e7caa21b21025a83abf17e0ff6d63b Mon Sep 17 00:00:00 2001 From: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Date: Fri, 16 Aug 2024 22:23:04 -0500 Subject: [PATCH 2/3] tweak logging; actually use db file --- xseed.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xseed.sh b/xseed.sh index 8b062ee..30de3be 100755 --- a/xseed.sh +++ b/xseed.sh @@ -125,6 +125,7 @@ detect_application() { # Validate the process validate_process() { [ ! -f "$LOG_FILE" ] && touch "$LOG_FILE" + [ ! -f "$LOGID_FILE" ] && touch "$LOGID_FILE" unique_id="${downloadID}-${clientID}" if [ -z "$unique_id" ]; then @@ -132,8 +133,8 @@ validate_process() { exit 1 fi - if grep -qF "$unique_id" "$LOG_FILE"; then - log_message "INFO" "Download ID $unique_id already processed. Exiting." + if grep -qF "$unique_id" "$LOGID_FILE"; then + log_message "INFO" "Download ID [$unique_id] already processed and logged in [$LOGID_FILE]. Exiting." exit 0 fi From 3e0fd1f42ed1bf9d03144c3c9a98dec023408c75 Mon Sep 17 00:00:00 2001 From: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Date: Fri, 16 Aug 2024 22:35:54 -0500 Subject: [PATCH 3/3] Update xseed.sh