sualfred / script.embuary.helper

Helper script for Embuary Kodi skin
17 stars 13 forks source link

Key error on watchedepisodes #62

Open romainhild opened 3 years ago

romainhild commented 3 years ago

Hi, I have an error when accessing the list of episodes of a tv show. I use OSMC on a raspberry 4, with the aeon silvio skin. The error on the logs are the following:

2021-08-30 13:26:27.513 T:29303    INFO <general>: CPythonInvoker(30, /home/osmc/.kodi/addons/script.embuary.helper/plugin.py): script successfully run
2021-08-30 13:26:27.514 T:29306    INFO <general>: initializing python engine.
2021-08-30 13:26:27.738 T:29303    INFO <general>: Python interpreter stopped
2021-08-30 13:26:27.986 T:29304   ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'KeyError'>
                                                   Error Contents: 'watchedepisodes'
                                                   Traceback (most recent call last):
                                                     File "/home/osmc/.kodi/addons/script.embuary.helper/plugin.py", line 70, in <module>
                                                       Main()
                                                     File "/home/osmc/.kodi/addons/script.embuary.helper/plugin.py", line 21, in __init__
                                                       self.getinfos()
                                                     File "/home/osmc/.kodi/addons/script.embuary.helper/plugin.py", line 54, in getinfos
                                                       self._execute(plugin,self.info)
                                                     File "/home/osmc/.kodi/addons/script.embuary.helper/plugin.py", line 62, in _execute
                                                       getattr(plugin,action.lower())()
                                                     File "/home/osmc/.kodi/addons/script.embuary.helper/resources/lib/plugin_content.py", line 109, in getbydbid
                                                       add_items(self.li,[result],type=self.dbtype)
                                                     File "/home/osmc/.kodi/addons/script.embuary.helper/resources/lib/library.py", line 21, in add_items
                                                       handle_seasons(li, item)
                                                     File "/home/osmc/.kodi/addons/script.embuary.helper/resources/lib/library.py", line 176, in handle_seasons
                                                       watchedepisodes = item['watchedepisodes']
                                                   KeyError: 'watchedepisodes'
                                                   -->End of Python script error report<--
123Venom commented 2 years ago

same exact error here on Windows 10 running 19.2

123Venom commented 2 years ago

I've logged the value of item and it appears watchedepisodes is not in the dict. Temp fix for now I've added a try/except


try: watchedepisodes = item['watchedepisodes']
except: watchedepisodes = 0