-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
110 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
'handbrake', | ||
'logger', | ||
'makemkv', | ||
'notification', | ||
'stopwatch', | ||
'testing' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
""" | ||
Notification Class | ||
Released under the MIT license | ||
Copyright (c) 2014, Ian Bird | ||
@category misc | ||
@version $Id: 1.7-test2, 2015-05-11 07:48:38 ACST $; | ||
@author Jacob Carrigan | ||
@license http://opensource.org/licenses/MIT | ||
""" | ||
|
||
import os | ||
import subprocess | ||
import logger | ||
|
||
class Notification(object): | ||
|
||
def __init__(self, config): | ||
self.log = logger.Logger("notification", config['debug'], config['silent']) | ||
self.server = config['notification']['smtp_server'] | ||
self.username = config['notification']['smtp_username'] | ||
self.password = config['notification']['smtp_password'] | ||
self.port = config['notification']['smtp_port'] | ||
self.to_address = config['notification']['destination_email'] | ||
self.from_address = config['notification']['source_email'] | ||
|
||
def _send(self, status): | ||
import smtplib | ||
from email.MIMEMultipart import MIMEMultipart | ||
from email.MIMEText import MIMEText | ||
|
||
if self.from_address == '[email protected]': | ||
self.logging.error('Email address has not been set correctly, ignoring send request from: %s' % self.from_address) | ||
return | ||
|
||
msg = MIMEMultipart() | ||
msg['From'] = self.from_address | ||
msg['To'] = self.to_address | ||
msg['Subject'] = "Autorippr" | ||
|
||
body = status | ||
msg.attach(MIMEText(body, 'plain')) | ||
|
||
server = smtplib.SMTP(self.server, self.port) | ||
server.starttls() | ||
server.login(self.from_address, self.password) | ||
text = msg.as_string() | ||
server.sendmail(self.from_address, self.to_address, text) | ||
server.quit() | ||
|
||
def rip_complete(self,dbvideo): | ||
|
||
status = 'Rip of %s complete' % dbvideo.vidname | ||
self._send(status) | ||
|
||
def compress_complete(self,dbvideo): | ||
|
||
status = 'Compress of %s complete' % dbvideo.vidname | ||
self._send(status) | ||
|
||
def extra_complete(self,tracks,dbvideo): | ||
|
||
status = 'Extra of %s complete' % dbvideo.vidname | ||
self._send(status) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,6 +73,31 @@ filebot: | |
|
||
# TV Folder | ||
tvPath: /tmp/tvshows | ||
|
||
notification: | ||
# Enable email notification | ||
smtp_enable: False | ||
|
||
# Email state | ||
smtp_state: rip, compress, extra | ||
|
||
# Outgoing Mail Server (smtp.live.com, smtp.mail.yahoo.com) | ||
smtp_server: smtp.gmail.com | ||
|
||
# Outgoing Mail Port (Hotmail 587, Yahoo 995) | ||
smtp_port: 465 | ||
|
||
# Email Username | ||
smtp_username: [email protected] | ||
|
||
# Email Username's Password | ||
smtp_password: my_password | ||
|
||
# Source email, usually smtp_username | ||
source_email: [email protected] | ||
|
||
# Destination Email | ||
destination_email: [email protected] | ||
|
||
analytics: | ||
enable: True | ||
|