Merge pull request #1140 from croneter/fix-play
Fix another TypeError: 'NoneType' object has no attribute '__getitem__', e.g. when trying to play trailers
This commit is contained in:
commit
7e3dcbe332
1 changed files with 9 additions and 13 deletions
|
@ -69,22 +69,18 @@ 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]
|
||||||
if self.plex_type in (v.PLEX_TYPE_MOVIE,
|
# Filename in Kodi will end with actual filename - hopefully
|
||||||
v.PLEX_TYPE_CLIP,
|
# this is useful for other add-ons
|
||||||
v.PLEX_TYPE_EPISODE):
|
filename = self.file_path(force_first_media=force_first_media)
|
||||||
# Filename in Kodi will end with actual filename - hopefully
|
if filename:
|
||||||
# this is useful for other add-ons
|
if '/' in filename:
|
||||||
filename = self.file_path(force_first_media=force_first_media)
|
filename = filename.rsplit('/', 1)[1]
|
||||||
try:
|
else:
|
||||||
if '/' in filename:
|
filename = filename.rsplit('\\', 1)[1]
|
||||||
filename = filename.rsplit('/', 1)[1]
|
|
||||||
else:
|
|
||||||
filename = filename.rsplit('\\', 1)[1]
|
|
||||||
except (TypeError, IndexError):
|
|
||||||
return
|
|
||||||
entirepath = ('%s?mode=play&plex_id=%s&plex_type=%s&filename=%s'
|
entirepath = ('%s?mode=play&plex_id=%s&plex_type=%s&filename=%s'
|
||||||
% (path, self.plex_id, self.plex_type, filename))
|
% (path, self.plex_id, self.plex_type, filename))
|
||||||
else:
|
else:
|
||||||
|
# E.g. clips or albums
|
||||||
entirepath = ('%s?mode=play&plex_id=%s&plex_type=%s'
|
entirepath = ('%s?mode=play&plex_id=%s&plex_type=%s'
|
||||||
% (path, self.plex_id, self.plex_type))
|
% (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
|
||||||
|
|
Loading…
Reference in a new issue