diff --git a/CHANGELOG.md b/CHANGELOG.md index 808bcf8..c799881 100644 --- a/CHANGELOG.md +++ b/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! diff --git a/README.md b/README.md index cf0e0b0..d75cf51 100644 --- a/README.md +++ b/README.md @@ -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) ``` diff --git a/spansh.py b/spansh.py index 6f01233..14f399d 100755 --- a/spansh.py +++ b/spansh.py @@ -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": "<=>" }