Browse Source

small update

kouze 2 years ago
parent
commit
a478975279
1 changed files with 2 additions and 29 deletions
  1. 2 29
      delete_torrent.sh

+ 2 - 29
delete_torrent.sh

@ -42,39 +42,12 @@ function deleteTorrent_old() {
42 42
}
43 43

													
44 44

													
45

													
46
function checkSnatched()
47
{
48
  URL="https://hodor.ismy.guru/api/torrent/$TORRENTHASH?ak=8dab665cc879285e23ea8ebf816e433e"
49
  JSON=$(curl "$URL" 2>/dev/null)
50
  SNATCHED=$(echo $JSON | jq -r .snatched)
51
  TORRENTID=$(echo $JSON | jq -r .id)
52
  if [[ "$SNATCHED" == "null" ]]; then
53
    sleep 5s
54
    echo "delete_torrent.sh: updating tracker completed for $TORRENTHASH id $TORRENTID"
55
    URL="https://hodor.ismy.guru/api/torrent/$TORRENTID?ak=8dab665cc879285e23ea8ebf816e433e"
56
    JSON=$(curl -X PUT "$URL" 2>/dev/null)
57
    CONTAINSNATCHED=$(echo $JSON | grep ".snatched")
58
    SNATCHED=$(echo $JSON | jq -r .snatched)
59
    if [[ "$CONTAINSNATCHED" == "" || "$SNATCHED" == "null" ]]; then
60
      echo "$TORRENTHASH ¤¤ $TORRENTID" >> /home/nykouze/scripts/delete_torrent.failed
61
      echo "delete_torrent.sh: issue during the update at tracker level"
62
    else
63
      echo "delete_torrent.sh: completed update successfull for $TORRENTHASH id $TORRENTID"
64
    fi
65
  fi
66
}
67

													
68 45
if [[ "$RTORRENTRC" != "" ]]; then
69 46
  RTORRENTRC="/home/rtorrent/.$RTORRENTRC"
70
  RTXMLRPC="/home/nykouze/bin/rtxmlrpc -D rtorrent_rc=$RTORRENTRC"
71
  RTCONTROL="/home/nykouze/bin/rtcontrol -D rtorrent_rc=$RTORRENTRC"
47
  RTXMLRPC="$HOME/bin/rtxmlrpc -D rtorrent_rc=$RTORRENTRC"
48
  RTCONTROL="$HOME/bin/rtcontrol -D rtorrent_rc=$RTORRENTRC"
72 49
  RTORRENTID=$(pgrep -f $RTORRENTRC)
73 50
  if [[ $RTORRENTID != "" ]]; then
74
    if [[ "$TRACKER" == "gandalf.ismy.guru" ]]; then
75
      echo "delete_torrent.sh: Hodor process for $TORRENTHASH"
76
      checkSnatched
77
    fi
78 51
    deleteTorrent
79 52
  fi
80 53
fi