WolfPack/wolfpack

275 lines
11 KiB
Plaintext
Raw Normal View History

Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
#!/bin/bash
source /opt/aninix/Uniglot/Bash/header
2017-09-19 16:35:01 -05:00
export downloadtorrent="sudo -u deluge deluge-console 2>/dev/null add"
2017-05-17 16:12:56 -05:00
export IFS="
"
export servicename='wolfpack'
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
function helptext {
echo '
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/\____ xxxxxxxxxxxxx AniNIX::WolfPack
// ~ / _\_____ Let loose the wolves to hunt, run,
/ \ .. \/ and be free. They shall repay you
// /~_____/ with their prey.
/// \\/ / ~dev@aninix.net
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2017-05-17 16:12:56 -05:00
wolfpack --alpha [enginefile] ~~ Tell the alpha to send the
pack members hunting.
wolfpack --member <pup> [enginefile] ~~ Send a member to train a
pup and bring back results.
Optionally provide a
torrent engine file.
wolfpack --torrent-monitor ~~ Pull up the Deluge console
for torrents.
2017-09-19 16:35:01 -05:00
wolfpack --torrent-lookup ~~ Look up and add a torrent
if user confirms.
2017-05-17 16:12:56 -05:00
wolfpack --help ~~ Show this helptext
2017-05-17 16:12:56 -05:00
Available pup types (all pups are line-delimited with the type and
result location as the first two lines):
torrent ~~ Torrent the result of the
search term. Will remove search line on
success.
shows ~~ Download the episode in a
show and increment. Shows
are listed in format
S01E01#Show terms#modifier
download ~~ Takes a list of commands to
run to arrive at a URL to
grab and downloads the last
URL.
search ~~ Uses the Google search
engine to return the top
five results for the search
terms on each line.
'
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
}
function privacycheck {
2017-09-19 16:35:01 -05:00
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 | systemd-cat -t "$servicename"
exit 1
fi
}
function nextairdate {
if [ -z "$1" ]; then
echo "Need a show to search for"
exit 1;
fi
timeout 5 elinks --dump "https://www.episodate.com/tv-show/$(echo $1 | tr '[:upper:]' '[:lower:]' | tr ' ' '-')?season=99" 2>&1 | grep 'and airs on' | sed 's# Season [0-9]\+ / Episode [0-9]\+ and airs on ##'
return
}
function torrentConfigure {
if [ -z "$3" ]; then
configuretorrent /usr/local/etc/WolfPack/torrentengine
else
configuretorrent "$3"
fi
}
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
function torrent {
if [ "$1" == "" ] || [ $(wc -l "$1" | cut -f 1 -d ' ') -lt 3 ]; then
echo "Need a valid argument."
return;
fi
torrentConfigure
privacycheck;
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
export downloaddir=$(head -n 2 "$1" | tail -n 1)
sudo -u deluge deluge-console config -s autoadd_location "$downloaddir" 2>/dev/null
sudo -u deluge deluge-console config -s download_location "$downloaddir" 2>/dev/null
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
for i in $(tail -n +3 "$1"); do
getmagnetlink "$i"
if [ "$magnetlink" != "" ]; then
2017-05-17 16:12:56 -05:00
/bin/bash -c "$downloadtorrent $magnetlink"
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
sed -i "/$i/d" "$1"
echo $magnetlink | systemd-cat -t "$servicename"
echo Added magnet to deluged and removed $i | systemd-cat -t "$servicename"
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
fi
done
if [ -x `which clamscan` ]; then clamscan -r -i "$downloaddir" | systemd-cat -t "$servicename"; fi
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
}
function shows {
if [ "$1" == "" ] || [ $(wc -l "$1" | cut -f 1 -d ' ') -lt 3 ]; then
echo "Need a valid argument."
return;
fi
2020-12-25 00:15:44 -06:00
torrentConfigure
privacycheck;
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
export downloaddir=$(head -n 2 "$1" | tail -n 1)
sudo -u deluge deluge-console config -s autoadd_location "$downloaddir" 2>/dev/null
sudo -u deluge deluge-console config -s download_location "$downloaddir" 2>/dev/null
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
for i in $(tail -n +3 "$1"); do
sepisode=$(echo $i | cut -f 1 -d '#' | xargs)
showName="$(echo $i | cut -f 2 -d '#' | xargs)"
modifier="$(echo $i | cut -f 3 -d '#' | xargs)"
season=$(echo $sepisode | cut -f 1 -d 'E' | cut -f 2 -d 'S')
episode=$(echo $sepisode | cut -f 2 -d 'E')
newep=$(printf "%02d\n" $((${episode#0} + 1)))
newseason="$(printf "%02d\n" $((${season#0} + 1)))"
if [ -z "$modifier" ]; then
getmagnetlink "$showName $sepisode"
else
getmagnetlink "$showName $sepisode $modifier"
fi
if [ "$magnetlink" != "" ]; then
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
# We found an episode.
echo $i | systemd-cat -t "$servicename"
echo $magnetlink | systemd-cat -t "$servicename"
2017-05-17 16:12:56 -05:00
/bin/bash -c "$downloadtorrent $magnetlink"
sed -i "s/$i/S${season}E${newep}#${showName}#${modifier}/" "$1"
echo Downloaded and pup updated. | systemd-cat -t "$servicename"
echo | systemd-cat -t "$servicename"
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
else
# We didn't -- is there a new season?
if [ -z "$modifier" ]; then
getmagnetlink "$showName S${newseason}E01"
else
getmagnetlink "$showName S${newseason}E01 $modifier"
fi
if [ "$magnetlink" != "" ]; then
echo "S${newseason}E01" $showName | systemd-cat -t "$servicename"
echo "$magnetlink" | systemd-cat -t "$servicename"
2017-05-17 16:12:56 -05:00
/bin/bash -c "$downloadtorrent $magnetlink"
sed -i "s/$i/S${newseason}E02#$showName#$modifier/" "$1"
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
else
nextAirDate="$(nextairdate "$showName")"
if [ ! -z "$nextAirDate" ]; then
echo "No new season found for $showName -- next airs $(nextairdate "$showName")" | systemd-cat -t "$servicename"
2017-09-19 16:35:01 -05:00
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\! | systemd-cat -t "$servicename"
fi
else
echo "No new season found for $showName" | systemd-cat -t "$servicename"
fi
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
fi
fi
done
if [ -x `which clamscan` ]; then clamscan -r -i "$downloaddir" | systemd-cat -t "$servicename"; fi
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
}
function download {
if [ "$1" == "" ] || [ $(wc -l "$1" | cut -f 1 -d ' ') -lt 3 ]; then
echo "Need a valid argument."
return;
fi
export dedupterm="$(echo $1 | rev | cut -f 1 -d '/' | rev | cut -f 1 -d '.')"
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
# Second line in the file is the directory to download to.
export downloaddir=$(head -n 2 "$1" | tail -n 1 | sed 's#/$##')
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
# The third line and any following lines should be
for i in $(tail -n +3 "$1"); do
if [ -z "$i" ]; then continue; fi
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
export comm=$(echo $i | sed "s#PREVRESULT#$nexturl#g" -)
export nexturl=$(bash -c "$comm")
done
if [ -z "$nexturl" ]; then
echo ERR: $dedupterm wolf pup is not finding its target.
fi
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
export filename="$downloaddir"/"$(echo "$nexturl" | rev | cut -f 1 -d \/ | rev)"
#if file doesn't already exist....
if [ ! -f "$filename" ]; then
echo Downloading $nexturl to $filename ... | systemd-cat -t "$servicename"
2017-11-01 13:40:02 -05:00
for i in $(find "$downloaddir" -type f | grep -i "$dedupterm"); do
echo Deduped\! Removed $i from $downloaddir | systemd-cat -t "$servicename"
rm -f "$i" 2>&1 | systemd-cat -t "$servicename"
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
done
2017-01-11 15:08:01 -06:00
wget --timeout=5 -q -O "$filename" "$nexturl"
echo Downloaded | systemd-cat -t "$servicename"
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
fi
if [ -x `which clamscan` ]; then clamscan -r -i "$downloaddir" | systemd-cat -t "$servicename"; fi
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
}
function search {
if [ "$1" == "" ] || [ $(wc -l "$1" | cut -f 1 -d ' ') -lt 3 ]; then
echo "Need a valid argument."
return;
fi
export downloaddir=$(head -n 2 "$1" | tail -n 1 | sed 's#/$##')
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
for i in $(tail -n +3 "$1"); do
export searchstring=$(echo $i | sed 's/ /+/g')
export file="$downloaddir"/$searchstring'.txt'
echo | googler --count=5 -C -x "$searchstring" | grep -v 'Enter n, p, result' > "$file"
echo "Ran search for $searchstring to $file" | systemd-cat -t "$servicename"
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
done
}
if [ "$1" == "" ]; then
helptext;
exit 1;
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
fi
echo '---' $(date) '---' | systemd-cat -t "$servicename"
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
case "$1" in
"--alpha")
echo Started alpha on `uname -n` | systemd-cat -t "$servicename"
if [ "$2" == "" ]; then
export basedir="/usr/local/etc/WolfPack"
else
export basedir="$2";
fi
echo "Starting members from pup in "$basedir | systemd-cat -t "$servicename"
for i in $(find "$basedir" -type f | grep '.pup'); do
/usr/local/bin/wolfpack --member "$i" "$3";
done
;;
"--member")
echo "Spawning a $(head -n 1 "$2") member for $2 on `uname -n`" | systemd-cat -t "$servicename"
(printf "IP: "; /usr/local/bin/whatismyip) | systemd-cat -t "$servicename"
case "$(head -n 1 "$2")" in
"shows")
shows "$2"
;;
"torrent")
torrent "$2"
;;
"search")
search "$2"
;;
"download")
download "$2"
;;
*)
echo "Bad pup type."
;;
esac
;;
2017-05-17 16:12:56 -05:00
"--torrent-monitor")
2017-09-19 16:35:01 -05:00
exec sudo -u deluge deluge-console 2>/dev/null;
2017-05-17 16:12:56 -05:00
exit 0;
;;
2017-09-19 16:35:01 -05:00
"--torrent-lookup")
torrentConfigure
2017-09-19 16:35:01 -05:00
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
;;
Converting from Bazaar. Old log: ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:52:29 -0500 message: Clearing some read statements ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: WolfPack timestamp: Tue 2016-07-19 13:36:23 -0500 message: Fix for torrent protocol ------------------------------------------------------------ revno: 6 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Mon 2016-07-18 10:23:17 -0500 message: Massive fixes; offloading updates; torrent function pup type updated ------------------------------------------------------------ revno: 5 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Tue 2016-05-31 14:42:28 -0500 message: Removing ghost-wolfpack in favor of systemd vpn client. ------------------------------------------------------------ revno: 4 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Sun 2016-05-15 21:35:02 -0500 message: Updated to include privacy VPN and offloading options. ------------------------------------------------------------ revno: 3 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 20:51:23 -0500 message: Adding ghost-wolfpack script for sites using VPNs for privacy ------------------------------------------------------------ revno: 2 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 15:58:05 -0500 message: Updated to use the googler package from the ArchLinux AUR for google searches and store as text files. Sufficient for now. ------------------------------------------------------------ revno: 1 committer: dev <dev@aninix.net> branch nick: WolfPack timestamp: Thu 2016-05-12 14:45:12 -0500 message: Adding all but search example -- search API is still in flux with no good command-line search option.
2016-08-04 12:08:16 -05:00
esac
echo "Exited "$1 | systemd-cat -t "$servicename"
echo '---' "$(date)" '---' | systemd-cat -t "$servicename"
echo | systemd-cat -t "$servicename"