Duplicates filter: Allow multiple fields and treat first field differently#1231
Duplicates filter: Allow multiple fields and treat first field differently#1231BackSlasher wants to merge 2 commits intoFlexget:developfrom
Conversation
1e60c8e to
55d2e39
Compare
|
How is this different than |
|
Seen is cross task and persists between runs. |
|
Only by default, it can be used locally |
|
@liiight does the "seen" plugin apply for the current entries, or only for entries seen before this run? |
|
If you mean for entires in the same task, I don't think so, but possibly. |
|
Usage example:
|
|
Why? Why not use |
|
I don't want to use |
flexget/plugins/filter/duplicates.py
Outdated
There was a problem hiding this comment.
Why not use enumerate instead?
There was a problem hiding this comment.
I have no answer to that. What are the benefits of it?
I only moved to list because I had some weird behavior when directly accessing items (task.entries[i])
There was a problem hiding this comment.
PS: I'll happily modify if anyone has a better idea for this "loop from this item onward"
There was a problem hiding this comment.
https://docs.python.org/2/library/functions.html#enumerate
It let's you do something like
for idx, val in enumerate(list(task.entries)):
bla bla
|
I'm not sure I fully agree with this PR but if the old behaviour still works without having to change config, then we can see about merging it when issues have been worked out. At a glance it seems highly inefficient. You iterate through the list of entries for every entry ie. O(n^2) -- my brain is pretty fried so there's probably a tighter upper bound than O(n^2). Is there no way to optimize this? |
|
If there is a better way to achieve this without using |
|
For the movie situation, there is the seen_movies plugin already |
|
|
|
You can put seen_movies in local mode, to have it apply to just one task. That being said, I'm not necessarily against a better general way, I just worry about things being even more confusing with multiple ways to do the same thing. |
|
@gazpachoking I toyed with the idea of modifying |
|
@BackSlasher This change might be fine, haven't thought about it fully. @paranoidi You made duplicates plugin, right? Any input? |
|
@paranoidi Ping |
|
@gazpachoking ping |
Serves a use case when you want to accept the first item but reject any duplicates following
All fields must match to be treated as duplicates
55d2e39 to
9bd9127
Compare
|
It is semantically very weird to use duplicates plugin to get first unique match. I would make a separate plugin for that purpose which is more suitably named (ie. unique). I was hesitant to even add the action support for this plugin originally. I'm declining this due that concern. I would be willing to accept this refined as a separate plugin though :) |
|
@BackSlasher Consider doing another PR. Contributions are appreciated! |
Motivation for changes:
Allow accepting "unique" entires using the "duplicates" plugin
Detailed changes:
fieldcan now be a list of multiple fields. All fields must match to trigger "duplicate" behaviour.Entire
Nonevalues are ignoredAddressed issues:
(no tickets)
Personal usecase - select only one entry of each kind (e.g. only one torrent for a movie)
Config usage if relevant (new plugin or updated schema):
None
Log and/or tests output (preferably both):
None