-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add FreeBSD compatibility and FreeBSD services support #18
base: master
Are you sure you want to change the base?
Changes from 1 commit
97a18f2
2b972a5
6cb56fe
e7f2b8e
df9f472
bbb1261
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,38 +3,38 @@ | |
auth=user:password | ||
host=localhost | ||
|
||
add_trackers () { | ||
torrent_hash=$1 | ||
id=$2 | ||
trackerslist=/tmp/trackers.txt | ||
for base_url in https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt ; do | ||
if [ ! -f $trackerslist ]; then | ||
curl -o "$trackerslist" "${base_url}" | ||
fi | ||
Local=$(wc -c < $trackerslist) | ||
Remote=$(curl -sI "${base_url}" | awk '/Content-Length/ {sub("\r",""); print $2}') | ||
if [ "$Local" != "$Remote" ]; then | ||
curl -o "$trackerslist" "${base_url}" | ||
fi | ||
echo "URL for ${base_url}" | ||
echo "Adding trackers for $torrent_name..." | ||
for tracker in $(cat $trackerslist) ; do | ||
echo -n "${tracker}..." | ||
if ${trans} --torrent "${torrent_hash}" -td "${tracker}" | grep -q 'success'; then | ||
echo ' failed.' | ||
else | ||
echo ' done.' | ||
fi | ||
done | ||
done | ||
sleep 3m | ||
rm -f "/tmp/TTAA.$id.lock" | ||
} | ||
|
||
trans="$(which transmission-remote) $host --auth=$auth" | ||
while true ; do | ||
sleep 25 | ||
|
||
add_trackers () { | ||
torrent_hash=$1 | ||
id=$2 | ||
trackerslist=/tmp/trackers.txt | ||
for base_url in https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt ; do | ||
if [ ! -f $trackerslist ]; then | ||
curl -o "$trackerslist" "${base_url}" | ||
fi | ||
Local=$(wc -c < $trackerslist) | ||
Remote=$(curl -sI "${base_url}" | awk '/Content-Length/ {sub("\r",""); print $2}') | ||
if [ "$Local" != "$Remote" ]; then | ||
curl -o "$trackerslist" "${base_url}" | ||
fi | ||
echo "URL for ${base_url}" | ||
echo "Adding trackers for $torrent_name..." | ||
for tracker in $(cat $trackerslist) ; do | ||
echo -n "${tracker}..." | ||
if ${trans} --torrent "${torrent_hash}" -td "${tracker}" | grep -q 'success'; then | ||
echo ' done.' | ||
else | ||
echo ' already added.' | ||
fi | ||
done | ||
done | ||
sleep 3m | ||
rm -f "/tmp/TTAA.$id.lock" | ||
} | ||
|
||
# Get list of active torrents | ||
ids="$(${trans} --list | grep -vE 'Seeding|Stopped|Finished|[[:space:]]100%[[:space:]]' | grep '^ ' | awk '{ print $1 }' | grep -vE 'ID')" | ||
for id in $ids ; do | ||
|
@@ -52,8 +52,8 @@ while true ; do | |
if [ "$add_date_t" = "$dater" -o "$add_date_t" = "$dateo" ]; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. regress changes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no built-in command What you wrote is exactly the condition that is specified. |
||
hash="$(${trans} --torrent "$id" --info | grep '^ Hash: ' | awk '{ print $2 }')" | ||
torrent_name="$(${trans} --torrent "$id" --info | grep '^ Name: ' |cut -c 9-)" | ||
add_trackers "$hash" "$id" & | ||
touch "/tmp/TTAA.$id.lock" | ||
add_trackers "$hash" "$id" & | ||
fi | ||
fi | ||
done | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo -n
doesn't work on bin/sh, maybeprintf '%s\n'
can fix itThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very strange. Are you sure this code doesn't work?
Test 1:
Test 2: