LAPINPT

Transmission RSS Movies Imdb Filter

Aug 25th, 2013
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.99 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # TRANSMISSION RSS DOWNLOAD MOVIES WHIT IMDB FILTER
  4.  
  5. mkdir -p /home/getrss
  6. cd /home/getrss
  7.  
  8. # get 720p rss list
  9. lynx -dump -width 999 "http://www.torrentday.com/torrents/rss?download;l11;u=####;tp=########" | sed 's/\(http:\)/\n\1/g' | sed 's/\(?torrent\)/\n\1/g' | sed -n '/http:/p' | sed -nr '/2012|2013|2014/p' | sed '/1080p/d' > new.log
  10.  
  11. # find difference between done and new
  12. grep -Fxvf done.log new.log > filter.log
  13.  
  14. # apend done list to new one
  15. cat done.log | sed '/^$/d' >> new.log
  16.  
  17. # delete duplicates
  18. awk '!x[$0]++' new.log > done.log
  19.  
  20. rm new.log
  21.  
  22. # search IMDb for rating and votes
  23. cat filter.log | while read tname
  24. do
  25.    MOVIENAME=$(echo "$tname" | cut -d "/" -f4 | tr -s '.' ' ' | sed -e 's/\(.*\)\([0-9][0-9][0-9][0-9]\)\( .*$\)/\1\2/' | sed 's/&/and/g')
  26.    IMDbID=$(lynx -dump -nonumbers -nolist "https://duckduckgo.com/?q=$MOVIENAME imdb" | sed -n '/imdb.com/{p;q;}' | cut -d "/" -f3)
  27.    imdbRat=$(curl -s http://www.omdbapi.com/?i=$IMDbID | sed 's/\",\"/\n/g ; s/\":\"/: /g ; s/{\"//g' | sed -n '/imdbRating:/p' | cut -d' ' -f2 | tr -d '.')
  28.    imdbVot=$(curl -s http://www.omdbapi.com/?i=$IMDbID | sed 's/\",\"/\n/g ; s/\":\"/: /g ; s/{\"//g' | sed -n '/imdbVotes:/p' | cut -d' ' -f2 | tr -d ',')
  29.    if [ "$imdbRat" -ge "60" ] && [ "$imdbVot" -ge "5000" ]; then
  30.       echo "http://$tname?torrent_pass=########" >> downl.log
  31.       echo -e "MOVIE: $MOVIENAME\nIMDb: www.imdb.com/title/$IMDbID\nRating: $imdbRat from $imdbVot\n" >> justify.log
  32.    fi
  33. done
  34.  
  35. rm filter.log
  36.  
  37. # download new entries
  38. cat downl.log | while read torurl
  39. do
  40.    rlsname=$(echo "$torurl" | cut -d "/" -f6 | sed -e 's/\.torrent.*$//g')
  41.    echo -e "\nAdding $rlsname"
  42.    transmission-remote localhost:9091 -n USER:PASS -a "$torurl" -sr 2.00 1>/dev/null
  43.    sleep 1
  44.    tornumb=$(transmission-remote localhost:9091 -n USER:PASS -l | sed -e '$!{h;d;}' -e x | awk '{print $1}') 1>/dev/null
  45.    sleep 1
  46.    transmission-remote localhost:9091 -n USER:PASS -t $tornumb -u3000 1>/dev/null
  47. done
  48.  
  49. rm downl.log
Add Comment
Please, Sign In to add comment