Skip to content

Templates

Collin Heist edited this page Apr 25, 2022 · 16 revisions

Background

The idea of templates is borrowed from Plex Meta Manager, and is designed to define a common structure of YAML that can be easily repeated across multiple series. Any number of templates can be specified within a series YAML file, templates are not shared across files, and currently optional data is not supported.

Example

The following two examples are identical, and are designed to showcase the benefits of using templates when "repeating" a lot of structure.

This first example showcases a "typical" structure of a series YAML file without templating.

libraries:
  Anime: 
    path: ./Media/Anime/
    card_type: anime

series:
  Cowboy Bebop:
    year: 1998
    library: Anime
    translation:
      language: ja
      key: kanji
    seasons:
      hide: true

  Demon Slayer - Kimetsu no Yaiba:
    year: 2019
    library: Anime
    translation:
      language: ja
      key: kanji

  Fullmetal Alchemist - Brotherhood:
    year: 2009
    library: Anime
    translation:
      language: ja
      key: kanji
    seasons:
      hide: true

There is clearly a lot of "repeat" information, indicating that templates are a great way to speed up this process. The exact same specification can be achieved with:

libraries:
  Anime: 
    path: ./Media/Anime/
    card_type: anime

templates:
  anime_with_kanji:
    year: <<year>>
    library: Anime
    translation:
      language: ja
      key: kanji
    seasons:
      hide: <<seasonless>>

series:
  Cowboy Bebop:
    template: {name: anime_with_kanji, year: 1998, seasonless: true}

  Demon Slayer - Kimetsu no Yaiba:
    template: {name: anime_with_kanji, year: 2019, seasonless: false}

  Fullmetal Alchemist - Brotherhood:
    template: {name: anime_with_kanji, year: 2009, seasonless: true}
Clone this wiki locally