[change] series begin - SXX accepted as ID / CLI --forget option#1841
[change] series begin - SXX accepted as ID / CLI --forget option#1841
Conversation
Two changes relating to `begin`: - Behind the scenes, appends ‘E01’ when an identifier of the type SXX is used as the begin episode. This can be done via CLI `series begin SXX`, config with series plugin, or API. To make this work, an additional config format validator of `episode_or_season_identifier` was added which calls `parse_episode_identifier` with the new parameter `identify_season` set to `True`. When this is not wanted, continue to use the existing `episode_identifier` config format validator. - CLI `series begin <show> --forget` argument to remove begin episode association in series table.
flexget/plugins/filter/series.py
Outdated
| identified_by = parse_episode_identifier(ep_id, identify_season=True) | ||
| if identified_by == 'ep': | ||
| ep_id = ep_id.upper() | ||
| if 'E' not in ep_id: |
There was a problem hiding this comment.
This is far too specific to exist in this scope. What about 1x01 episodes? or any other format?
There was a problem hiding this comment.
None of those would have gotten past parse_episode_identifier, which only recognizes SXXEXX (and now SXX).
There was a problem hiding this comment.
That said I did change it to look for an entity_type of season returned from parse_episode_identifier instead of parsing the string directly, though that function still only recognizes SXXEXX or SXX.
| identified_by = 'sequence' | ||
| elif re.match(r'(?i)^S\d{1,4}E\d{1,3}$', ep_id): | ||
| identified_by = 'ep' | ||
| elif re.match(r'(?i)^S\d{1,4}$', ep_id) and identify_season: |
There was a problem hiding this comment.
This is the core point of this whole change. You need the parse function here to return a tuple perhaps, that sets identified by and entity type. Then all other elements that rely on this data should be converted to use that tuple reply.
flexget/plugins/filter/series.py
Outdated
| session.flush() | ||
| series.begin = episode | ||
|
|
||
| def remove_series_begin(series): |
There was a problem hiding this comment.
This is completely redundant, just set to None where needed
flexget/config_schema.py
Outdated
|
|
||
|
|
||
| @format_checker.checks('episode_or_season_identifier', raises=ValueError) | ||
| def is_episode_or_season_identifier(instance): |
It consists of `identified_by` and `entity_type`, the latter of which returns as either `episode` or `season`. - Other than set_series_begin, the only other places using `parse_episode_identifier` simply checked if the return was `None`, indicating an error, so no changes were necessary. - Removed remove_series_begin function and moved its functionality into plugins/CLI/series.py. - Renamed `episode_or_season_identifier` config format validator to `episode_or_season_id`.
flexget/plugins/cli/series.py
Outdated
| except ValueError as e: | ||
| console(e) | ||
| else: | ||
| if re.match(r'(?i)^S\d{1,4}$', ep_id): |
There was a problem hiding this comment.
Change this to take type as well
There was a problem hiding this comment.
Okay, this should be addressed in 1240b73.
|
This should be ready to go. |
Motivation for changes:
Be able to use
S02as abeginidentifier, and also forget abeginepisode link without removing the history of the episode itself.Detailed changes:
Two changes relating to
begin:series begin SXX, config with series plugin, or API. To make this work, an additional config format validator ofepisode_or_season_identifierwas added which callsparse_episode_identifierwith the new parameteridentify_seasonset toTrue. When this is not wanted, continue to use the existingepisode_identifierconfig format validator.series begin <show> --forgetargument to remove begin episode association in series table.Implemented feature requests:
Log and/or tests output (preferably both):
When using an identifier of the format
SXXwhile setting begin via CLI:When using the
--forgetargument: