Advertisement
dumle29

Auto create, add to deluge, and email torrent.

May 26th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.13 KB | None | 0 0
  1. #!/bin/sh
  2. mktorrent -p -l 16 -a udp://tracker.coppersurfer.tk:6969/announce -a udp://tracker.openbittorrent.com:80/announce -a udp://tracker.leechers-paradise.org:6969/announce -o /srv/deluge/torrent/$1.torrent /srv/deluge/storage/$1
  3. # Now lets send the torrent in a mail
  4.  
  5. cat << end > /srv/deluge/mail.mail
  6. To:EMAIL@EXAMPLE.com
  7. Cc:EMAIL@EXAMPLE.com
  8. From:EMAIL@EXAMPLE.com
  9. Subject:Autogenerated torrent
  10. MIME-Version: 1.0 (mime-contruct 1.9)
  11. Content-Type: multipart/mixed;
  12.     boundary="MIMEBOUNDARY"
  13.  
  14. --MIMEBOUNDARY
  15. Content-type: text/plain
  16.  
  17. Torrent attached
  18.  
  19. --MIMEBOUNDARY
  20. Content-Type: application/x-bittorrent;
  21. Content-Disposition: attachment;
  22.     filename="$1.torrent"
  23. Content-Transfer-Encoding: base64
  24.  
  25. end
  26. cat /srv/deluge/torrent/$1.torrent | openssl base64 >> /srv/deluge/mail.mail
  27. echo -e '\n\n--MIMEBOUNDARY--' >> /srv/deluge/mail.mail
  28. cat /root/mail.mail | msmtp --read-recipients
  29.  
  30. # Move the file to the downloads directory of deluge, and copy the torrent to the auto add folder setup in deluge
  31. mv /srv/deluge/storage/$1 /srv/deluge/downloads/$1
  32. cp /srv/deluge/torrent/$1.torrent /srv/deluge/autoAdd/$1.torrent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement