This commit is contained in:
example 2017-09-19 16:35:01 -05:00
parent 4bd612dbff
commit 572fc6987a
2 changed files with 34 additions and 16 deletions

View File

@ -4,18 +4,13 @@ compile: ./tpb.torrentengine.sample
if [ ! -d /usr/local/src/SharedLibraries ]; then git -C /usr/local/src/ clone https://aninix.net/foundation/SharedLibraries; fi
git -C /usr/local/src/SharedLibraries pull;
if [ ! -d /usr/local/etc/WolfPack ]; then mkdir -p /usr/local/etc/WolfPack; chmod 0770 /usr/local/etc/WolfPack; cp ./*.pup /usr/local/etc/WolfPack; cp ./tpb.torrentengine.sample /usr/local/etc/WolfPack; chmod 0660 /usr/local/etc/WolfPack/*; echo "Default configuration directory of /usr/local/etc/WolfPack created with example pups and torrent engine."; fi
${INSTALLER} deluge
systemctl enable deluged
systemctl start deluged
sudo -u deluge deluge-console config -s torrentfiles_location /srv/yggdrasil/new_acquisition
${INSTALLER} deluge mlocate
install: compile /usr/bin/wget /usr/bin/deluge-console /usr/bin/googler wolfpack /usr/local/bin/whatismyip /usr/bin/lynx
install: compile /usr/bin/wget /usr/bin/deluge-console /usr/bin/googler ./wolfpack /usr/local/bin/whatismyip /usr/bin/lynx
cp -p /usr/local/src/WolfPack/wolfpack /usr/local/bin/wolfpack
make checkperm
@echo
@echo "Update the config of Deluge for privacy as needed."
@echo "https://www.privateinternetaccess.com/forum/discussion/434/utorrent-install-instructions-proxychecker"
@echo "https://www.reddit.com/r/torrents/comments/18tye4/setting_up_utorrent_with_private_internet_access/"
systemctl enable deluged
systemctl start deluged
@echo
@echo "Add pups to /usr/local/etc/WolfPack/ to set up your searches."
@echo "Add '/usr/local/bin/wolfpack --alpha' to root's crontab to schedule data collection."
@ -25,6 +20,7 @@ clean:
@echo Nothing to do
test:
./test-torrent-engine 'S01E01 Tech-TV'
./wolfpack --member ./example-download.pup
./wolfpack --member ./example-search.pup
./wolfpack --member ./example-shows.pup
@ -46,5 +42,4 @@ offload: offload-wolfpack /root/.ssh/id_rsa /root/.ssh/id_rsa.pub
chown root:root /root/bin/offload-wolfpack
diff: /usr/local/bin/wolfpack
diff ./wolfpack /usr/local/bin/wolfpack
if [ -f /root/bin/offload-wolfpack ]; then diff ./offload-wolfpack /root/bin/offload-wolfpack; fi
@echo wolfpack:; diff ./wolfpack /usr/local/bin/wolfpack; echo; if [ -f /root/bin/offload-wolfpack ]; then echo offload-wolfpack:; diff ./offload-wolfpack /root/bin/offload-wolfpack; echo; fi;

View File

@ -1,6 +1,6 @@
#!/bin/bash
source /usr/local/src/SharedLibraries/Bash/header
export downloadtorrent="sudo -u deluge deluge-console add"
export downloadtorrent="sudo -u deluge deluge-console 2>/dev/null add"
if [ -z "$3" ]; then
configuretorrent /usr/local/etc/WolfPack/torrentengine
@ -28,6 +28,8 @@ wolfpack --member <pup> [enginefile] ~~ Send a member to train a
torrent engine file.
wolfpack --torrent-monitor ~~ Pull up the Deluge console
for torrents.
wolfpack --torrent-lookup ~~ Look up and add a torrent
if user confirms.
wolfpack --reset-log ~~ Clear the wolfpack log. This
is in /var/log/wolfpack.log.
wolfpack --help ~~ Show this helptext
@ -53,7 +55,8 @@ search ~~ Uses the Google search
}
function privacycheck {
if [ "$(/usr/local/bin/whatismyip)" == "$(nslookup aninix.net | grep Address | cut -f 2 -d ' ' | tail -n 1)" ]; then
ip="$(/usr/local/bin/whatismyip)"
if [ -z "$ip" ] || [ "$ip" == "$(nslookup aninix.net | grep Address | cut -f 2 -d ' ' | tail -n 1)" ]; then
echo "ERROR: Should not torrent directly from the AniNIX main IP for privacy reasons" 2>&1 | tee -a "$logfile"
exit 1
fi
@ -75,6 +78,7 @@ function torrent {
fi
privacycheck;
export downloaddir=$(head -n 2 "$1" | tail -n 1)
sudo -u deluge deluge-console config -s torrentfiles_location "$downloaddir" 2>/dev/null
for i in $(tail -n +3 "$1"); do
getmagnetlink "$i"
if [ "$magnetlink" != "" ]; then
@ -94,7 +98,7 @@ function shows {
fi
privacycheck;
export downloaddir=$(head -n 2 "$1" | tail -n 1)
echo "Would download to "$downloaddir
sudo -u deluge deluge-console config -s torrentfiles_location "$downloaddir" 2>/dev/null
for i in $(tail -n +3 "$1"); do
sepisode=$(echo $i | cut -f 1 -d '#' | xargs)
showName="$(echo $i | cut -f 2 -d '#' | xargs)"
@ -132,7 +136,7 @@ function shows {
nextAirDate="$(nextairdate "$showName")"
if [ ! -z "$nextAirDate" ]; then
echo "No new season found for $showName -- next airs $(nextairdate "$showName")" | tee -a "$logfile"
if [ "$(date -s "$nextAirDate" -u +%s)" -lt "$(date -u +%s)" ]; then
if [ "$(date -d "$nextAirDate" -u +%s)" -lt "$(date -u +%s)" ]; then
echo ERROR: Should have found a new episode for $searchterms and did not -- check your provider\! | tee -a "$logfile"
fi
else
@ -233,9 +237,28 @@ case "$1" in
exit 0;
;;
"--torrent-monitor")
exec sudo -u deluge deluge-console;
exec sudo -u deluge deluge-console 2>/dev/null;
exit 0;
;;
"--torrent-lookup")
configuretorrent /usr/local/etc/WolfPack/torrentengine
getmagnetlink "$(echo $2 | tr '#' "$searchunifier")"
if [ -z "$magnetlink" ]; then
echo Nothing found;
exit 0;
fi
echo
echo Found: $magnetlink
echo
echo 'Acceptable? [y/n]'
read answer
if [ "$answer" == "y" ]; then
/bin/bash -c "$downloadtorrent $magnetlink"
fi;
exit 0;
;;
*)
helptext
;;