[download]

local/bin/torrents

   1 #!/bin/bash
   2 
   3 [[ $@ ]] && exec aria2c "$@" \
   4 --enable-rpc --seed-time=0 --console-log-level=warn   \
   5 --bt-tracker-timeout=1  --bt-tracker-connect-timeout=1 \
   6 --bt-exclude-tracker=\* --bt-tracker="$(
   7     curl -s https://ngosang.github.io/trackerslist/trackers_best.txt |
   8     tr -s \\n ,
   9 )"
  10 
  11 print(){ # {{{
  12     while IFS=$'\t' read progress status name; do
  13         progress=${progress%%%} progress=${progress%.*}
  14         printf '%3d%%\t%s\t%s\t%s\n' $progress "${status^}" $1 "$name"
  15     done
  16 } # }}}
  17 exec > >(column -ts $'\t')
  18 
  19 pidof transmission transmission-gtk > /dev/null &&
  20 transmission-remote -l | sed '1d; $d; s/\s\+\s/\t/g' |
  21 cut -f 3,9,10 | sort -k 1,1nr | print Transmission
  22 
  23 pidof qbittorrent > /dev/null &&
  24 curl -s http://127.0.0.1:9092/api/v2/sync/maindata |
  25 jq -r '.torrents[] | [.priority, .progress * 100, .state, .name] | @tsv' |
  26 sort -n | cut -f 2,3,4 | print qBittorrent
  27 
  28 pidof aria2c > /dev/null &&
  29 aria2p show | sed 1d | while read _ status progress _ _ _ _ _ name
  30 do printf '%s\t%s\t%s\n' $progress $status "$name"; done | print Aria2c
  31 
  32 pidof transmission transmission-gtk qbittorrent aria2c > /dev/null