##############################################################################
#                               Status Overlay                               #
#                 Created by Yozora, Bullmoose20, & Sohjiro                  #
#          EDITING THIS FILE MAY CAUSE PULLING NEW UPDATES TO FAIL           #
#      https://metamanager.wiki/en/latest/defaults/overlays/status.html      #
##############################################################################

external_templates:
  pmm: templates
  template_variables:
    text_<<key>>: <<text>>
    group: status
    default:
      horizontal_align: left
      vertical_align: top
    conditionals:
      vertical_offset:
        default: 15
        conditions:
          - vertical_align.exists: false
            value: 330
          - vertical_align: center
            value: 0
          - vertical_align: top
            value: 15
          - vertical_align: bottom
            value: 30
      horizontal_offset:
        default: 15
        conditions:
          - horizontal_align: center
            value: 0
          - horizontal_align: [left, right]
            value: 15
    font_size: 50
    back_color: "#00000099"
    back_width: 305
    back_height: 105
    allowed_libraries: show
    final_name: text(<<text_<<key>>>>)

templates:
  status:
    optional:
      - last
    conditionals:
      all:
        conditions:
          - key: [ended, returning, canceled]
            value: true
      tmdb:
        conditions:
          - key: [ended, returning, canceled]
            value: <<key>>
      last_days:
        conditions:
          - key: airing
            last.exists: true
            value: <<last>>
    ignore_blank_results: true
    plex_search:
      any:
        episode_air_date: <<last_days>>
    plex_all: <<all>>
    filters:
      tmdb_status: <<tmdb>>

overlays:

  airing_shows:
    variables: {key: airing, weight: 40, text: AIRING, last: 14}
    template: [name: standard, name: status]

  returning_shows:
    variables: {key: returning, weight: 30, text: RETURNING}
    template: [name: standard, name: status]

  canceled_shows:
    variables: {key: canceled, weight: 20, text: CANCELED}
    template: [name: standard, name: status]

  ended_shows:
    variables: {key: ended, weight: 10, text: ENDED}
    template: [name: standard, name: status]