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 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; 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 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 ${INSTALLER} deluge mlocate
systemctl enable deluged
systemctl start deluged
sudo -u deluge deluge-console config -s torrentfiles_location /srv/yggdrasil/new_acquisition
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 cp -p /usr/local/src/WolfPack/wolfpack /usr/local/bin/wolfpack
make checkperm make checkperm
@echo systemctl enable deluged
@echo "Update the config of Deluge for privacy as needed." systemctl start deluged
@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/"
@echo @echo
@echo "Add pups to /usr/local/etc/WolfPack/ to set up your searches." @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." @echo "Add '/usr/local/bin/wolfpack --alpha' to root's crontab to schedule data collection."
@ -25,6 +20,7 @@ clean:
@echo Nothing to do @echo Nothing to do
test: test:
./test-torrent-engine 'S01E01 Tech-TV'
./wolfpack --member ./example-download.pup ./wolfpack --member ./example-download.pup
./wolfpack --member ./example-search.pup ./wolfpack --member ./example-search.pup
./wolfpack --member ./example-shows.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 chown root:root /root/bin/offload-wolfpack
diff: /usr/local/bin/wolfpack diff: /usr/local/bin/wolfpack
diff ./wolfpack /usr/local/bin/wolfpack @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;
if [ -f /root/bin/offload-wolfpack ]; then diff ./offload-wolfpack /root/bin/offload-wolfpack; fi

View File

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