plexinc / plex-for-kodi

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

Unable to play multi part video in Kodi 19 #353

Closed JayXon closed 1 year ago

JayXon commented 3 years ago

Description:

I can play most videos just fine, but this video is splitted into two files, part1 and part2, and it will stuck after trying to play.

Details:

Checklist

2021-05-16 00:11:37.483 T:14316   ERROR <general>: _________________________________________________________________________________
2021-05-16 00:11:37.484 T:14316   ERROR <general>: script.plex: ERROR: 
2021-05-16 00:11:37.484 T:14316   ERROR <general>:     Traceback (most recent call last):
2021-05-16 00:11:37.484 T:14316   ERROR <general>:       File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plex/lib/player.py", line 745, in _playVideo
2021-05-16 00:11:37.484 T:14316   ERROR <general>:         self.playerObject = self.playerObject.getServerDecision()
2021-05-16 00:11:37.484 T:14316   ERROR <general>:       File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plex/lib/_included_packages/plexnet/plexplayer.py", line 201, in getServerDecision
2021-05-16 00:11:37.484 T:14316   ERROR <general>:         decisionPath = self.getDecisionPath(directPlay)
2021-05-16 00:11:37.484 T:14316   ERROR <general>:       File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plex/lib/_included_packages/plexnet/plexplayer.py", line 238, in getDecisionPath
2021-05-16 00:11:37.484 T:14316   ERROR <general>:         decisionPath = self.buildTranscode(server, util.AttributeDict(), self.metadata.partIndex, True, False).decisionPath
2021-05-16 00:11:37.484 T:14316   ERROR <general>:       File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plex/lib/_included_packages/plexnet/plexplayer.py", line 457, in buildTranscode
2021-05-16 00:11:37.484 T:14316   ERROR <general>:         seekOffset >= obj.startOffset and seekOffset <= obj.get('startOffset', 0) + int(part.duration.asInt() / 1000)
2021-05-16 00:11:37.484 T:14316   ERROR <general>:     TypeError: '>=' not supported between instances of 'int' and 'NoneType'
2021-05-16 00:11:37.484 T:14316   ERROR <general>: _________________________________________________________________________________
2021-05-16 00:11:37.484 T:14316   ERROR <general>: `
2021-05-16 00:11:37.484 T:14316 WARNING <general>: xbmc.translatePath is deprecated and might be removed in future kodi versions. Please use xbmcvfs.translatePath instead.
2021-05-16 00:11:37.491 T:14316   ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'AttributeError'>
                                                   Error Contents: 'str' object has no attribute 'decode'
                                                   Traceback (most recent call last):
                                                     File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plex/lib/player.py", line 745, in _playVideo
                                                       self.playerObject = self.playerObject.getServerDecision()
                                                     File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plex/lib/_included_packages/plexnet/plexplayer.py", line 201, in getServerDecision
                                                       decisionPath = self.getDecisionPath(directPlay)
                                                     File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plex/lib/_included_packages/plexnet/plexplayer.py", line 238, in getDecisionPath
                                                       decisionPath = self.buildTranscode(server, util.AttributeDict(), self.metadata.partIndex, True, False).decisionPath
                                                     File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plex/lib/_included_packages/plexnet/plexplayer.py", line 457, in buildTranscode
                                                       seekOffset >= obj.startOffset and seekOffset <= obj.get('startOffset', 0) + int(part.duration.asInt() / 1000)
                                                   TypeError: '>=' not supported between instances of 'int' and 'NoneType'

                                                   During handling of the above exception, another exception occurred:

                                                   Traceback (most recent call last):
                                                     File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plex/lib/windows/kodigui.py", line 105, in onInit
                                                       self.onFirstInit()
                                                     File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plex/lib/windows/videoplayer.py", line 91, in onFirstInit
                                                       self.play(resume=self.resume)
                                                     File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.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 "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.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 "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plex/lib/player.py", line 750, in _playVideo
                                                       util.ERROR(notify=True)
                                                     File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plex/lib/util.py", line 143, in ERROR
                                                       showNotification('ERROR: {0}'.format(short))
                                                     File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plex/lib/util.py", line 179, in showNotification
                                                       icon_path = icon_path or xbmc.translatePath(ADDON.getAddonInfo('icon')).decode('utf-8')
                                                   AttributeError: 'str' object has no attribute 'decode'
                                                   -->End of Python script error report<--
JayXon commented 3 years ago

https://github.com/plexinc/plex-for-kodi/blob/e6610e42ce1afd115cf59632b949e18597625323/lib/_included_packages/plexnet/plexplayer.py#L457 Looks like obj.startOffset needs to be obj.get('startOffset', 0)

garymm commented 2 years ago

This is fixed in my fork: https://github.com/garymm/plex-for-kodi/commit/787b361bf58ff95e60e6625734a74776709017b5

Anyone should feel free to open a PR to fix it here too.

garymm commented 1 year ago

Got merged into master, but not released: https://github.com/plexinc/plex-for-kodi/commit/ff3b4f233dd456beb3a440a234f7eec6a65ce976

ruuk commented 1 year ago

Submitted to Kodi repo.