From d4ddf0097608667eaf979561b3db8a1a5e64597c Mon Sep 17 00:00:00 2001 From: hubobel Date: Mon, 9 Oct 2017 19:09:46 +0200 Subject: [PATCH] =?UTF-8?q?Code=20ver=C3=A4ndert=20und=20f=C3=BCr=20den=20?= =?UTF-8?q?1.=20Start=20angepasst?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Mail.py | 55 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/Mail.py b/Mail.py index e885567..12f593c 100644 --- a/Mail.py +++ b/Mail.py @@ -17,37 +17,58 @@ def modification_date(filename): t = os.path.getmtime(filename) return datetime.datetime.fromtimestamp(t) +if os.path.isdir('mpg')!= True: + os.makedirs('mpg') try: os.rename('mpg/heute.pdf', 'mpg/heute1.pdf') + url = 'heute' + download(url) + x = os.stat('mpg/heute.pdf') + x = x.st_size + y = os.stat('mpg/heute1.pdf') + y = y.st_size + if x != y: + print("die Dateien 'heute' sind ungleich") + os.system('s-nail -a mpg/heute.pdf -s "Alpha-MPG-Vertretungsliste" schneeschieben@web.de') + else: + print("Es gibt keine neuen Mals mit 'heute'") + d = modification_date('mpg/heute.pdf') + d = d.strftime('%H:%M:%S') + print("heute: " + d ) + d = modification_date('mpg/heute1.pdf') + d = d.strftime('%H:%M:%S') + print("heute1: " + d) except FileNotFoundError: print("File Heute.PDF not found") print("Will try to download it from the MPG-Server") url = 'heute' download(url) - os.rename('mpg/heute.pdf', 'mpg/heute1.pdf') + try: os.rename('mpg/morgen.pdf', 'mpg/morgen1.pdf') + url = 'morgen' + download(url) + x = os.stat('mpg/morgen.pdf') + x = x.st_size + y = os.stat('mpg/morgen1.pdf') + y = y.st_size + if x != y: + print("die Dateien 'morgen' sind ungleich") + os.system('s-nail -a mpg/morgen.pdf -s "Alpha-MPG-Vertretungsliste" schneeschieben@web.de') + else: + print("Es gibt keine neuen Mails mit 'morgen'") + + d= modification_date('mpg/morgen.pdf') + d = d.strftime('%H:%M:%S') + print ("morgen: " + d) + d = modification_date('mpg/morgen1.pdf') + d = d.strftime('%H:%M:%S') + print("morgen1: " + d) except FileNotFoundError: print("File Morgen.PDF not found") print("Will try to download it from the MPG-Server") url = 'morgen' download(url) - os.rename('mpg/morgen.pdf', 'mpg/morgen1.pdf') -url = 'morgen' -download(url) -url = 'heute' -download(url) - -x=os.stat('mpg/heute.pdf') -x = x.st_size -y=os.stat('mpg/heute1.pdf') -y = y.st_size -if x != y : - print("die Dateien sind ungleich") - os.system('s-nail -a mpg/heute.pdf -s "Alpha-MPG-Vertretungsliste" schneeschieben@web.de') -else: - print ("Es gibt keine neuen Mals") -