Merge pull request #1137 from croneter/fix-album

Fix TypeError: 'NoneType' object has no attribute '__getitem__', e.g. when displaying albums
This commit is contained in:
croneter 2020-03-01 13:52:32 +01:00 committed by GitHub
commit 7ede0566c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -69,18 +69,24 @@ class File(object):
% self.grandparent_id()) % self.grandparent_id())
else: else:
path = 'plugin://%s/' % v.ADDON_TYPE[self.plex_type] path = 'plugin://%s/' % v.ADDON_TYPE[self.plex_type]
# Filename in Kodi will end with actual filename - hopefully if self.plex_type in (v.PLEX_TYPE_MOVIE,
# this is useful for other add-ons v.PLEX_TYPE_CLIP,
filename = self.file_path(force_first_media=force_first_media) v.PLEX_TYPE_EPISODE):
try: # Filename in Kodi will end with actual filename - hopefully
if '/' in filename: # this is useful for other add-ons
filename = filename.rsplit('/', 1)[1] filename = self.file_path(force_first_media=force_first_media)
else: try:
filename = filename.rsplit('\\', 1)[1] if '/' in filename:
except (TypeError, IndexError): filename = filename.rsplit('/', 1)[1]
return else:
entirepath = ('%s?mode=play&plex_id=%s&plex_type=%s&filename=%s' filename = filename.rsplit('\\', 1)[1]
% (path, self.plex_id, self.plex_type, filename)) except (TypeError, IndexError):
return
entirepath = ('%s?mode=play&plex_id=%s&plex_type=%s&filename=%s'
% (path, self.plex_id, self.plex_type, filename))
else:
entirepath = ('%s?mode=play&plex_id=%s&plex_type=%s'
% (path, self.plex_id, self.plex_type))
# For Kodi DB, we need to safe the ENTIRE path for filenames # For Kodi DB, we need to safe the ENTIRE path for filenames
filename = entirepath filename = entirepath
else: else: