Changes between Version 3 and Version 4 of Plugins/Execute


Ignore:
Timestamp:
06/08/2010 11:09:16 AM (14 years ago)
Author:
damoxc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Plugins/Execute

    v3 v4  
    8383 
    8484the same script can be rewritten to be used with the complete event. This way you will get a e-mail when a torrent is started and finished. 
     85 
     86The same can also be done with a single python script: 
     87{{{ 
     88#!python 
     89import sys  
     90import smtplib 
     91 
     92torrent_id = sys.argv[1] 
     93torrent_name = sys.argv[2] 
     94save_path = sys.argv[3] 
     95 
     96subject = "Some subject" 
     97message = """Put your message here 
     98 
     99It can span multiple lines. It can also contain information by specifying 
     100%(torrent_id)s or %(torrent_name)s""" % {  
     101    'torrent_id': torrent_id, 
     102    'torrent_name': torrent_name, 
     103    'save_path': save_path 
     104} 
     105 
     106msg = "Subject: %s\n\n%s" % (subject, message) 
     107 
     108smtp = smtplib.SMTP('smtp.myisp.com') 
     109smtp.sendmail('fromemail@domain.com', 'myemail@domain.com', message) 
     110}}}