diff --git a/resources/lib/PlexAPI.py b/resources/lib/PlexAPI.py index 8267d4bd..2d1623b7 100644 --- a/resources/lib/PlexAPI.py +++ b/resources/lib/PlexAPI.py @@ -1535,9 +1535,12 @@ class API(): def getDateCreated(self): """ - Returns the date when this library item was created + Returns the date when this library item was created or None """ - return utils.DateToKodi(self.item.attrib.get('addedAt')) + res = self.item.attrib.get('addedAt') + if res is not None: + res = utils.DateToKodi(res) + return res def getUserData(self): """ diff --git a/resources/lib/utils.py b/resources/lib/utils.py index bf1b4a4b..5dfd748f 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -32,9 +32,11 @@ def DateToKodi(stamp): propper, human-readable time stamp used by Kodi Output: Y-m-d h:m:s = 2009-04-05 23:16:04 + + None if an error was encountered """ - stamp = float(stamp) + float(window('kodiplextimeoffset')) try: + stamp = float(stamp) + float(window('kodiplextimeoffset')) date_time = time.localtime(stamp) localdate = time.strftime('%Y-%m-%d %H:%M:%S', date_time) except: