bbsan2k/plugin.video.f1tv

Unable to browse on OSMC

Opened this issue · 1 comments

I don't seem to be able to browse any of the top-level categories, having installed this plugin on OSMC on a RPi3. I haven't tried other platforms to confirm whether they are affected.

The ultimate underlying issue appears to be an HTTP 406 error returned by the API, although the script is not taking it well,

2020-04-17 14:09:26.273 T:1447015136   DEBUG: [plugin.video.f1tv] urllib3.connectionpool: https://api.formula1.com:443 "POST /v1/account/Subscriber/CreateSession HTTP/1.1" 200 None
2020-04-17 14:09:26.294 T:1447015136   DEBUG: [plugin.video.f1tv] urllib3.connectionpool: Starting new HTTPS connection (1): f1tv.formula1.com:443
2020-04-17 14:09:27.036 T:1447015136   DEBUG: [plugin.video.f1tv] urllib3.connectionpool: https://f1tv.formula1.com:443 "POST /api/social-authenticate/ HTTP/1.1" 201 2281
2020-04-17 14:09:53.681 T:1472193248   DEBUG: Thread JobWorker 1472193248 terminating (autodelete)
2020-04-17 14:09:53.681 T:1430229728   DEBUG: Thread JobWorker 1430229728 terminating (autodelete)
2020-04-17 14:09:56.946 T:1447015136   DEBUG: [plugin.video.f1tv] urllib3.connectionpool: https://f1tv.formula1.com:443 "GET /api/sets/?slug=home HTTP/1.1" 406 139
2020-04-17 14:09:56.956 T:1447015136   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.UnboundLocalError'>
                                            Error Contents: local variable 'rj' referenced before assignment
                                            Traceback (most recent call last):
                                              File "/home/osmc/.kodi/addons/plugin.video.f1tv/main.py", line 14, in <module>
                                                plugin.run()
                                              File "/home/osmc/.kodi/addons/plugin.video.f1tv/resources/lib/plugin.py", line 589, in run
                                                router(sys.argv[2][1:])
                                              File "/home/osmc/.kodi/addons/plugin.video.f1tv/resources/lib/plugin.py", line 537, in router
                                                sets()
                                              File "/home/osmc/.kodi/addons/plugin.video.f1tv/resources/lib/plugin.py", line 94, in sets
                                                sets = _api_manager.getSets()
                                              File "/home/osmc/.kodi/addons/plugin.video.f1tv/resources/lib/F1TVParser/F1TV_Minimal_API.py", line 130, in getSets
                                                for item in rj['objects'][0]['items']:
                                            UnboundLocalError: local variable 'rj' referenced before assignment
                                            -->End of Python script error report<--

I can see in the code that if json is not okay, rj is not created. So some error handling should be cleaned up there.

"By circuit" seems to be coding bug,

                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.NameError'>
                                            Error Contents: global name '__OLD_TV_API__TV_API__' is not defined
                                            Traceback (most recent call last):
                                              File "/home/osmc/.kodi/addons/plugin.video.f1tv/main.py", line 14, in <module>
                                                plugin.run()
                                              File "/home/osmc/.kodi/addons/plugin.video.f1tv/resources/lib/plugin.py", line 589, in run
                                                router(sys.argv[2][1:])
                                              File "/home/osmc/.kodi/addons/plugin.video.f1tv/resources/lib/plugin.py", line 535, in router
                                                list_circuits()
                                              File "/home/osmc/.kodi/addons/plugin.video.f1tv/resources/lib/plugin.py", line 204, in list_circuits
                                                circuits = _api_manager.getCircuits()['objects']
                                              File "/home/osmc/.kodi/addons/plugin.video.f1tv/resources/lib/F1TVParser/F1TV_Minimal_API.py", line 92, in getCircuits
                                                complete_url = __OLD_TV_API__TV_API__ + "/api/circuit/"
                                            NameError: global name '__OLD_TV_API__TV_API__' is not defined
                                            -->End of Python script error report<--

This is version 0.1.2, installed using the repo addon.

Sorry for reaching out so late - can you please try with current 0.1.3?
We will be posting a 0.2 soon with new api support as well as a better JWT token caching strategy.