#########################################################################################
#                                          Resolution Overlay                           #
#                                         Created by Pete2583                           #
#                              Credit to bradmarrti for the base images                 #
#                 Credit also goes to meinstate/pmm for some of the base templating     #
#                          Credit also to ICHIMOKU who gave me the inspiration          #             
#########################################################################################
#                                                                                       #
#  Call this from your config.yml (Movie):                                              #
#                                                                                       #
#    overlay_path:                                                                      #
#      - git: pete2583/resolution-lite                                                  #
#                                                                                       #
#########################################################################################

templates:
  Resolution:
    default:
      overlay: <<overlay_name>>
      horizontal_offset: 0
      horizontal_align: left
      vertical_offset: 0
      vertical_align: top
    ignore_blank_results: true
    suppress_overlays:
      - Directors-Cut
      - Extended-Edition
      - Uncut-Edition
      - Unrated-Edition
      - Special-Edition
      - Final-Cut
      - Anniversary-Edition
      - Collectors-Edition
      - International-Cut
      - Theatrical-Cut
      - Ultimate-Cut
      - Remastered
      - Criterion
    overlay:
      name: <<overlay_name>>
      git: pete2583/overlays/<<overlay>>
      group: res
      weight: <<weight>>
      horizontal_offset: <<horizontal_offset>>
      horizontal_align: <<horizontal_align>>
      vertical_offset: <<vertical_offset>>
      vertical_align: <<vertical_align>>

overlays:

  480P:
    template:
      - name: Resolution
        weight: 41
    plex_search:
      all:
        resolution.regex: '(?!)480p|SD'
        hdr: false
     
  480P-HDR:
    template:
      - name: Resolution
        weight: 42
    plex_search:
      all:
        resolution: 480p
        hdr: true
        
  480P-DV:
    template:
      - name: Resolution
        weight: 43
    plex_search:
      all:
        resolution: 480p
    filters:
      has_dolby_vision: true

  576P:
    template:
      - name: Resolution
        weight: 51
    plex_search:
      all:
        resolution: 576p
        hdr: false
     
  576P-HDR:
    template:
      - name: Resolution
        weight: 52
    plex_search:
      all:
        resolution: 576p
        hdr: true
        
  576P-DV:
    template:
      - name: Resolution
        weight: 53
    plex_search:
      all:
        resolution: 576p
    filters:
      has_dolby_vision: true

  720P:
    template:
      - name: Resolution
        weight: 71
    plex_search:
      all:
        resolution: 720p
        hdr: false
     
  720P-HDR:
    template:
      - name: Resolution
        weight: 72
    plex_search:
      all:
        resolution: 720p
        hdr: true
        
  720P-DV:
    template:
      - name: Resolution
        weight: 73
    plex_search:
      all:
        resolution: 720p
    filters:
      has_dolby_vision: true

  1080p:
    template:
      - name: Resolution
        weight: 101
    plex_search:
      all:
        resolution: 1080p
        hdr: false
    filters:
      filepath.not:
      - AC3
      - EAC3
      - TrueHD
      - Atmos
      - DTS-X
      - DTS-HD

  1080p-HDR:
    template:
      - name: Resolution
        weight: 102
    plex_search:
      all:
        resolution: 1080p
        hdr: true
    filters:
      filepath.not:
      - AC3
      - EAC3
      - TrueHD
      - Atmos
      - DTS-X
      - DTS-HD
    
  1080p-IMAX:
    template:
      - name: Resolution
        weight: 103
    plex_search:
      all:
        resolution: 1080p
    filters:
      filepath: Imax
    
  1080p-HDR-IMAX:
    template:
      - name: Resolution
        weight: 104
    plex_search:
      all:
        resolution: 1080p
        hdr: true
    filters:
      filepath: Imax
    
  DV:
    template:
      - name: Resolution
        weight: 501
    plex_search:
      all:
        resolution: 4K
    filters:
      has_dolby_vision: true
      filepath.not:
      - AC3
      - EAC3
      - TrueHD
      - Atmos
      - DTS-X
      - DTS-HD

  4K:
    template:
      - name: Resolution
        weight: 401
    plex_search:
      all:
        resolution: 4K
        hdr: false
    filters:
      has_dolby_vision: false
      filepath.not:
      - AC3
      - EAC3
      - TrueHD
      - Atmos
      - DTS-X
      - DTS-HD
    
  4K-HDR:
    template:
      - name: Resolution
        weight: 402
    plex_search:
      all:
        resolution: 4K
        hdr: true
    filters:
      has_dolby_vision: false
      filepath.not:
      - AC3
      - EAC3
      - TrueHD
      - Atmos
      - DTS-X
      - DTS-HD
    
  4K-IMAX:
    template:
      - name: Resolution
        weight: 403
    plex_search:
      all:
        resolution: 4K
    filters:
      has_dolby_vision: false
      filepath: Imax
    
  4K-HDR-IMAX:
    template:
      - name: Resolution
        weight: 404
    plex_search:
      all:
        resolution: 4K
        hdr: true
    filters:
      has_dolby_vision: false
      filepath: Imax
