Skip to content

enhanced mapping

euzu edited this page Apr 1, 2024 · 1 revision

Extended mapping features

Problem: We have a bunch of groups which contain video files with the suffix (<year>) like My little Ponny (1999). We want to group them based on the year.

Our Playlist contains a lot of groups like:

  • EN | Movies
  • EN | Drama
  • EN | Crime
  • EN | SciFi

This groups contain a list of entries which has the year ending described as above.

We want to get rid of this groups and have our new groups names 'EN | Movies ()`. This could cause a lot of groups, so we decide to group everything below 2020 into one group. The result should look like:

  • EN | Movies < 2020
  • EN | Movies [2020]
  • EN | Movies [2021]
  • EN | Movies [2022]
  • EN | Movies [2023]
  • EN | Movies [2024]

First we define our mapping templates

mappings:
  templates:
    - name: en_movies
      value: Group ~ "^EN.*(Movies|Drama|Crime|SciFi).*"
    - name: en_movies_before_2020
      value: Title ~ ".*\(?(?P<year>(19\d{2}|20[01]\d))\)?$"
    - name: en_movies_after_2020
      value: Title ~ ".*\(?(?P<year>202\d)\)?$"
  tags:
    - name: year
      captures:
        - year
      concat: '|'
      prefix: ' [ '
      suffix: ' ]'
  mapping:
    - id: extended-mapping
      mapper:
        - filter: "!en_movies!"
          pattern: "!en_movies_after_2020!"
          attributes:
            group: EN | MOVIES
          suffix:
            group: '<tag:year>'
        - filter: '!en_movies!'
          pattern: '!en_movies_before_2020!'
          attributes:
            group: EN | MOVIES < 2020
Clone this wiki locally