[add] series CLI - use environment variables for defaults#1850
[add] series CLI - use environment variables for defaults#1850
Conversation
`series show` and `series list` CLI subcommands now read environment variables to determine default parameters. These can be overridden on a per-run basis by utilizing the existing command-line arguments.
|
Maybe move var names to consts? So you'd see them all at once? |
Rename `FLEXGET_SERIES_SORTBY_*` to `FLEXGET_SERIES_SHOW_SORTBY_*` to differentiate from `FLEXGET_SERIES_LIST_SORTBY_*`.
|
Addressed in 97acac7. |
flexget/plugins/cli/series.py
Outdated
| default='configured', | ||
| help='Limit list to series that are currently in the config or not (default: %(default)s)') | ||
| list_parser.add_argument('--premieres', action='store_true', | ||
| list_parser.add_argument('--premieres', action='store_const', const='premieres', |
There was a problem hiding this comment.
That's a good question. I think it was about eliminating the default False that store_true creates when the flag isn't used? Because for the --descending/--ascending flags I need to know if they were present to override envs (since both --ascending being present or --descending not being present result in a value of False, so no way to tell which is the case just based on the value). In this case, since there's only one, False would mean it's not present, so that would be fine. I can change it back.
There was a problem hiding this comment.
it's fine by me, i was just curious
| show_order = show_parser.add_mutually_exclusive_group(required=False) | ||
| show_order.add_argument('--descending', dest='order', action='store_true', help='Sort in descending order') | ||
| show_order.add_argument('--ascending', dest='order', action='store_false', help='Sort in ascending order') | ||
| show_order.add_argument('--descending', dest='order', action='store_const', const='desc', |
There was a problem hiding this comment.
you could probably reuse these args if you really really wanted to :-)
you can set a parent parser and inherit it, but it's really a minor issue.
|
Would it be possible to set these environment variables directly from the config? That would make it easier for users since they don't have to split logic between config and shell files and easier for devs to track down problems. You could add a new item to the issues template like "show the output of |
|
currently, no cli plugin even have access to the config. i'm not saying i'm necessarily against it, but making this change work generically and correctly is a large task IMO, and i'm not sure the added value is worth it. maybe someone else feels different though |
Motivation for changes:
Feature request
Detailed changes:
series showandseries listCLI subcommands now read environment variables to determine default parameters. These can be overridden on a per-run basis by utilizing the existing command-line arguments.flexget series show:FLEXGET_SERIES_SHOW_SORTBY_FIELDcan be set toage(default) oridentifierto determine which field releases are sorted by. (--sort-byoptional argument)FLEXGET_SERIES_SHOW_SORTBY_ORDERcan be set todescto display results in descending order. (--descending/--ascendingoptional arguments)flexget series list:FLEXGET_SERIES_LIST_CONFIGUREDcan be set toconfigured(default),unconfigured, orallto determine whether to only show series which are currently in the config. (positional argument)FLEXGET_SERIES_LIST_PREMIEREScan be set toyesto only show series which only have episode 1, or 1 and 2, downloaded. (--premieresoptional argument)FLEXGET_SERIES_LIST_STATUScan be set tonewto only show series that have seen a release in the last 7 days, orstaleto only show series that haven't seen a release in the last 365 days. (--new/--staleoptional arguments)FLEXGET_SERIES_LIST_NUMDAYScan be set to the number of days thatSTATUSlimits to. (theDAYSoption in--new DAYS/--stale DAYS)FLEXGET_SERIES_LIST_SORTBY_FIELDcan be set toname(default) orageto determine which field series are sorted by. (--sort-byoptional argument)FLEXGET_SERIES_LIST_SORTBY_ORDERcan be set todescto display results in descending order. (--descending/--ascendingoptional arguments)Note there are presently bugs with the output of
series list --premieresandseries list --sort-by age, which already existed and are unrelated to these changes. Specifically,series list --premieresdoesn't take season packs into account when determining which series to display, andseries list --sort-by ageseems to sort-of-but-not-completely sort by age. I'll be looking at these separately and submit another PR if I can resolve them.