Repository: Flexget/Flexget

Issue:
Quality plugin <hdr not working
<!---
Before opening an issue, verify:

- Is this an issue with webui? Make an issue over on https://github.com/Flexget/webui
- Did you recently upgrade? Look at the Change Log and Upgrade Actions to make sure that you don't need to make any changes to your config https://flexget.com/ChangeLog https://flexget.com/UpgradeActions
- Are you running FlexGet as a daemon? Stop it completely and then start it again https://flexget.com/CLI/daemon
- Did you search to see if the issue already exists? https://github.com/Flexget/Flexget/issues
- Did you fill out the issue template as completely as possible?

The issue template is here because it helps to ensure you submitted all the necessary information the first time, and allows us to more quickly review issues. Please fill it out correctly and do not ignore it, no matter how irrelevant you think it may be. Thanks in advance for your help with this!
--->

### Expected behaviour:
"<hdr" should work similar as "<2160p"
<!---
--->

### Actual behaviour:
"<hdr" does nothing, as a workaround <=10bit seems to work

### Steps to reproduce:
- Step 1: ...

#### Config:
```yaml
  cache-low-quality-movies:
    priority: 10
    template:
      - disable-seen-retry
    list_clear:
      what:
        - movie_list: low-quality-movies
    entry_list: filesystem-movies
    quality:
      - <2160p
      - <hdr
    accept_all: yes
    list_add:
      - movie_list: low-quality-movies

```
  
#### Log:
<details>
 <summary>(click to expand)</summary>

```
2024-03-15 11:38:45 VERBOSE  task          cache-low-quality-movies REJECTED: `AAAAAAAAAA.2160p.ATVP.WEB-DL.DDP5.1.Atmos.DV.HEVC-CMRG` by quality plugin because `2160p webdl h265 dolbyvision dd+5.1` does not match any of quality requirements: `<2160p`, `<hdr`
2024-03-15 11:38:45 VERBOSE  task          cache-low-quality-movies REJECTED: `BBBBBBBBBBB.2023.2160p.WEB-DL.DDP5.1.Atmos.DV.HDR.H.265-FLUX` by quality plugin because `2160p webdl h265 dolbyvision dd+5.1` does not match any of quality requirements: `<2160p`, `<hdr`
2024-03-15 11:38:45 VERBOSE  task          cache-low-quality-movies ACCEPTED: `CCCCCCCCCCC.2160p.DSNP.WEB-DL.DDP5.1.HDR.x265-NoGrp` by accept_all plugin
2024-03-15 11:38:45 VERBOSE  task          cache-low-quality-movies ACCEPTED: `DDDDDDDDDDD.2023.2160p.HDR.NF.WEB-DL.ENG.ITA.HINDI.Multi.Sub.DDP5.1.Atmos.x265.MKV-BEN.THE.MEN` by accept_all plugin

```
</details>

### Additional information:

- FlexGet version: 3.11.23
- Python version: 2.10.12
- Installation method: pip
- Using daemon (yes/no): no
- OS and version: Ubuntu

<!---
In config and debug/crash logs, remember to redact any personal or sensitive information such as passwords, API keys, private URLs and so on.

Please verify that the following data is present before submitting your issue:

- Link to a paste service or paste above the relevant config (preferably full config, including templates if present). Please make sure the paste does not expire, if possible.
- Link to a paste service or paste above debug-level logs of the relevant task/s (use `flexget -L debug execute --tasks <Task_name>`).
- FlexGet version (use `flexget -V` to get it).
- Full Python version, for example `2.7.11` (use `python -V` to get it). 
- Installation method (pip, git install, etc).
- Whether or not you're running FlexGet as a daemon.
- OS and version.
- Attach crash log if one was generated, in addition to the debug-level log. It can be found in the directory with your config file.
--->



Discussion:
HDR can be either 10-bit or 12-bit, use `!hdr` instead
> HDR can be either 10-bit or 12-bit, use `!hdr` instead

quality plugin should be able to get lower qualities using < , your sugestion doesn't work at all, 

2024-03-15 12:14:29 CRITICAL manager                       could not determine a constructor for the tag '!hdr' in "<unicode string>", line 247, column 9: - !hdr ^

I apologize, misremembered my config 🙇 
I have `<hdr` on a task and at some point it was `!10bit` (I commented it out)
> I apologize, misremembered my config 🙇 I have `<hdr` on a task and at some point it was `!10bit` (I commented it out)

By the way, acording to the documentaion, your suggestion should also work, that's probably another related bug.
Just for clarification, list requirements in `quality` are evaluated separately.
A 1080p HDR release would not be rejected because it fits the `<2160p` requirement, same for a 4k 8-bit entry matching the `<HDR` requirement
If the entry should be neither 4k nor HDR it must be a single line requirement `quality: <2160p <hdr`
> Just for clarification, list requirements in `quality` are evaluated separately. A 1080p HDR release would not be rejected because it fits the `<2160p` requirement, same for a 4k 8-bit entry matching the `<HDR` requirement If the entry should be neither 4k nor HDR it must be a single line requirement `quality: <2160p <hdr`

The task is supposed to accept all low quality items of library (<2160p or <hdr), it's working as intended with the <=10bit workaround instead of <hdr .

Resolving patch:
diff --git a/flexget/utils/qualities.py b/flexget/utils/qualities.py
--- a/flexget/utils/qualities.py
+++ b/flexget/utils/qualities.py
@@ -164,8 +164,8 @@ def __deepcopy__(self, memo=None):
 _color_ranges = [
     QualityComponent('color_range', 10, '8bit', r'8[^\w]?bits?|hi8p?'),
     QualityComponent('color_range', 20, '10bit', r'10[^\w]?bits?|hi10p?'),
-    QualityComponent('color_range', 40, 'hdrplus', r'hdr(10)?[^\w]?(\+|p|plus)'),
     QualityComponent('color_range', 30, 'hdr', r'hdr([^\w]?10)?'),
+    QualityComponent('color_range', 40, 'hdrplus', r'hdr(10)?[^\w]?(\+|p|plus)'),
     QualityComponent('color_range', 50, 'dolbyvision', r'(dolby[^\w]?vision|dv|dovi)'),
 ]
 


Test patch: