Skip to content

[add] free_space: Add action and when#3293

Merged
gazpachoking merged 6 commits intoFlexget:developfrom
soloam:free_space_action
Jan 20, 2022
Merged

[add] free_space: Add action and when#3293
gazpachoking merged 6 commits intoFlexget:developfrom
soloam:free_space_action

Conversation

@soloam
Copy link
Copy Markdown
Contributor

@soloam soloam commented Dec 22, 2021

Motivation for changes:

Add the ability to set when and action to the free_space plugin. Makes plugin more useful
Previews behavior is preserved in default config

Detailed changes:

  • add when property with option to set "start", "filter", "download" (default)
  • add action property with option to set "reject", "accept", "fail", "abort" (default)

Addressed issues:

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

  free_space:
    priority: 9
    free_space:
      space: 90000000
      when: 
        - start
        - filter
        - download
      action: accept
    mock: [{ title: "Check.Free.Space" }]
    exec: echo "Check free space."
    disable: [seen]

Log and/or tests output (preferably both):

2021-12-22 16:55:59 VERBOSE  task          free_space      ACCEPTED: `Check.Free.Space` by free_space plugin

@gazpachoking
Copy link
Copy Markdown
Member

What sort of situations might this be used for?

@soloam
Copy link
Copy Markdown
Contributor Author

soloam commented Jan 19, 2022

tasks:
  free_space:
    free_space:
      abort_if: above
      space: 1
    exec: echo "Check free space."
    disable: [seen]

Copy link
Copy Markdown
Member

@gazpachoking gazpachoking left a comment

Choose a reason for hiding this comment

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

I'm not convinced about adding the 'when' or 'action' options. What are the cases where these would be useful?

logger = logger.bind(name='free_space')

ABORT_UNDER = 'below'
ABORT_OVER = 'above'
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.

Let's keep the naming consistent, either above/below, or under/over. I'm good with either one.

@soloam
Copy link
Copy Markdown
Contributor Author

soloam commented Jan 19, 2022

Done @gazpachoking . I was trying different names but didn't change the const names!

@soloam soloam requested a review from gazpachoking January 19, 2022 20:39
Copy link
Copy Markdown
Member

@gazpachoking gazpachoking left a comment

Choose a reason for hiding this comment

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

It looks like some of the stuff for 'action' and 'when' got pulled out, but not all of it?

@soloam
Copy link
Copy Markdown
Contributor Author

soloam commented Jan 20, 2022

Sorry, I missed those!

@soloam soloam requested a review from gazpachoking January 20, 2022 09:58
@gazpachoking gazpachoking merged commit 05d53fb into Flexget:develop Jan 20, 2022
@gazpachoking
Copy link
Copy Markdown
Member

Thanks!

@soloam soloam deleted the free_space_action branch January 27, 2022 01:28
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.

Add an option to run a task for free_space, besides abort.

2 participants