Skip to content

Commit

Permalink
Fix spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
downey-lv committed Jun 4, 2024
1 parent f8c1336 commit 72bc8f2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions custom_components/trakt_tv/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,14 @@ def name(self):
def medias(self):
if not self.coordinator.data:
return None

if self.trakt_kind == TraktKind.LIST:
try:
name = self.config_entry["friendly_name"]
return self.coordinator.data[self.source][self.trakt_kind][name]
except KeyError:
return None

try:
return self.coordinator.data[self.source][self.trakt_kind]
except KeyError:
Expand All @@ -150,11 +152,13 @@ def configuration(self):
def data(self):
if not self.medias:
return []

if self.trakt_kind == TraktKind.LIST:
sort_by = self.config_entry["sort_by"]
sort_order = self.config_entry["sort_order"]
max_medias = self.config_entry["max_medias"]
return self.medias.to_homeassistant(sort_by, sort_order)[0 : max_medias + 1]

max_medias = self.configuration["max_medias"]
return self.medias.to_homeassistant()[0 : max_medias + 1]

Expand Down

0 comments on commit 72bc8f2

Please sign in to comment.