File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed
Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ # auth=账号:密码
2+ auth=transmission:transmission
3+ # host=路由ip地址:端口
4+ host=192.168.1.1:9091
5+ tips=" No active torrent"
6+ app=/usr/sbin/transmission-remote
7+ # 本文件,tracker.txt和transmission-remote存放位置
8+ basefdr=/mnt/hdd/transplus
9+ apx=$basefdr /transmission-remote
10+ trackerslist=$basefdr /trackers.txt
11+
12+ add_trackers () {
13+ torrent_hash=$1
14+ id=$2
15+ if [ -f $trackerslist ]; then
16+ for tracker in $( cat $trackerslist ) ; do
17+ if $app " $host " --auth=" $auth " --torrent " ${torrent_hash} " -td " ${tracker} " | grep -q ' success' ; then
18+ echo ' skiped.'
19+ else
20+ echo ' added .'
21+ fi
22+ done
23+ else
24+ echo " trackers.txt lost" $trackerslist
25+ fi
26+ }
27+
28+ if [ ! -f " $app " ]; then
29+ cp $apx $app
30+ chmod 777 $app
31+ fi
32+
33+ ids=" $( $app " $host " --auth=" $auth " --list | grep -vE ' Seeding|Stopped|Finished|[[:space:]]100%[[:space:]]' | grep ' ^ ' | awk ' { print $1 }' ) "
34+ for id in $ids ; do
35+ hash=" $( $app " $host " --auth=" $auth " --torrent " $id " --info | grep ' ^ Hash: ' | awk ' { print $2 }' ) "
36+ torrent_name=" $( $app " $host " --auth=" $auth " --torrent " $id " --info | grep ' ^ Name: ' | cut -c 9-) "
37+ echo $( date " +%Y-%m-%d %H:%M:%S" ) " - Adding trackers for $torrent_name ..."
38+ add_trackers " $hash " " $id "
39+ tips=" done"
40+ done
41+
42+ echo $tipsdone
43+ done
44+
45+ echo $tipss
You can’t perform that action at this time.
0 commit comments