FileType, Disposition, ContentId) import base64 import config import resize feeds_file = sys.argv[1] catagory = sys.argv[2] print feeds_file f = open(feeds_file, "r") feeds = f.readlines() f.close() date = date.today().isoformat() title = "Daily " + catagory + " " + date feed_num = dailykindle.build(feeds, config.tmp_dir, title, timedelta(1)) if not feed_num == 0: print "resize " + config.tmp_dir + '/images/' resize.resize_dir(config.tmp_dir + '/images/') dailykindle.mobi(config.tmp_dir + '/daily.opf', config.kindle_gen) date = time.strftime("%m/%d/%Y") message = Mail(from_email=config.from_mail, to_emails=config.to_mail, subject='Daily RSS' + date, html_content='RSS DAILY ' + date) file_path = config.tmp_dir + '/daily.mobi' with open(file_path, 'rb') as f:
from datetime import timedelta import smtplib import os from email.mime.multipart import MIMEMultipart from email.mime.base import MIMEBase from email.mime.text import MIMEText from email import encoders import mimetypes import dailykindle f = open("sources.txt", "r") feeds = f.readlines() f.close() dailykindle.build(feeds, '/tmp/', timedelta(1)) dailykindle.mobi('/tmp/daily.opf', 'bin/kindlegen') msg = MIMEMultipart() msg['From'] = '*****@*****.**' msg['To'] = '*****@*****.**' msg['Subject'] = 'convert' msg.attach(MIMEText("")) ctype, encoding = mimetypes.guess_type('/tmp/daily.mobi') if ctype is None or encoding is not None: ctype = 'application/octet-stream' maintype, subtype = ctype.split('/', 1) fp = open('/tmp/daily.mobi', 'rb') part = MIMEBase(maintype, subtype)
from datetime import timedelta import smtplib import os from email.mime.multipart import MIMEMultipart from email.mime.base import MIMEBase from email.mime.text import MIMEText from email import encoders import mimetypes import dailykindle f = open("sources.txt", "r") feeds = f.readlines() f.close() dailykindle.build(feeds, '/tmp/', timedelta(1)) dailykindle.mobi('/tmp/daily.opf', 'bin/kindlegen') msg = MIMEMultipart() msg['From'] = '*****@*****.**' msg['To'] = '*****@*****.**' msg['Subject'] = 'convert' msg.attach(MIMEText("")) ctype, encoding = mimetypes.guess_type('/tmp/daily.mobi') if ctype is None or encoding is not None: ctype = 'application/octet-stream' maintype, subtype = ctype.split('/', 1)
import os import dailykindle import sendgrid import time f = open("sources.txt", "r") feeds = f.readlines() f.close() p = open("/home/ec2-user/pass.txt", "r") s = p.readlines() p.close() dailykindle.build(feeds, '../temp/', timedelta(1)) dailykindle.mobi('../temp/daily.opf', '../kindlegen/kindlegen') date = time.strftime("%m/%d/%Y") message = sendgrid.Mail() sg = sendgrid.SendGridClient(s[0].strip('\n'), s[1].strip('\n')) message = sendgrid.Mail() message.add_to('*****@*****.**') message.set_subject('Daily RSS'+ date) message.add_attachment("DailyRSS"+date+".mobi",'../temp/daily.mobi') message.set_from('*****@*****.**') message.set_text('RSS DAILY ' + date) status, msg = sg.send(message) print '[' + str(status) + ']' + msg
import sendbyaws dir = os.path.dirname(__file__) f = open("/opt/kindle/sources.txt", "r") feeds = f.readlines() f.close() p = open("/opt/kindle/kindle-pass.txt", "r") s = p.readlines() p.close() temppath = os.path.abspath(os.path.join(dir, '../temp/')) kgen = os.path.abspath(os.path.join(dir, '../kindlegen/kindlegen')) dailykindle.build(feeds, temppath, timedelta(1)) dailykindle.mobi(os.path.join(temppath, 'daily.opf'), kgen) date = time.strftime("%m/%d/%Y") sendbyaws.send(s[0].strip('\n'), s[1].strip('\n'), ('Daily RSS' + date), 'RSS DAILY ' + date, os.path.join(dir, '../temp/daily.mobi')) ''' message = sendgrid.Mail() sg = sendgrid.SendGridClient(s[0].strip('\n'), s[1].strip('\n')) message = sendgrid.Mail() message.add_to(s[2].strip('\n')) message.set_subject('Daily RSS'+ date) message.add_attachment("DailyRSS"+date+".mobi",os.path.join(dir, '../temp/daily.mobi')) message.set_from(s[2].strip('\n')) message.set_text('RSS DAILY ' + date)