Code verändert und für den 1. Start angepasst
This commit is contained in:
parent
b8ae21f48b
commit
d4ddf00976
1 changed files with 38 additions and 17 deletions
55
Mail.py
55
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")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue