[add] sort_by - Option to ignore leading articles#1831
Merged
Conversation
Adds an additional option, `ignore_articles`. When set to yes, the sort will ignore the English articles ‘the’, ‘a’, and ‘an’ when they appear as the first word in the field to be sorted. Alternatively, you can also specify a custom regular expression to be used, for use with other languages or to otherwise customize the articles that are ignored.
Added tests for both bool and custom regex forms of `ignore_articles` options. All tests now run from one function through use of pytest.mark.parametrize.
liiight
reviewed
May 20, 2017
flexget/plugins/modify/sort_by.py
Outdated
| } | ||
|
|
||
| def on_task_filter(self, task, config): | ||
| re_articles = '^(the|a|an)\s' |
flexget/plugins/modify/sort_by.py
Outdated
|
|
||
| def on_task_filter(self, task, config): | ||
| re_articles = '^(the|a|an)\s' | ||
| if isinstance(config, basestring): |
Member
There was a problem hiding this comment.
I know it was already there but change basestring into str
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation for changes:
I wanted to sort my series without regard to leading articles.
Detailed changes:
ignore_articles:ignore_articlesoptions.@pytest.mark.parametrize.Config usage if relevant (new plugin or updated schema):
Tests
Added two tests to test_sort_by.py for
ignore_articles: yesandignore_articles: '^(the|a)\s'.