custom-components / sensor.radarr_upcoming_media

🎬 Radarr component to feed Upcoming Media Card.
Apache License 2.0
59 stars 24 forks source link

Error when inCinemas isnt populated #14

Closed bacco007 closed 4 years ago

bacco007 commented 4 years ago

Describe the Bug When inCinemas isnt populated in the API, an error is returned

The Error

2020-07-18 16:56:07 ERROR (MainThread) [homeassistant.components.sensor] radarr_upcoming_media: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 319, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 466, in async_device_update
    self.update  # type: ignore
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/radarr_upcoming_media/sensor.py", line 187, in update
    if days_until(movie['inCinemas'], self._tz) > -1:
KeyError: 'inCinemas'

Indicate if you followed all steps in the troubleshooting doc Yes

What data does the sensor display if any? None

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

{
title: "Irresistible",
alternativeTitles: [
{
sourceType: "tmdb",
movieId: 324,
title: "Неотразимый",
sourceId: 0,
votes: 0,
voteCount: 0,
language: {
id: 11,
name: "Russian"
},
id: 2661
}
],
secondaryYearSourceId: 0,
sortTitle: "irresistible",
sizeOnDisk: 4222873587,
status: "released",
overview: "A Democratic political consultant helps a retired Marine colonel run for mayor in a small, conservative Wisconsin town.",
physicalRelease: "2020-09-14T00:00:00Z",
images: [
{
coverType: "poster",
url: "https://image.tmdb.org/t/p/original/izGiAbtC2lmGk3bbV5t3OowJhtP.jpg"
},
{
coverType: "fanart",
url: "https://image.tmdb.org/t/p/original/eZ8eK0moqUo6Vwq08OK1POfyUF5.jpg"
}
],
website: "https://www.focusfeatures.com/irresistible",
downloaded: true,
year: 2020,
hasFile: true,
youTubeTrailerId: "0vhaAoSm1NY",
studio: "Focus Features",
path: "/movies/Irresistible (2020)",
profileId: 1,
monitored: true,
minimumAvailability: "announced",
isAvailable: true,
folderName: "/movies/Irresistible (2020)",
runtime: 101,
lastInfoSync: "2020-07-14T17:10:40.1817231Z",
cleanTitle: "irresistible",
imdbId: "tt9076562",
tmdbId: 595148,
titleSlug: "595148",
certification: "R",
genres: [
"Comedy",
"Drama"
],
tags: [ ],
added: "2020-06-16T23:43:08.2354507Z",
ratings: {
votes: 46,
value: 6.6
},
movieFile: {
movieId: 0,
relativePath: "Irresistible (2020) WEBDL-1080p.mkv",
size: 4222873587,
dateAdded: "2020-06-26T09:18:55.9476703Z",
releaseGroup: "EVO",
quality: {
quality: {
id: 3,
name: "WEBDL-1080p",
source: "webdl",
resolution: 1080,
modifier: "none"
},
revision: {
version: 1,
real: 0,
isRepack: false
}
},
edition: "",
mediaInfo: {
containerFormat: "Matroska",
videoFormat: "AVC",
videoCodecID: "V_MPEG4/ISO/AVC",
videoProfile: "High@L4",
videoCodecLibrary: "",
videoBitrate: 5133577,
videoBitDepth: 8,
videoMultiViewCount: 0,
videoColourPrimaries: "BT.709",
videoTransferCharacteristics: "BT.709",
width: 1800,
height: 1080,
audioFormat: "AC-3",
audioCodecID: "A_AC3",
audioCodecLibrary: "",
audioAdditionalFeatures: "",
audioBitrate: 384000,
runTime: "01:42:00.8000000",
audioStreamCount: 1,
audioChannels: 6,
audioChannelPositions: "3/2/0.1",
audioChannelPositionsText: "Front: L C R, Side: L R, LFE",
audioProfile: "",
videoFps: 23.976,
audioLanguages: "English",
subtitles: "",
scanType: "Progressive",
schemaRevision: 5
},
id: 254
},
qualityProfileId: 1,
id: 324
},

Does the default Home Assistant Radarr component work for you? Yes

Home Assistant Version 0.112.4

Additional Context Add any other context about the problem here.

maykar commented 4 years ago

Sorry for the delay on this one, should be fixed in latest release