custom-components / sensor.sonarr_upcoming_media

📺 Sonarr component to feed Upcoming Media Card.
Apache License 2.0
54 stars 44 forks source link

Fails to parse a particular episode #14

Closed hjbotha closed 4 years ago

hjbotha commented 4 years ago

Describe the Bug The component fails to parse the JSON data for a particular episode (His Dark Materials S1E08 in the data below) returned by Sonarr. I'm trying this component for the first time so I don't know how much of an outlier this is.

The Error No errors logged.

Indicate if you followed all steps in the troubleshooting doc Well, did you? Yup

What data does the sensor display if any?

data: [{"title_default": "$title", "line1_default": "$episode", "line2_default": "$release", "line3_default": "$rating - $runtime", "line4_default": "$number - $studio", "icon": "mdi:arrow-down-bold"}, {"airdate": "2020-01-01T18:45:00Z", "release": "$day, $date $time", "flag": false, "title": "Doctor Who (2005)", "episode": "Spyfall (1)", "number": "S12E01", "runtime": 50, "studio": "BBC One", "rating": "\u2605 9.4", "genres": "Adventure, Drama, Science Fiction", "poster": "https://artworks.thetvdb.com/banners/posters/78804-52_t.jpg", "fanart": "https://artworks.thetvdb.com/banners/fanart/original/78804-100_t.jpg"}, {"airdate": "2020-01-05T18:45:00Z", "release": "$day, $date $time", "flag": false, "title": "Doctor Who (2005)", "episode": "Spyfall (2)", "number": "S12E02", "runtime": 50, "studio": "BBC One", "rating": "\u2605 9.4", "genres": "Adventure, Drama, Science Fiction", "poster": "https://artworks.thetvdb.com/banners/posters/78804-52_t.jpg", "fanart": "https://artworks.thetvdb.com/banners/fanart/original/78804-100_t.jpg"}]
friendly_name: Sonarr_Upcoming_Media

What displays when visiting the API URL from the troubleshooting guide?

  {
    "seriesId": 14,
    "episodeFileId": 0,
    "seasonNumber": 1,
    "episodeNumber": 8,
    "title": "Betrayal",
    "airDate": "2019-12-22",
    "airDateUtc": "2019-12-22T20:00:00Z",
    "overview": "As the Magisterium closes in, Lyra learns more about Asriel’s rebellion. But her assistance to him comes at great personal cost.",
    "hasFile": false,
    "monitored": true,
    "absoluteEpisodeNumber": 8,
    "unverifiedSceneNumbering": false,
    "series": {
      "title": "His Dark Materials",
      "sortTitle": "his dark materials",
      "seasonCount": 1,
      "status": "continuing",
      "overview": "In an alternative world where all humans have animal companions called dæmons, which are the manifestation of the human soul, a young orphan living with the tutors at Jordan College, Oxford discovers a dangerous secret that involves Lord Asriel and Marisa Coulter. In her search for her missing friend, she uncovers a slew of kidnappings and its link to the mysterious substance called Dust.",
      "network": "BBC One",
      "airTime": "20:00",
      "images": [
        {
          "coverType": "banner",
          "url": "https://artworks.thetvdb.com/banners/graphical/5d51be154dfcf.jpg"
        },
        {
          "coverType": "poster",
          "url": "https://artworks.thetvdb.com/banners/posters/5dc14be37c2b5.jpg"
        }
      ],
      "seasons": [
        {
          "seasonNumber": 1,
          "monitored": true
        }
      ],
      "year": 2019,
      "path": "/media/Series/His Dark Materials",
      "profileId": 3,
      "seasonFolder": true,
      "monitored": true,
      "useSceneNumbering": false,
      "runtime": 55,
      "tvdbId": 360295,
      "tvRageId": 0,
      "tvMazeId": 7626,
      "firstAired": "2019-11-03T00:00:00Z",
      "lastInfoSync": "2019-12-17T08:06:41.420929Z",
      "seriesType": "standard",
      "cleanTitle": "hisdarkmaterials",
      "imdbId": "tt5607976",
      "titleSlug": "his-dark-materials",
      "certification": "TV-PG",
      "genres": [
        "Action",
        "Adventure",
        "Fantasy"
      ],
      "tags": [],
      "added": "2019-11-24T19:05:50.835476Z",
      "ratings": {
        "votes": 0,
        "value": 0.0
      },
      "qualityProfileId": 3,
      "id": 14
    },
    "id": 1059
  },
  {
    "seriesId": 9,
    "episodeFileId": 0,
    "seasonNumber": 12,
    "episodeNumber": 1,
    "title": "Spyfall (1)",
    "airDate": "2020-01-01",
    "airDateUtc": "2020-01-01T18:45:00Z",
    "hasFile": false,
    "monitored": true,
    "absoluteEpisodeNumber": 156,
    "unverifiedSceneNumbering": false,
    "series": {
      "title": "Doctor Who (2005)",
      "sortTitle": "doctor who 2005",
      "seasonCount": 12,
      "status": "continuing",
      "overview": "The Doctor is an alien Time Lord from the planet Gallifrey who travels through all of time and space in the TARDIS. The Doctor has a long list of friends and companions who have shared journeys along the way. Instead of dying, the Doctor is able to “regenerate” into a new body, taking on a new personality with each regeneration.",
      "network": "BBC One",
      "airTime": "18:45",
      "images": [
        {
          "coverType": "fanart",
          "url": "https://artworks.thetvdb.com/banners/fanart/original/78804-100.jpg"
        },
        {
          "coverType": "banner",
          "url": "https://artworks.thetvdb.com/banners/graphical/78804-g29.jpg"
        },
        {
          "coverType": "poster",
          "url": "https://artworks.thetvdb.com/banners/posters/78804-52.jpg"
        }
      ],
      "seasons": [
        {
          "seasonNumber": 0,
          "monitored": false
        },
        {
          "seasonNumber": 1,
          "monitored": false
        },
        {
          "seasonNumber": 2,
          "monitored": false
        },
        {
          "seasonNumber": 3,
          "monitored": false
        },
        {
          "seasonNumber": 4,
          "monitored": false
        },
        {
          "seasonNumber": 5,
          "monitored": false
        },
        {
          "seasonNumber": 6,
          "monitored": false
        },
        {
          "seasonNumber": 7,
          "monitored": false
        },
        {
          "seasonNumber": 8,
          "monitored": false
        },
        {
          "seasonNumber": 9,
          "monitored": false
        },
        {
          "seasonNumber": 10,
          "monitored": false
        },
        {
          "seasonNumber": 11,
          "monitored": false
        },
        {
          "seasonNumber": 12,
          "monitored": true
        }
      ],
      "year": 2005,
      "path": "/media/Series/Doctor Who (2005)",
      "profileId": 3,
      "seasonFolder": true,
      "monitored": true,
      "useSceneNumbering": false,
      "runtime": 50,
      "tvdbId": 78804,
      "tvRageId": 3332,
      "tvMazeId": 210,
      "firstAired": "2005-03-26T00:00:00Z",
      "lastInfoSync": "2019-12-17T08:05:55.651701Z",
      "seriesType": "standard",
      "cleanTitle": "doctorwho2005",
      "imdbId": "tt0436992",
      "titleSlug": "doctor-who-2005",
      "certification": "TV-PG",
      "genres": [
        "Adventure",
        "Drama",
        "Science Fiction"
      ],
      "tags": [],
      "added": "2019-11-24T19:03:55.532917Z",
      "ratings": {
        "votes": 24296,
        "value": 9.4
      },
      "qualityProfileId": 3,
      "id": 9
    },
    "id": 910
  },
  {
    "seriesId": 9,
    "episodeFileId": 0,
    "seasonNumber": 12,
    "episodeNumber": 2,
    "title": "Spyfall (2)",
    "airDate": "2020-01-05",
    "airDateUtc": "2020-01-05T18:45:00Z",
    "hasFile": false,
    "monitored": true,
    "absoluteEpisodeNumber": 157,
    "unverifiedSceneNumbering": false,
    "series": {
      "title": "Doctor Who (2005)",
      "sortTitle": "doctor who 2005",
      "seasonCount": 12,
      "status": "continuing",
      "overview": "The Doctor is an alien Time Lord from the planet Gallifrey who travels through all of time and space in the TARDIS. The Doctor has a long list of friends and companions who have shared journeys along the way. Instead of dying, the Doctor is able to “regenerate” into a new body, taking on a new personality with each regeneration.",
      "network": "BBC One",
      "airTime": "18:45",
      "images": [
        {
          "coverType": "fanart",
          "url": "https://artworks.thetvdb.com/banners/fanart/original/78804-100.jpg"
        },
        {
          "coverType": "banner",
          "url": "https://artworks.thetvdb.com/banners/graphical/78804-g29.jpg"
        },
        {
          "coverType": "poster",
          "url": "https://artworks.thetvdb.com/banners/posters/78804-52.jpg"
        }
      ],
      "seasons": [
        {
          "seasonNumber": 0,
          "monitored": false
        },
        {
          "seasonNumber": 1,
          "monitored": false
        },
        {
          "seasonNumber": 2,
          "monitored": false
        },
        {
          "seasonNumber": 3,
          "monitored": false
        },
        {
          "seasonNumber": 4,
          "monitored": false
        },
        {
          "seasonNumber": 5,
          "monitored": false
        },
        {
          "seasonNumber": 6,
          "monitored": false
        },
        {
          "seasonNumber": 7,
          "monitored": false
        },
        {
          "seasonNumber": 8,
          "monitored": false
        },
        {
          "seasonNumber": 9,
          "monitored": false
        },
        {
          "seasonNumber": 10,
          "monitored": false
        },
        {
          "seasonNumber": 11,
          "monitored": false
        },
        {
          "seasonNumber": 12,
          "monitored": true
        }
      ],
      "year": 2005,
      "path": "/media/Series/Doctor Who (2005)",
      "profileId": 3,
      "seasonFolder": true,
      "monitored": true,
      "useSceneNumbering": false,
      "runtime": 50,
      "tvdbId": 78804,
      "tvRageId": 3332,
      "tvMazeId": 210,
      "firstAired": "2005-03-26T00:00:00Z",
      "lastInfoSync": "2019-12-17T08:05:55.651701Z",
      "seriesType": "standard",
      "cleanTitle": "doctorwho2005",
      "imdbId": "tt0436992",
      "titleSlug": "doctor-who-2005",
      "certification": "TV-PG",
      "genres": [
        "Adventure",
        "Drama",
        "Science Fiction"
      ],
      "tags": [],
      "added": "2019-11-24T19:03:55.532917Z",
      "ratings": {
        "votes": 24296,
        "value": 9.4
      },
      "qualityProfileId": 3,
      "id": 9
    },
    "id": 911
  }
]

Does the default Home Assistant Sonarr component work for you? Yes. sensor.sonarr_disk_space data below.

/config: 603.24/1784.07GB (33.81%)
/media: 603.24/1784.07GB (33.81%)
unit_of_measurement: GB
friendly_name: Sonarr Disk Space
icon: mdi:harddisk

Home Assistant Version What version of HA are you running? 0.103.0

Additional Context I did a packet capture so I can confirm Sonarr is sending back data on the particular episode. Output below.

Host: redacted:8989
User-Agent: python-requests/2.22.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
X-Api-Key: <redacted>

HTTP/1.1 200 OK
X-ApplicationVersion: 2.0.0.5338
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: 0
Access-Control-Allow-Origin: *
Content-Encoding: gzip
Content-Type: application/json; charset=utf-8
Server: Mono-HTTPAPI/1.0
Date: Tue, 17 Dec 2019 19:28:24 GMT
Transfer-Encoding: chunked
Keep-Alive: timeout=15,max=100

[
  {
    "seriesId": 14,
    "episodeFileId": 0,
    "seasonNumber": 1,
    "episodeNumber": 8,
    "title": "Betrayal",
    "airDate": "2019-12-22",
    "airDateUtc": "2019-12-22T20:00:00Z",
    "overview": "As the Magisterium closes in, Lyra learns more about Asriel...s rebellion. But her assistance to him comes at great personal cost.",
    "hasFile": false,
    "monitored": true,
    "absoluteEpisodeNumber": 8,
    "unverifiedSceneNumbering": false,
    "series": {
      "title": "His Dark Materials",
      "sortTitle": "his dark materials",
      "seasonCount": 1,
      "status": "continuing",
      "overview": "In an alternative world where all humans have animal companions called d..mons, which are the manifestation of the human soul, a young orphan living with the tutors at Jordan College, Oxford discovers a dangerous secret that involves Lord Asriel and Marisa Coulter. In her search for her missing friend, she uncovers a slew of kidnappings and its link to the mysterious substance called Dust.",
      "network": "BBC One",
      "airTime": "20:00",
      "images": [
        {
          "coverType": "banner",
          "url": "https://artworks.thetvdb.com/banners/graphical/5d51be154dfcf.jpg"
        },
        {
          "coverType": "poster",
          "url": "https://artworks.thetvdb.com/banners/posters/5dc14be37c2b5.jpg"
        }
      ],
      "seasons": [
        {
          "seasonNumber": 1,
          "monitored": true
        }
      ],
      "year": 2019,
      "path": "/media/Series/His Dark Materials",
      "profileId": 3,
      "seasonFolder": true,
      "monitored": true,
      "useSceneNumbering": false,
      "runtime": 55,
      "tvdbId": 360295,
      "tvRageId": 0,
      "tvMazeId": 7626,
      "firstAired": "2019-11-03T00:00:00Z",
      "lastInfoSync": "2019-12-17T08:06:41.420929Z",
      "seriesType": "standard",
      "cleanTitle": "hisdarkmaterials",
      "imdbId": "tt5607976",
      "titleSlug": "his-dark-materials",
      "certification": "TV-PG",
      "genres": [
        "Action",
        "Adventure",
        "Fantasy"
      ],
      "tags": [],
      "added": "2019-11-24T19:05:50.835476Z",
      "ratings": {
        "votes": 0,
        "value": 0.0
      },
      "qualityProfileId": 3,
      "id": 14
    },
    "id": 1059
  },
  {
    "seriesId": 9,
    "episodeFileId": 0,
    "seasonNumber": 12,
    "episodeNumber": 1,
    "title": "Spyfall (1)",
    "airDate": "2020-01-01",
    "airDateUtc": "2020-01-01T18:45:00Z",
    "hasFile": false,
    "monitored": true,
    "absoluteEpisodeNumber": 156,
    "unverifiedSceneNumbering": false,
    "series": {
      "title": "Doctor Who (2005)",
      "sortTitle": "doctor who 2005",
      "seasonCount": 12,
      "status": "continuing",
      "overview": "The Doctor is an alien Time Lord from the planet Gallifrey who travels through all of time and space in the TARDIS. The Doctor has a long list of friends and companions who have shared journeys along the way. Instead of dying, the Doctor is able to ...regenerate... into a new body, taking on a new personality with each regeneration.",
      "network": "BBC One",
      "airTime": "18:45",
      "images": [
        {
          "coverType": "fanart",
          "url": "https://artworks.thetvdb.com/banners/fanart/original/78804-100.jpg"
        },
        {
          "coverType": "banner",
          "url": "https://artworks.thetvdb.com/banners/graphical/78804-g29.jpg"
        },
        {
          "coverType": "poster",
          "url": "https://artworks.thetvdb.com/banners/posters/78804-52.jpg"
        }
      ],
      "seasons": [
        {
          "seasonNumber": 0,
          "monitored": false
        },
        {
          "seasonNumber": 1,
          "monitored": false
        },
        {
          "seasonNumber": 2,
          "monitored": false
        },
        {
          "seasonNumber": 3,
          "monitored": false
        },
        {
          "seasonNumber": 4,
          "monitored": false
        },
        {
          "seasonNumber": 5,
          "monitored": false
        },
        {
          "seasonNumber": 6,
          "monitored": false
        },
        {
          "seasonNumber": 7,
          "monitored": false
        },
        {
          "seasonNumber": 8,
          "monitored": false
        },
        {
          "seasonNumber": 9,
          "monitored": false
        },
        {
          "seasonNumber": 10,
          "monitored": false
        },
        {
          "seasonNumber": 11,
          "monitored": false
        },
        {
          "seasonNumber": 12,
          "monitored": true
        }
      ],
      "year": 2005,
      "path": "/media/Series/Doctor Who (2005)",
      "profileId": 3,
      "seasonFolder": true,
      "monitored": true,
      "useSceneNumbering": false,
      "runtime": 50,
      "tvdbId": 78804,
      "tvRageId": 3332,
      "tvMazeId": 210,
      "firstAired": "2005-03-26T00:00:00Z",
      "lastInfoSync": "2019-12-17T08:05:55.651701Z",
      "seriesType": "standard",
      "cleanTitle": "doctorwho2005",
      "imdbId": "tt0436992",
      "titleSlug": "doctor-who-2005",
      "certification": "TV-PG",
      "genres": [
        "Adventure",
        "Drama",
        "Science Fiction"
      ],
      "tags": [],
      "added": "2019-11-24T19:03:55.532917Z",
      "ratings": {
        "votes": 24296,
        "value": 9.4
      },
      "qualityProfileId": 3,
      "id": 9
    },
    "id": 910
  },
  {
    "seriesId": 9,
    "episodeFileId": 0,
    "seasonNumber": 12,
    "episodeNumber": 2,
    "title": "Spyfall (2)",
    "airDate": "2020-01-05",
    "airDateUtc": "2020-01-05T18:45:00Z",
    "hasFile": false,
    "monitored": true,
    "absoluteEpisodeNumber": 157,
    "unverifiedSceneNumbering": false,
    "series": {
      "title": "Doctor Who (2005)",
      "sortTitle": "doctor who 2005",
      "seasonCount": 12,
      "status": "continuing",
      "overview": "The Doctor is an alien Time Lord from the planet Gallifrey who travels through all of time and space in the TARDIS. The Doctor has a long list of friends and companions who have shared journeys along the way. Instead of dying, the Doctor is able to ...regenerate... into a new body, taking on a new personality with each regeneration.",
      "network": "BBC One",
      "airTime": "18:45",
      "images": [
        {
          "coverType": "fanart",
          "url": "https://artworks.thetvdb.com/banners/fanart/original/78804-100.jpg"
        },
        {
          "coverType": "banner",
          "url": "https://artworks.thetvdb.com/banners/graphical/78804-g29.jpg"
        },
        {
          "coverType": "poster",
          "url": "https://artworks.thetvdb.com/banners/posters/78804-52.jpg"
        }
      ],
      "seasons": [
        {
          "seasonNumber": 0,
          "monitored": false
        },
        {
          "seasonNumber": 1,
          "monitored": false
        },
        {
          "seasonNumber": 2,
          "monitored": false
        },
        {
          "seasonNumber": 3,
          "monitored": false
        },
        {
          "seasonNumber": 4,
          "monitored": false
        },
        {
          "seasonNumber": 5,
          "monitored": false
        },
        {
          "seasonNumber": 6,
          "monitored": false
        },
        {
          "seasonNumber": 7,
          "monitored": false
        },
        {
          "seasonNumber": 8,
          "monitored": false
        },
        {
          "seasonNumber": 9,
          "monitored": false
        },
        {
          "seasonNumber": 10,
          "monitored": false
        },
        {
          "seasonNumber": 11,
          "monitored": false
        },
        {
          "seasonNumber": 12,
          "monitored": true
        }
      ],
      "year": 2005,
      "path": "/media/Series/Doctor Who (2005)",
      "profileId": 3,
      "seasonFolder": true,
      "monitored": true,
      "useSceneNumbering": false,
      "runtime": 50,
      "tvdbId": 78804,
      "tvRageId": 3332,
      "tvMazeId": 210,
      "firstAired": "2005-03-26T00:00:00Z",
      "lastInfoSync": "2019-12-17T08:05:55.651701Z",
      "seriesType": "standard",
      "cleanTitle": "doctorwho2005",
      "imdbId": "tt0436992",
      "titleSlug": "doctor-who-2005",
      "certification": "TV-PG",
      "genres": [
        "Adventure",
        "Drama",
        "Science Fiction"
      ],
      "tags": [],
      "added": "2019-11-24T19:03:55.532917Z",
      "ratings": {
        "votes": 24296,
        "value": 9.4
      },
      "qualityProfileId": 3,
      "id": 9
    },
    "id": 911
  }
]
hjbotha commented 4 years ago

Oof, forgot the version of sonarr_upcoming_media. 0.2.2.

maykar commented 4 years ago

I know that this episode has past by now, but I believe this issue should be fixed in the latest release.