Fix TypeError with PMS item 'addedAt' missing

This commit is contained in:
tomkat83 2016-04-02 10:43:50 +02:00
parent 47d480eafd
commit 50b25ccf73
2 changed files with 8 additions and 3 deletions

View file

@ -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):
""" """

View file

@ -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: