|
17 | 17 | from homeassistant.const import CONF_HOST, CONF_PORT, CONF_SSL |
18 | 18 | from homeassistant.helpers.entity import Entity |
19 | 19 |
|
20 | | -__version__ = '0.1.2' |
| 20 | +__version__ = '0.1.3' |
21 | 21 |
|
22 | 22 | _LOGGER = logging.getLogger(__name__) |
23 | 23 |
|
@@ -47,8 +47,10 @@ class PlexRecentlyAddedSensor(Entity): |
47 | 47 |
|
48 | 48 | def __init__(self, hass, conf): |
49 | 49 | from pytz import timezone |
| 50 | + self.conf_dir = str(hass.config.path()) + '/' |
50 | 51 | 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, {}, {}) |
52 | 54 | self._tz = timezone(str(hass.config.time_zone)) |
53 | 55 | self.cert = conf.get(CONF_SSL_CERT) |
54 | 56 | self.ssl = 's' if conf.get(CONF_SSL) or self.cert else '' |
@@ -102,6 +104,10 @@ def device_state_attributes(self): |
102 | 104 | key = media['ratingKey'] |
103 | 105 | else: |
104 | 106 | continue |
| 107 | + if 'originallyAvailableAt' in media: |
| 108 | + card_item['aired'] = media['originallyAvailableAt'] |
| 109 | + else: |
| 110 | + card_item['aired'] = '' |
105 | 111 | if 'addedAt' in media: |
106 | 112 | card_item['airdate'] = media['addedAt'] |
107 | 113 | else: |
@@ -203,7 +209,8 @@ def update(self): |
203 | 209 | reverse=True)[:self.max_items] |
204 | 210 |
|
205 | 211 | if self.dl_images: |
206 | | - directory = 'www' + self._dir |
| 212 | + directory = self.conf_dir + 'www' + self._dir |
| 213 | + _LOGGER.warning(directory) |
207 | 214 | if not os.path.exists(directory): |
208 | 215 | os.makedirs(directory, mode=0o777) |
209 | 216 |
|
|
0 commit comments