LAPINPT

BASH RSS SEARCH DOWNLOAD

Aug 18th, 2013
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.06 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. cd /home/watchdir
  4.  
  5. # get rss list
  6. rsstail -1 -N -u "http://www.torrent.com/rss" | tr -d ' ' > new.log
  7.  
  8. # find difference between done and new
  9. grep -Fxvf done.log new.log > downl.log
  10.  
  11. # apend done list to new one
  12. cat done.log | sed '/^$/d' >> new.log
  13.  
  14. # delete duplicates
  15. awk '!x[$0]++' new.log > done.log
  16.  
  17. rm new.log
  18.  
  19. cat downl.log | while read xname
  20. do
  21.    # search for new entries
  22.    torfile=$(lynx -dump -nonumbers "https://kickass.to/usearch/$xname/" | sed -n '/\.torrent?title/{p;q;}' | cut -d '?' -f1)
  23.    # if not found delete entrie
  24.    if [ -z "$torfile" ]; then
  25.       echo -e "\nCould Not Found: $xname\n"
  26.       sed -i "/$xname/d" done.log
  27.    else
  28.       echo -e "\nAdding $xname"
  29.       transmission-remote localhost:9091 -n user:pass -a "$torfile" -sr 1.20 2>/dev/null
  30.       sleep 1
  31.       tornumb=$(transmission-remote localhost:9091 -n user:pass -l | sed -e '$!{h;d;}' -e x | awk '{print $1}') 2>/dev/null
  32.       sleep 1
  33.       transmission-remote localhost:9091 -n user:pass -t $tornumb -u300 2>/dev/null
  34.    fi
  35. done
  36.  
  37. rm downl.log
Add Comment
Please, Sign In to add comment