LAPINPT

mktorrent config script

Jun 12th, 2013
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.52 KB | None | 0 0
  1. #  mktorrent script #
  2.  
  3. # making the script executable everywhere
  4. chmod 755 maketorrent.sh
  5. cp maketorrent.sh /usr/local/bin/maketorrent
  6.  
  7. # then just run
  8. cd /file/path
  9. maketorrent filesdir
  10.  
  11. -------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  12. #!/bin/bash
  13.  
  14. # removes .torrent file if existes in the path
  15. rm -f "$1.torrent"
  16.  
  17.  
  18. # trackers urls
  19. URL1=udp://fr33domtracker.h33t.com:3310/announce
  20. URL2=http://fr33dom.h33t.com:3310/announce
  21. URL3=udp://tracker.istole.it:80/announce
  22. URL4=udp://tracker.publicbt.com:80/announce
  23. URL5=udp://tracker.openbittorrent.com:80/announce
  24.  
  25. # comments
  26. CMT="seed please"
  27.  
  28.  
  29. # get size from dir
  30. SIZE=$(du -ms "$1" | awk '{print $1}')
  31.  
  32.  
  33. # set piece size for torrent
  34. if [ $SIZE -ge 16384 ]; then PIECE=24
  35. elif [ $SIZE -ge 8192 ]; then PIECE=23
  36. elif [ $SIZE -ge 4096 ]; then PIECE=22
  37. elif [ $SIZE -ge 2048 ]; then PIECE=21
  38. elif [ $SIZE -ge 1024 ]; then PIECE=20
  39. elif [ $SIZE -ge 512 ]; then PIECE=19
  40. elif [ $SIZE -lt 512 ]; then PIECE=18
  41. fi
  42.  
  43. echo
  44. echo -e DIR SIZE IS "\e[92m$SIZE MB\e[0m" THEN PIECE SIZE WILL BE "\e[92m$PIECE\e[0m"
  45. echo
  46.  
  47. # the final command
  48. mktorrent -v -l $PIECE -a $URL1 -a $URL2 -a $URL3 -a $URL4 -a $URL5 -c "$CMT" -o "$1.torrent" "$1"
  49.  
  50. #-v is for verbose
  51. #-p is for private
  52.  
  53.  
  54.  
  55. -------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment