i96751414 / script.flix.magneto

Provider for Flix, using Torrest
4 stars 1 forks source link

Fix resolution filter #8

Closed jonian closed 1 year ago

jonian commented 1 year ago

Resolution filter matches on multiple words and that leads to wrong resolutions. For example:

Some file name 1080p bluray # => 720p
i96751414 commented 1 year ago

This breaks the way the quality is classified, as they need to be ordered. I understand the problem you are pointing out. However I don't think there is a problem with the implementation but with the 720p regex including "bluray" keyword. Maybe we need to remove it from the regex? https://github.com/i96751414/script.flix.magneto/blob/1a84f074aa84de46b371c9ccaf5f35d0b23009de/lib/filters.py#L27

Other possibility (which I like better) would be to reverse iterate the list, so we try to match higher qualities first: https://github.com/i96751414/script.flix.magneto/blob/1a84f074aa84de46b371c9ccaf5f35d0b23009de/lib/filters.py#L18-L20

jonian commented 1 year ago

Yes, matching in reverse looks like a better idea. Will that cause any issues with the other filters?

My logic in this PR was to first match strictly and then try more loose matches if no match was found.

i96751414 commented 1 year ago

I don't think that would break other filters - probably it would improve them as well.

The important bit here is to make sure the higher the quality, the higher the factor/index is associated with such result (hence the importance of the order). We can reverse this like for i, v in reversed(list(enumerate(cls.values, 1))):