spansh.py: now takes minimum age of data as argument
Still defaults to 1 year. fixes #6
This commit is contained in:
parent
ceccb497dd
commit
0176f70c86
3 changed files with 19 additions and 2 deletions
12
CHANGELOG.md
12
CHANGELOG.md
|
@ -1,3 +1,15 @@
|
|||
# devel
|
||||
|
||||
## Added
|
||||
|
||||
* `spansh.py` old station snearch now takes a `--minage` (in days) argument for
|
||||
what you would consider “outdated” data.
|
||||
|
||||
## Changed
|
||||
|
||||
* `spansh.py` old station search now outputs an age in days for the last update
|
||||
instead of a time stamp.
|
||||
|
||||
# 0.5 (2020-07-01)
|
||||
|
||||
Changed Changelog format. Should be even clearer now at a glance!
|
||||
|
|
|
@ -199,13 +199,15 @@ optional arguments:
|
|||
|
||||
```
|
||||
usage: spansh.py oldstations [-h] [--system [SYSTEM]] [--count [COUNT]]
|
||||
[--short]
|
||||
[--minage [MINAGE]] [--short]
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
--system [SYSTEM] a single system to query. If not present, get the oldest
|
||||
stations overall.
|
||||
--count [COUNT] how many stations to output. Defaults to 50.
|
||||
--minage [MINAGE] minimum age of data (in days) to be considered
|
||||
“outdated”. Defaults to 365 (= 1 year).
|
||||
--short short output format (system/station names only)
|
||||
```
|
||||
|
||||
|
|
|
@ -141,6 +141,9 @@ parser_oldstations.add_argument("--system", nargs="?",
|
|||
+ "overall.")
|
||||
parser_oldstations.add_argument("--count", nargs="?", type=int, default=50,
|
||||
help="how many stations to output. Defaults to 50.")
|
||||
parser_oldstations.add_argument("--minage", nargs="?", type=int, default=365,
|
||||
help="minimum age of data (in days) to be considered “outdated”. Defaults to "
|
||||
+ "365 (= 1 year).")
|
||||
parser_oldstations.add_argument("--short", action='store_true',
|
||||
help="short output format (system/station names only)")
|
||||
|
||||
|
@ -164,7 +167,7 @@ FILTERS = {
|
|||
{
|
||||
"value": [
|
||||
"2017-11-06",
|
||||
(datetime.now() - timedelta(days=365)).strftime("%Y-%m-%d")
|
||||
(datetime.now() - timedelta(days=args.minage)).strftime("%Y-%m-%d")
|
||||
],
|
||||
"comparison": "<=>"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue