iantrich / list-card

📰 Display sensor list data in a table
Apache License 2.0
123 stars 34 forks source link

Change the if/else for regex,prefix,postfix to an if statement #13

Closed dennyreiter closed 5 years ago

dennyreiter commented 5 years ago

Change the if/else for regex,prefix,postfix to an if statement so they may all be used.

I am pulling down the list of new blu-ray releases from https://www.blu-ray.com/rss/newreleasesfeed.xml which does not include an image url, so I needed to isolate the movie ID, then do a prefix and postfix to build an img tag to have it shown:

Blue Ray Movie Releases

  - type: custom:list-card
    entity: sensor.blu_ray_releases
    title: Blu-Ray Releases
    columns:
      - title: ''
        field: link
        regex: \d+(?=\/)
        prefix: '<img src="https://images3.static-bluray.com/movies/covers/'
        postfix: '_small.jpg" />'
      - title: Title
        field: title
        add_link: link
        style:
          - white-space: nowrap

image

iantrich commented 5 years ago

Thanks