Skip to content

[fix] parsing: nested parsing select#3286

Merged
gazpachoking merged 2 commits intoFlexget:developfrom
soloam:nested_parsing_select
Dec 14, 2021
Merged

[fix] parsing: nested parsing select#3286
gazpachoking merged 2 commits intoFlexget:developfrom
soloam:nested_parsing_select

Conversation

@soloam
Copy link
Copy Markdown
Contributor

@soloam soloam commented Dec 14, 2021

Motivation for changes:

When parsing plugin is used nested (from_task for example), or for example in a global template, the selection is cleared in on_task_exit, returning to the internal by default

Detailed changes:

  • added a nested control to the selection, so that it's only removes the running task config.

Config usage if relevant (new plugin or updated schema):

templates:
  global:
    parsing:
      movie: guessit
      series: guessit

tasks:
  task_input:
    disable:
      - remember_rejected
      - seen
      - retry_failed
      - seen_info_hash

    accept_all: yes

  get_guess_it:
    disable:
      - remember_rejected
      - seen
      - retry_failed
      - seen_info_hash

    mock:
      - { "title": "My.Series.S01E01.iNTERNAL.720p.x265-ZMNT" }

    configure_series:
      from:
        mock:
          - { "title": "My Series (2021)" }
      settings:
        parse_only: yes

class PluginParsing:
"""Provides parsing framework"""

_selected = False
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.

What does this do? Why not just check if selected_parsers is empty, rather than keeping track separately? Otherwise it looks good to me.

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.

I do this check because to avoid pop a entry on a task that didn't set it! Otherwise a inner task that does not set a config would delete the config from the upper one

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.

Ahh, understood. I'm not sure making it a class property helps though does it? If another task runs before the exit handler of the current task, this will still be True there, even though that task didn't set it, no?

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 something like task._custom_parser = True, then do getattr(task, '_custom_parser', False) to check.

@gazpachoking gazpachoking merged commit a4ad21f into Flexget:develop Dec 14, 2021
@gazpachoking
Copy link
Copy Markdown
Member

LGTM, thanks!

@soloam soloam deleted the nested_parsing_select branch December 23, 2021 11:37
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