[Plugin] execute not executing [solved]

Suggest, post, or discuss plugins for Deluge
Post Reply
Krayons

[Plugin] execute not executing [solved]

Post by Krayons »

Hi guys.

I have no idea why this is not working for me.

OS: Ubuntu 12.10
Deluge: 1.3.5

Using a thin client to connect and configure deluge.

The script:

Code: Select all

#!/usr/bin/python

import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email import Encoders
import os
import sys
import smtplib
try:
    torrent_id = sys.argv[1]
    torrent_name = sys.argv[2]
    save_path = sys.argv[3]
except:
    torrent_id = ''
    torrent_name = ''
    save_path = ''
category = "TV Shows"

gmail_user = "myemail@gmail.com"
gmail_pwd = "hunter2"

def mail(to, subject, text):
   msg = MIMEMultipart()

   msg['From'] = gmail_user
   msg['TO'] = to
   msg['Subject'] = subject

   msg.attach(MIMEText(text))


   mailServer = smtplib.SMTP("smtp.gmail.com", 587)
   mailServer.ehlo()
   mailServer.starttls()
   mailServer.ehlo()
   mailServer.login(gmail_user, gmail_pwd)
   mailServer.sendmail(gmail_user, to, msg.as_string())
   # Should be mailServer.quit(), but that crashes...
   mailServer.close()

mail("myemail@gmail.com",
   "[" + category + "] has just been uploaded",
    "Still working on it ." + torrent_id + torrent_name + save_path )
http://i.imgur.com/RAJaU.png

When I run
/home/system/sendmail.py
or
./sendmail.py
or when I add the args

/home/system/sendmail.py "arg1" "2" "3"

It works 100% but deluge does not seem to execute it when a torrent completes. Any idea how I can trouble shoot this more?

Solved. Needed to restart deluge... DoH!
Post Reply