|
|
@ -12,96 +12,85 @@ if [ ! -f "/config/scripts/video-pp.bash" ]; then
|
|
|
|
chmod 0777 "/config/scripts/video-pp.bash"
|
|
|
|
chmod 0777 "/config/scripts/video-pp.bash"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ ! -f "/config/scripts/sab-config-updated" ]; then
|
|
|
|
if [ ! -f "/config/sabnzbd.ini" ]; then
|
|
|
|
# start cron
|
|
|
|
# start cron
|
|
|
|
service cron start
|
|
|
|
service cron start
|
|
|
|
if [ -f "/config/sabnzbd.ini" ]; then
|
|
|
|
exit 0
|
|
|
|
if cat "/config/sabnzbd.ini" | grep "\[categories\]" | read; then
|
|
|
|
fi
|
|
|
|
if cat "/config/sabnzbd.ini" | grep "\[\[radarr\]\]" | read; then
|
|
|
|
|
|
|
|
sleep 0.1
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
# Add scripts path
|
|
|
|
|
|
|
|
if cat "/config/sabnzbd.ini" | grep "script_dir = \"\"" | read; then
|
|
|
|
|
|
|
|
sed -i "s/script_dir = \"\"/script_dir = \"\/config\/scripts\"/g" "/config/sabnzbd.ini"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Correct incomplete path
|
|
|
|
# Add scripts path
|
|
|
|
if cat "/config/sabnzbd.ini" | grep "Downloads/incomplete" | read; then
|
|
|
|
if cat "/config/sabnzbd.ini" | grep "script_dir = \"\"" | read; then
|
|
|
|
sed -i "s/Downloads\/incomplete/\/storage\/downloads\/sabnzbd\/incomplete/g" "/config/sabnzbd.ini"
|
|
|
|
sed -i "s/script_dir = \"\"/script_dir = \"\/config\/scripts\"/g" "/config/sabnzbd.ini"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Correct complete path
|
|
|
|
# Correct incomplete path
|
|
|
|
if cat "/config/sabnzbd.ini" | grep "Downloads/complete" | read; then
|
|
|
|
if cat "/config/sabnzbd.ini" | grep "Downloads/incomplete" | read; then
|
|
|
|
sed -i "s/Downloads\/complete/\/storage\/downloads\/sabnzbd\/complete/g" "/config/sabnzbd.ini"
|
|
|
|
sed -i "s/Downloads\/incomplete/\/storage\/downloads\/sabnzbd\/incomplete/g" "/config/sabnzbd.ini"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Enable script failure
|
|
|
|
# Correct complete path
|
|
|
|
if cat "/config/sabnzbd.ini" | grep "script_can_fail = 0" | read; then
|
|
|
|
if cat "/config/sabnzbd.ini" | grep "Downloads/complete" | read; then
|
|
|
|
sed -i "s/script_can_fail = 0/script_can_fail = 1/g" "/config/sabnzbd.ini"
|
|
|
|
sed -i "s/Downloads\/complete/\/storage\/downloads\/sabnzbd\/complete/g" "/config/sabnzbd.ini"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# remove software category
|
|
|
|
# Enable script failure
|
|
|
|
if cat "/config/sabnzbd.ini" | grep "\[\[software\]\]" | read; then
|
|
|
|
if cat "/config/sabnzbd.ini" | grep "script_can_fail = 0" | read; then
|
|
|
|
sleep 0.1
|
|
|
|
sed -i "s/script_can_fail = 0/script_can_fail = 1/g" "/config/sabnzbd.ini"
|
|
|
|
else
|
|
|
|
fi
|
|
|
|
sed -i '/\[\[software\]\]/,+7d' "/config/sabnzbd.ini"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Add radarr category
|
|
|
|
# Enable permissions failure
|
|
|
|
if cat "/config/sabnzbd.ini" | grep "\[\[radarr\]\]" | read; then
|
|
|
|
if cat "/config/sabnzbd.ini" | grep "permissions = \"\"" | read; then
|
|
|
|
sleep 0.1
|
|
|
|
sed -i "s/permissions = \"\"/permissions = \"766\"/g" "/config/sabnzbd.ini"
|
|
|
|
else
|
|
|
|
fi
|
|
|
|
sed -i '/\[\[movies\]\]/,+7d' "/config/sabnzbd.ini" && \
|
|
|
|
|
|
|
|
echo "[[radarr]]" >> "/config/sabnzbd.ini" && \
|
|
|
|
|
|
|
|
echo "priority = -100" >> "/config/sabnzbd.ini" && \
|
|
|
|
|
|
|
|
echo "pp = \"\"" >> "/config/sabnzbd.ini" && \
|
|
|
|
|
|
|
|
echo "name = radarr" >> "/config/sabnzbd.ini" && \
|
|
|
|
|
|
|
|
echo "script = video-pp.bash" >> "/config/sabnzbd.ini" && \
|
|
|
|
|
|
|
|
echo "newzbin = \"\"" >> "/config/sabnzbd.ini" && \
|
|
|
|
|
|
|
|
echo "order = 1" >> "/config/sabnzbd.ini" && \
|
|
|
|
|
|
|
|
echo "dir = radarr" >> "/config/sabnzbd.ini"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Add sonarr category
|
|
|
|
if cat "/config/sabnzbd.ini" | grep "\[categories\]" | read; then
|
|
|
|
if cat "/config/sabnzbd.ini" | grep "\[\[sonarr\]\]" | read; then
|
|
|
|
sleep 0.1
|
|
|
|
sleep 0.1
|
|
|
|
else
|
|
|
|
else
|
|
|
|
# Add categories
|
|
|
|
sed -i '/\[\[tv\]\]/,+7d' "/config/sabnzbd.ini" && \
|
|
|
|
echo "[categories]" >> "/config/sabnzbd.ini" && \
|
|
|
|
echo "[[sonarr]]" >> "/config/sabnzbd.ini" && \
|
|
|
|
|
|
|
|
echo "priority = -100" >> "/config/sabnzbd.ini" && \
|
|
|
|
# Add radarr category
|
|
|
|
echo "pp = \"\"" >> "/config/sabnzbd.ini" && \
|
|
|
|
echo "[[radarr]]" >> "/config/sabnzbd.ini" && \
|
|
|
|
echo "name = sonarr" >> "/config/sabnzbd.ini" && \
|
|
|
|
echo "priority = -100" >> "/config/sabnzbd.ini" && \
|
|
|
|
echo "script = video-pp.bash" >> "/config/sabnzbd.ini" && \
|
|
|
|
echo "pp = \"\"" >> "/config/sabnzbd.ini" && \
|
|
|
|
echo "newzbin = \"\"" >> "/config/sabnzbd.ini" && \
|
|
|
|
echo "name = radarr" >> "/config/sabnzbd.ini" && \
|
|
|
|
echo "order = 2" >> "/config/sabnzbd.ini" && \
|
|
|
|
echo "script = video-pp.bash" >> "/config/sabnzbd.ini" && \
|
|
|
|
echo "dir = sonarr" >> "/config/sabnzbd.ini"
|
|
|
|
echo "newzbin = \"\"" >> "/config/sabnzbd.ini" && \
|
|
|
|
fi
|
|
|
|
echo "order = 1" >> "/config/sabnzbd.ini" && \
|
|
|
|
|
|
|
|
echo "dir = radarr" >> "/config/sabnzbd.ini" && \
|
|
|
|
|
|
|
|
|
|
|
|
# Add lidarr category
|
|
|
|
# Add sonarr category
|
|
|
|
if cat "/config/sabnzbd.ini" | grep "\[\[lidarr\]\]" | read; then
|
|
|
|
sed -i '/\[\[tv\]\]/,+7d' "/config/sabnzbd.ini" && \
|
|
|
|
sleep 0.1
|
|
|
|
echo "[[sonarr]]" >> "/config/sabnzbd.ini" && \
|
|
|
|
else
|
|
|
|
echo "priority = -100" >> "/config/sabnzbd.ini" && \
|
|
|
|
sed -i '/\[\[audio\]\]/,+7d' "/config/sabnzbd.ini" && \
|
|
|
|
echo "pp = \"\"" >> "/config/sabnzbd.ini" && \
|
|
|
|
echo "[[lidarr]]" >> "/config/sabnzbd.ini" && \
|
|
|
|
echo "name = sonarr" >> "/config/sabnzbd.ini" && \
|
|
|
|
echo "priority = -100" >> "/config/sabnzbd.ini" && \
|
|
|
|
echo "script = video-pp.bash" >> "/config/sabnzbd.ini" && \
|
|
|
|
echo "pp = \"\"" >> "/config/sabnzbd.ini" && \
|
|
|
|
echo "newzbin = \"\"" >> "/config/sabnzbd.ini" && \
|
|
|
|
echo "name = lidarr" >> "/config/sabnzbd.ini" && \
|
|
|
|
echo "order = 2" >> "/config/sabnzbd.ini" && \
|
|
|
|
echo "script = audio-pp.bash" >> "/config/sabnzbd.ini" && \
|
|
|
|
echo "dir = sonarr" >> "/config/sabnzbd.ini" && \
|
|
|
|
echo "newzbin = \"\"" >> "/config/sabnzbd.ini" && \
|
|
|
|
|
|
|
|
echo "order = 3" >> "/config/sabnzbd.ini" && \
|
|
|
|
|
|
|
|
echo "dir = lidarr" >> "/config/sabnzbd.ini"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ ! -f "/config/scripts/sab-config-updated" ]; then
|
|
|
|
# Add lidarr category
|
|
|
|
touch "/config/scripts/sab-config-updated" && \
|
|
|
|
echo "[[lidarr]]" >> "/config/sabnzbd.ini" && \
|
|
|
|
chmod 0666 "/config/scripts/sab-config-updated"
|
|
|
|
echo "priority = -100" >> "/config/sabnzbd.ini" && \
|
|
|
|
fi
|
|
|
|
echo "pp = \"\"" >> "/config/sabnzbd.ini" && \
|
|
|
|
fi
|
|
|
|
echo "name = lidarr" >> "/config/sabnzbd.ini" && \
|
|
|
|
fi
|
|
|
|
echo "script = audio-pp.bash" >> "/config/sabnzbd.ini" && \
|
|
|
|
fi
|
|
|
|
echo "newzbin = \"\"" >> "/config/sabnzbd.ini" && \
|
|
|
|
if [ -f "/config/scripts/sab-config-updated" ]; then
|
|
|
|
echo "order = 3" >> "/config/sabnzbd.ini" && \
|
|
|
|
# stop cron
|
|
|
|
echo "dir = lidarr" >> "/config/sabnzbd.ini"
|
|
|
|
service cron stop
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if cat "/config/sabnzbd.ini" | grep "\[\[software\]\]" | read; then
|
|
|
|
|
|
|
|
sed -i '/\[\[software\]\]/,+7d' "/config/sabnzbd.ini" && \
|
|
|
|
|
|
|
|
sed -i '/\[\[audio\]\]/,+7d' "/config/sabnzbd.ini" && \
|
|
|
|
|
|
|
|
sed -i '/\[\[tv\]\]/,+7d' "/config/sabnzbd.ini" && \
|
|
|
|
|
|
|
|
sed -i '/\[\[movies\]\]/,+7d' "/config/sabnzbd.ini" && \
|
|
|
|
|
|
|
|
# stop cron
|
|
|
|
|
|
|
|
service cron stop
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
# start cron
|
|
|
|
|
|
|
|
service cron start
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
exit 0
|
|
|
|