Skip to content

[fix] next_series_seasons - Limit size of emit in one run#1828

Merged
liiight merged 3 commits intodevelopfrom
next-series-seasons-limit
May 19, 2017
Merged

[fix] next_series_seasons - Limit size of emit in one run#1828
liiight merged 3 commits intodevelopfrom
next-series-seasons-limit

Conversation

@tubedogg
Copy link
Copy Markdown
Contributor

@tubedogg tubedogg commented May 18, 2017

Motivation for changes:

Given a season identifier of S2014 and backfill enabled, it is possible for next_series_seasons to emit all the way down to S01 in one run.

Detailed changes:

This change prevents it from emitting if begin is not set and the group of seasons to review is more than 15, or if begin is set and the difference between the latest season to review and begin is more than 30. In both cases the user will be required to set or adjust begin before any emit will occur.

Addressed issues:

Given a season identifier of S2014 and backfill enabled, it is possible
for `next_series_seasons` to emit all the way down to zero. This change
prevents it from emitting if `begin` is not set and the group of
seasons to review is more than 15, or if `begin` is set and the
difference between the latest season to review and `begin` is more than
30. In both cases the user will be required to set or adjust `begin`
before any emit will occur.
@tubedogg tubedogg requested a review from liiight May 18, 2017 22:24
else:
latest_season = low_season + 1

if (latest_season - low_season > 15 and not series.begin) or (series.begin and
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move these values to consts?

log.error('Series `%s` does not have a begin episode set and continuing this task would result ' 'in more than 15 seasons being emitted. To prevent emitting incorrect seasons, this '
'series will not emit unless the begin episode is set in your series config or by '
'using the CLI subcommand `series begin "%s" <SxxExx>`.', series.name, series.name)
continue
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if season is 2017 the user will get 2005 error messages in the log?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is outside the loop that counts through the seasons. This should only happen once per series.

if isinstance(config, bool):
config = {}

DIFF_NO_SERIES_BEGIN = 15
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should ideally go at the beginning of the module, outside if the plugin class. The idea is that constant values like these can be easily viewed when editing the file and kit hidden internally.
Also I'm not too wild about their names but can't think of a better idea...

@liiight liiight merged commit 3afe32c into develop May 19, 2017
@tubedogg tubedogg deleted the next-series-seasons-limit branch May 24, 2017 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants