Help with the sintax of a Templeate

HI all,
So i have a kodi recently added sensor that gives a lot of ingo in an attribute called " data: "
I just need the poster part of every movie it shows, and in the template testing from the developer tools i get to work and get the part i need:

Poster
{{ state_attr('sensor.kodi_recently_added_movies', 'data').split('{')[9].split('poster": "')[1].split('"},')[0]}} 
Name
{{ state_attr('sensor.kodi_recently_added_movies', 'data').split('{')[9].split('"title": "')[1].split('",')[0]}} 
Fanart
{{ state_attr('sensor.kodi_recently_added_movies', 'data').split('{')[9].split('poster": "')[1].split('"},')[0]}} 

getting the results:

Poster
http://kodi:[email protected]:8080/image/image%3A%2F%2Fsmb%3A%2F%2F192.168.178.254%2FArchive%2FCinema%2FMovies4k%2FPrancer%2C%20A%20Christmas%20Tale%20%282022%29%20%5BUnknown%5D%20%5BPG%5D%20%5Bvoted%205.3%5D%20%5BFamily-Fantasy%5D%2Fposter.jpg

Name
Prancer: A Christmas Tale

Fanart
http://kodi:[email protected]:8080/image/image%3A%2F%2Fsmb%3A%2F%2F192.168.178.254%2FArchive%2FCinema%2FMovies4k%2FPrancer%2C%20A%20Christmas%20Tale%20%282022%29%20%5BUnknown%5D%20%5BPG%5D%20%5Bvoted%205.3%5D%20%5BFamily-Fantasy%5D%2Fposter.jpg

but when I copy it over and create the sensor, I get an error:

##Movie 1
  - platform: template
    sensors:
      kodi_recently_movies_1:
        friendly_name: "Kodi Movie 1 Poster"
        icon_template: mdi:movie-roll
        value_template:  ->
          {{ state_attr('sensor.kodi_recently_added_movies', 'data').split('{')[9].split('poster": "')[1].split('"},')[0]}}

Error:
bad indentation of a mapping entry (721:98)

718 | …
719 | …
720 | …
721 | … ).split(’{’)[9].split(β€˜poster": "’)[1].split(’"},’)[0]}}
------------------------------------------^
722 | …

Dot get it why, could anyone explain it?

Thanks!

>- or just >

1 Like

Exactly that, Thnaks!