Return None for history source if media no longer exists (#1269)

This commit is contained in:
JonnyWong16 2023-11-02 21:24:29 -07:00 committed by GitHub
parent a9e2406e25
commit 7f5cf76cbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -953,8 +953,10 @@ class PlexHistory(object):
raise NotImplementedError('History objects cannot be reloaded. Use source() to get the source media item.')
def source(self):
""" Return the source media object for the history entry. """
return self.fetchItem(self._details_key)
""" Return the source media object for the history entry
or None if the media no longer exists on the server.
"""
return self.fetchItem(self._details_key) if self._details_key else None
def delete(self):
""" Delete the history entry. """