Skip to content

Commit 55559d3

Browse files
authored
Merge pull request #2 from maykar/master
dev to master
2 parents 6a40ed3 + 46879f3 commit 55559d3

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
___
2+
3+
<h1 align="center"> :warning: THIS IS THE DEV BRANCH! :warning:</h1>
4+
<h2 align="center">
5+
May contain bugs, broken features, and should generally be avoided.</br></br>Master branch is located here:</br> https://github.com/custom-components/sensor.plex_recently_added</h2>
6+
7+
8+
___
9+
110
# Plex Recently Added Component
211

312
Home Assistant component to feed [Upcoming Media Card](https://github.com/custom-cards/upcoming-media-card) with

custom_components/sensor/plex_recently_added.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_SSL
1818
from homeassistant.helpers.entity import Entity
1919

20-
__version__ = '0.1.2'
20+
__version__ = '0.1.3'
2121

2222
_LOGGER = logging.getLogger(__name__)
2323

@@ -47,8 +47,10 @@ class PlexRecentlyAddedSensor(Entity):
4747

4848
def __init__(self, hass, conf):
4949
from pytz import timezone
50+
self.conf_dir = str(hass.config.path()) + '/'
5051
self._dir = '/custom-lovelace/upcoming-media-card/images/plex/'
51-
self.img = '{0}{1}{2}{3}.jpg'.format({}, self._dir, {}, {})
52+
self.img = '{0}{1}{2}{3}{4}.jpg'.format(
53+
self.conf_dir, {}, self._dir, {}, {})
5254
self._tz = timezone(str(hass.config.time_zone))
5355
self.cert = conf.get(CONF_SSL_CERT)
5456
self.ssl = 's' if conf.get(CONF_SSL) or self.cert else ''
@@ -102,6 +104,10 @@ def device_state_attributes(self):
102104
key = media['ratingKey']
103105
else:
104106
continue
107+
if 'originallyAvailableAt' in media:
108+
card_item['aired'] = media['originallyAvailableAt']
109+
else:
110+
card_item['aired'] = ''
105111
if 'addedAt' in media:
106112
card_item['airdate'] = media['addedAt']
107113
else:
@@ -203,7 +209,8 @@ def update(self):
203209
reverse=True)[:self.max_items]
204210

205211
if self.dl_images:
206-
directory = 'www' + self._dir
212+
directory = self.conf_dir + 'www' + self._dir
213+
_LOGGER.warning(directory)
207214
if not os.path.exists(directory):
208215
os.makedirs(directory, mode=0o777)
209216

0 commit comments

Comments
 (0)