Update sab_speed_control.sh
This commit is contained in:
@@ -1,12 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Configuration
|
||||
SABNZBD_API_KEY="60a7feba60f642d489ed89f08c4f8a88"
|
||||
SABNZBD_API_KEY="60x7fega60f642d489ed89f08c4f8a80fake"
|
||||
SABNZBD_URL="http://10.0.0.10:8081/sabnzbd/api"
|
||||
SLOW_SPEED="85000000" # 80000000 is 76.3 MB
|
||||
NORMAL_SPEED="105000000" # 125000000 is 118.2 MB
|
||||
SLOW_SPEED="65000000" # DL Speed when Plex Transcoding
|
||||
NORMAL_SPEED="85000000" # DL Speed when Plex Not Transocding
|
||||
NIGHT_SPEED="125000000" # DL Speed when not using Internet (such as Night)
|
||||
|
||||
# 125000000 is 118.2 MB | 80000000 is 76.3 MB
|
||||
|
||||
NIGHT_START="01" # Start hour for nighttime speed (24-hour format) (01 is 0100 AM or 0100hrs)
|
||||
NIGHT_END="07" # End hour for nighttime speed (24-hour format) (07 is 0700 AM or 0700hrs)
|
||||
|
||||
# Type Date in CMD Line to ENSURE that SERVER TIME matches/aligns as a test
|
||||
|
||||
CHECK_INTERVAL=10 # Seconds between checks
|
||||
TAUTULLI_API_KEY="dad9bbb78bde43249754b630b58fbf7d"
|
||||
TAUTULLI_API_KEY="dad9bbb78bde43249754b630b58fbf7c"
|
||||
TAUTULLI_URL="http://10.0.0.10:8181/api/v2"
|
||||
|
||||
# Function to set SABnzbd speed limit
|
||||
@@ -43,9 +52,20 @@ is_plex_playing() {
|
||||
# Monitoring loop
|
||||
while true; do
|
||||
if is_plex_playing; then
|
||||
# If Plex is playing/transcoding, use SLOW_SPEED
|
||||
set_sab_speed "${SLOW_SPEED}"
|
||||
else
|
||||
# If Plex is not playing/transcoding, check the current hour
|
||||
current_hour=$(date +%H)
|
||||
|
||||
# Compare current hour to NIGHT_START and NIGHT_END
|
||||
if [ "${current_hour}" -ge "${NIGHT_START}" ] && [ "${current_hour}" -lt "${NIGHT_END}" ]; then
|
||||
# If current time is between NIGHT_START and NIGHT_END (exclusive of NIGHT_END), use NIGHT_SPEED
|
||||
set_sab_speed "${NIGHT_SPEED}"
|
||||
else
|
||||
# Otherwise, use NORMAL_SPEED
|
||||
set_sab_speed "${NORMAL_SPEED}"
|
||||
fi
|
||||
fi
|
||||
sleep "${CHECK_INTERVAL}"
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user