diff --git a/presto2gemini.py b/presto2gemini.py index 2104065..aeb8ae1 100755 --- a/presto2gemini.py +++ b/presto2gemini.py @@ -20,7 +20,7 @@ import shutil # http://python-requests.org/ import requests -PRESTO_URL = "https://www.sidc.be/archive/product/presto" +PRESTO_URL = "https://www.sidc.be/spaceweatherservices/applications/archive/product/presto" SOURCE_URL = "https://forge.chapril.org/bortzmeyer/presto2gemini" # Defaults @@ -52,16 +52,16 @@ From the alerts sent by SIDC (Solar Influences Data analysis Center). for file in os.listdir(raw_dir): files.append(file) sorted_files = sorted(files, reverse=True) - fs = open("%s%s.txt" % (gem_dir, sorted_files[0]), "r") - print(""" + if len(sorted_files) != 0: + fs = open("%s%s.txt" % (gem_dir, sorted_files[0]), "r") + print(""" Last alert: %s """ % fs.read(), file=f) - fs.close() - for file in sorted(files, reverse=True): - print("=> %s.gmi Alert of %s" % (file, file), file=f) - + fs.close() + for file in sorted(files, reverse=True): + print("=> %s.gmi Alert of %s" % (file, file), file=f) print(""" ## Legal and contact