flexget.plugins.modify.sort_by_weight module#
- class flexget.plugins.modify.sort_by_weight.PluginSortByWeight[source]#
Bases:
objectSort task entries based on multiple fields using a sort weight per field.
Result per entry is stored in ‘sort_by_weight_sum’.
Basic Concept: For each field we calculate a weight based on given parameters and than sum the weights up and do a sort based on it.
Option
Description
field
Name of the sort field
weight
The sort weight used, values between 10-200 are good starts
inverse: yes
Use inverse weighting for the field, example: date, age fields that range in the past This means the lowest entry/value will get the highest weight
upper_limit
The upper value limit or upper cutoff value, that will be used for weighting. This will change the slot distribution, which helps narrow down to more meaningfully weighting results.
Example:
Entry1 is 100 days old, Entry2 is 7 days old, Entry3 is 1000 days old Without a upper_limit the weights will be distributed between 0-1000 days, with a upper_limit: 100 days weights will be distributed between 0-100 days and any value larger than upper_limit, gets the highest score. So we can smoothly distribute the rest between 0-100 days.
delta_distance
The distance, step until a new slot is used for weighting. Think of this like: Any value that is within this distance will get the same weight for the step. NOTE: If not given the delta_distance will be distributed over 10 distinct steps
Example:
Size1 = 4000 MB, Size2 = 3000 MB, Size3 = 700 MB With a weight: 50 and delta_distance: 1200 Size1 and Size2 both get the maximum weight of 50, while Size3 gets the weight for the 0-1200 MB step.
Example:
simple: sort_by_weight: - field: quality weight: 100 # quality is most important, use highest weight - field: content_size weight: 70 # size is still a good quality estimate so use a high weight - field: newznab_pubdate weight: 30 # age is somewhat important so use low weight inverse: yes advanced: sort_by_weight: - field: content_size weight: 80 # we want large files mainly = good quality delta_distance: 500 # anything within 500 MB gets the same weight upper_limit: 8000 # anything over 8000 MB is fine and will get the max weight (80) - field: newznab_pubdate weight: 30 # we still like new releases upper_limit: 60 days # anything older 60 days gets the lowest weight (because of inverse: yes) inverse: yes # reverse weight order for date/age fields - field: newznab_grabs weight: 20 # we like releases that others already downloaded upper_limit: 100 # anything over 100 grabs is fine and gets maximum weight In this example the best result can have a 'sort_by_weight_sum' of sum = 80 + 30 + 20
- schema = {'items': {'additionalProperties': False, 'properties': {'delta_distance': {'oneOf': [{'minimum': 1, 'type': 'integer'}, {'format': 'interval', 'type': 'string'}]}, 'field': {'type': 'string'}, 'inverse': {'default': False, 'type': 'boolean'}, 'upper_limit': {'oneOf': [{'minimum': 1, 'type': 'integer'}, {'format': 'interval', 'type': 'string'}]}, 'weight': {'minimum': 5, 'type': 'integer'}}, 'required': ['field', 'weight'], 'type': 'object'}, 'minItems': 2, 'type': 'array'}#