Fix TypeError with PMS item 'addedAt' missing
This commit is contained in:
parent
47d480eafd
commit
50b25ccf73
2 changed files with 8 additions and 3 deletions
|
@ -1535,9 +1535,12 @@ class API():
|
||||||
|
|
||||||
def getDateCreated(self):
|
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):
|
def getUserData(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -32,9 +32,11 @@ def DateToKodi(stamp):
|
||||||
propper, human-readable time stamp used by Kodi
|
propper, human-readable time stamp used by Kodi
|
||||||
|
|
||||||
Output: Y-m-d h:m:s = 2009-04-05 23:16:04
|
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:
|
try:
|
||||||
|
stamp = float(stamp) + float(window('kodiplextimeoffset'))
|
||||||
date_time = time.localtime(stamp)
|
date_time = time.localtime(stamp)
|
||||||
localdate = time.strftime('%Y-%m-%d %H:%M:%S', date_time)
|
localdate = time.strftime('%Y-%m-%d %H:%M:%S', date_time)
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Reference in a new issue