Skip to content

Commit 46879f3

Browse files
authored
Get config dir. Should help with non rbp installations
1 parent 77539f8 commit 46879f3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

custom_components/sensor/plex_recently_added.py

Lines changed: 6 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 ''
@@ -207,7 +209,8 @@ def update(self):
207209
reverse=True)[:self.max_items]
208210

209211
if self.dl_images:
210-
directory = 'www' + self._dir
212+
directory = self.conf_dir + 'www' + self._dir
213+
_LOGGER.warning(directory)
211214
if not os.path.exists(directory):
212215
os.makedirs(directory, mode=0o777)
213216

0 commit comments

Comments
 (0)