Skip to content

Commit

Permalink
Merge pull request #7 from schemen/devel
Browse files Browse the repository at this point in the history
Many Bugfixes. Proper Notification email
  • Loading branch information
schemen authored Dec 9, 2017
2 parents 5391a4e + d97ec69 commit 9680a93
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bin/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "v0.3.1"
__version__ = "v0.3.3"
4 changes: 2 additions & 2 deletions bin/m2emDownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def data_processor(self):


# Mangafox Parser
elif self.origin == "mangafox.me":
elif self.origin == "mangafox.me" or self.origin == "mangafox.la":
urllist = mxparser.getPagesUrl(self.mangastarturl,self.mangapages)


Expand Down Expand Up @@ -121,7 +121,7 @@ def downloader(self):
# https://github.com/aplanas/kmanga/blob/master/mobi/mobi.py#L416
# Thanks a lot to Alberto Planas for coming up with it!
#
if self.origin == "mangafox.me":
if self.origin == "mangafox.me" or self.origin == "mangafox.la":
logging.debug("Cleaning Mangafox Footer")
img = Image.open(imagepath)
_img = ImageOps.invert(img.convert(mode='L'))
Expand Down
2 changes: 1 addition & 1 deletion bin/m2emHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ def getMangaData(url,entry):
mangadata = [manganame, pages, chapter, title, chapter_name, chapter_pubDate]

# Mangafox Parser
elif origin == "mangafox.me":
elif origin == "mangafox.me" or origin == "mangafox.la":
logging.debug("Getting Mangadata from Mangafox.me for %s" % url)

# Easy Stuff
Expand Down
37 changes: 34 additions & 3 deletions bin/m2emSender.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def send_eb(self):
for user in self.users:
kindle_mail = user[3]
shouldsend = user[4]
user_mail = user[2]

# Check if user wants Mails
if shouldsend == "True":
Expand Down Expand Up @@ -126,15 +127,45 @@ def send_eb(self):
#server.sendmail(emailadress, kindle_mail, msg.as_string())
server.sendmail(self.emailadress, kindle_mail, msg)
server.close()
logging.debug("Sent email to %s "% kindle_mail)
logging.debug("Sent Ebook email to %s "% kindle_mail)
self.send_confirmation(user_mail)
except smtplib.SMTPException as e:
logging.debug("Could not send email! %s" % e)


# Set Email as Sent
helper.setIsSent(self.mangaid,self.database)
logging.info("Sent %s to all requested users."% self.mangatitle)



def send_confirmation(self,usermail):

# Compile Email
msg = MIMEMultipart()
msg['Subject'] = 'Ebook Delivery of %s' % self.mangatitle
msg['Date'] = formatdate(localtime=True)
msg['From'] = self.emailadress
msg['To'] = usermail
msg['Message-ID'] = make_msgid()

text = '%s has been delivered to your Kindle Email!' % self.mangatitle
msg.attach(MIMEText(text))

# Convert message to string
sio = StringIO()
gen = Generator(sio, mangle_from_=False)
gen.flatten(msg)
msg = sio.getvalue()

try:
server = smtplib.SMTP(self.smtpserver, self.serverport, )
if self.starttls:
server.starttls()
server.ehlo()
server.login(self.emailadress, self.password)
server.sendmail(self.emailadress, usermail, msg)
server.close()
logging.debug("Sent confirmation email to %s " % usermail)
except smtplib.SMTPException as e:
logging.debug("Could not send email! %s" % e)
pass

2 changes: 1 addition & 1 deletion bin/sourceparser/m2emMangafox.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def getChapterName(page):
soup = BeautifulSoup(page.content, 'html.parser')

#Get Manga Titel
search = re.search(': (.*?) at MangaFox.me"', str(soup))
search = re.search(': (.*?) at MangaFox', str(soup))
chaptername = search.group(1)
return chaptername

Expand Down
2 changes: 1 addition & 1 deletion bin/sourceparser/m2emMangastream.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def getPages(page):
soup = BeautifulSoup(page.content, 'html.parser')

#Get Manga Titel
var1 = soup.body.findAll(text=re.compile("Last Page \((..)\)"))
var1 = soup.body.findAll(text=re.compile("Last Page \((.*)\)"))
pages = int(var1[0][11:-1])
return pages

Expand Down

0 comments on commit 9680a93

Please sign in to comment.