Parametrize the directories

This commit is contained in:
Stephane Bortzmeyer 2021-03-27 13:28:13 +01:00
parent d63885ea1b
commit 94279375c1
2 changed files with 12 additions and 6 deletions

View File

@ -9,8 +9,11 @@ The result can be seen (if you have a Gemini browser) [on my Gemini capsule](gem
## Installation
Download the program, Be sure you have the [Python requests
library](http://python-requests.org/) then run the program periodically, for instance through
cron:
library](http://python-requests.org/). Review the default values at
the beginning of the program. Some may be changed through command-line
options and you'll probably use `--destination` (where to put the
results) and `--raw-directory` (where to download the raw text
files). Then run the program periodically, for instance through cron:
```
# Solar alerts

View File

@ -25,14 +25,15 @@ PRESTO_URL = "http://www.sidc.be/archive/product/presto"
# Defaults
date = time.strftime("%Y-%m-%d", time.gmtime(time.time()))
dest_dir = "/var/gemini/presto"
raw_file_dir = "/home/stephane/Gemini/PrestoAlert/raw-files"
raw_file_dir = dest_dir + "/raw-files"
maintainer = "Stéphane Bortzmeyer stephane+gemini@bortzmeyer.org"
verbose = False
index = True
force_index = False
input = None
def usage(msg=None):
print("Usage: %s [--date YYYY-MM-DD] [--destination STRING] [--verbose]" % sys.argv[0], file=sys.stderr)
print("Usage: %s [--date YYYY-MM-DD] [--destination STRING] [--raw-directory] [--verbose]" % sys.argv[0], file=sys.stderr)
if msg is not None:
print(msg, file=sys.stderr)
@ -65,7 +66,7 @@ Last alert:
### This Gemini mirror
Maintained by Stéphane Bortzmeyer stephane+gemini@bortzmeyer.org from the SIDC data.
Maintained by %s from the SIDC data.
### SIDC - Solar Influences Data analysis Center - RWC Belgium
@ -78,7 +79,7 @@ E-mail sidc-support@oma.be
=> http://www.astro.oma.be/common/internet/en/data-policy-en.pdf Intellectual Property Rights
=> http://www.astro.oma.be/common/internet/en/disclaimer-en.pdf Liability Disclaimer
=> http://www.astro.oma.be/common/internet/en/privacy-policy-en.pdf Use and processing of your personal information
""", file=f)
""" % maintainer, file=f)
f.close()
try:
@ -94,6 +95,8 @@ try:
date = value # TODO check the syntax?
elif option == "--destination":
dest_dir = value
elif option == "--destination":
raw_dir = value
elif option == "--source":
raw_file_dir = value
elif option == "--verbose" or option == "-v":