plexinc / plex-for-kodi

Offical Plex for Kodi add-on releases.
GNU General Public License v2.0
249 stars 124 forks source link

TypeError: 'filter' object is not subscriptable #325

Closed fernandoalonzo closed 3 years ago

fernandoalonzo commented 4 years ago

Description:

TV Shows won't play due an error in plexnet/video.py line 461. Error log:

ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                Error Type: <class 'TypeError'>
                Error Contents: 'filter' object is not subscriptable
                Traceback (most recent call last):
                    File "/Users/kodi/Library/Application Support/Kodi/addons/script.plex/lib/windows/kodigui.py", line 105, in onInit
                    self.onFirstInit()
                    File "/Users/kodi/Library/Application Support/Kodi/addons/script.plex/lib/windows/videoplayer.py", line 91, in onFirstInit
                    self.play(resume=self.resume)
                    File "/Users/kodi/Library/Application Support/Kodi/addons/script.plex/lib/windows/videoplayer.py", line 234, in play
                    player.PLAYER.playVideoPlaylist(self.playQueue, resume=self.resume, session_id=id(self), handler=handler)
                    File "/Users/kodi/Library/Application Support/Kodi/addons/script.plex/lib/player.py", line 806, in playVideoPlaylist
                    self._playVideo(resume and self.video.viewOffset.asInt() or 0, seeking=handler and handler.SEEK_PLAYLIST or 0, force_update=True)
                    File "/Users/kodi/Library/Application Support/Kodi/addons/script.plex/lib/player.py", line 761, in _playVideo
                    self.handler.setup(self.video.duration.asInt(), offset, bifURL, title=self.video.grandparentTitle, title2=self.video.title, seeking=seeking)
                    File "/Users/kodi/Library/Application Support/Kodi/addons/script.plex/lib/player.py", line 169, in setup
                    self.getDialog(setup=True)
                    File "/Users/kodi/Library/Application Support/Kodi/addons/script.plex/lib/player.py", line 174, in getDialog
                    self.dialog = seekdialog.SeekDialog.create(show=False, handler=self)
                    File "/Users/kodi/Library/Application Support/Kodi/addons/script.plex/lib/windows/kodigui.py", line 44, in create
                    window = cls(cls.xmlFile, cls.path, cls.theme, cls.res, **kwargs)
                    File "/Users/kodi/Library/Application Support/Kodi/addons/script.plex/lib/windows/seekdialog.py", line 123, in __init__
                    self.intro = self.handler.player.video.intro
                    File "/Users/kodi/Library/Application Support/Kodi/addons/script.plex/lib/_included_packages/plexnet/video.py", line 461, in intro
                    self._intro = (filter(lambda x: x.type == "intro", self.markers) or [False])[0]
                TypeError: 'filter' object is not subscriptable
                -->End of Python script error report<--

In python3 filter() receives an iterable and returns an iterator, hence next() must be used instead of [0] to access the first element of the resulting iterator.

Details:

Checklist

pannal commented 3 years ago

Please check whether my develop branches fix your issue.