Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: exception breaking reproductions when playcount missing #618

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

klondi
Copy link

@klondi klondi commented Jan 28, 2019

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • I have read the CONTRIBUTING document.

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you successfully ran tests with your changes locally?

Sometimes the netflix plugin marks an episode as not seen and deletes the playcount field. This makes watching the episode or film impossible as when creating the infos object this field is accessed. Here is an example exception.

ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.KeyError'>
                                            Error Contents: 'playcount'
                                            Traceback (most recent call last):
                                              File "/storage/.kodi/addons/plugin.video.netflix/addon.py", line 33, in <module>
                                                NAVIGATION.router(paramstring=REQUEST_PARAMS)
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/utils.py", line 60, in wrapped
                                                result = func(*args, **kwargs)
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/Navigation.py", line 253, in router
                                                infoLabels=params.get('infoLabels', {}))
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/utils.py", line 60, in wrapped
                                                result = func(*args, **kwargs)
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/Navigation.py", line 313, in play_video
                                                timeline_markers=self._get_timeline_markers(metadata))
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/KodiHelper.py", line 986, in play_item
                                                'playcount': details[0]['playcount']}})
                                            KeyError: 'playcount'
                                            -->End of Python script error report<--

Instead we use the dictionary get method so that we can fall back to 0 when the attribute is absent.

Sometimes the netflix plugin marks an episode as not seen and deletes the playcount field. This makes watching the episode or film impossible as when creating the infos object this field is accessed. Here is an example exception.
ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.KeyError'>
                                            Error Contents: 'playcount'
                                            Traceback (most recent call last):
                                              File "/storage/.kodi/addons/plugin.video.netflix/addon.py", line 33, in <module>
                                                NAVIGATION.router(paramstring=REQUEST_PARAMS)
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/utils.py", line 60, in wrapped
                                                result = func(*args, **kwargs)
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/Navigation.py", line 253, in router
                                                infoLabels=params.get('infoLabels', {}))
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/utils.py", line 60, in wrapped
                                                result = func(*args, **kwargs)
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/Navigation.py", line 313, in play_video
                                                timeline_markers=self._get_timeline_markers(metadata))
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/KodiHelper.py", line 986, in play_item
                                                'playcount': details[0]['playcount']}})
                                            KeyError: 'playcount'
                                            -->End of Python script error report<--

Instead we use the dictionary get method so that we can fall back to 0 when the attribute is absent.
@wsnipex
Copy link

wsnipex commented Jun 13, 2019

any reason this is not getting merged? It fixes a real issue.

@klondi
Copy link
Author

klondi commented Jul 5, 2019

@liberty-developer is there anything that is blocking my request? The only complaint I saw is from travis-ci and it affects files that are not affected by my patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants