When a new instance was selected from the list of instances, it had no
effect because the new instance URL was saved in an attribute that was
reset at the next call of the add-on.
Now when the user selects a new instance, the associated setting is
updated so that this value can be reused the next time the add-on is
called or started.
Also took this opportunity to refactor the access to the add-on's
settings: there are now wrapper methods in kodi_utils.py which
encapsulates the call to Kodi APIs to make the code simpler.
See merge request StCyr/plugin.video.peertube!10 for more information
Now the "play_video" action can be called with the ID of the video (and
optionally the URL of the instance hosting the video) as parameter
instead of the full URL: it will allow other add-ons to call the add-on
to play videos since the full URL contains the resolution which is not
known.
It led to some refactoring and changes in the code:
* Only the instance and the id of a video is retrieved when browsing and
listing videos which improves the performance a lot (the video URL and
the resolution are defined only when the video is played)
* the "https://" prefix is now automatically added to the instances URL
because the instance-related REST APIs use URLs without this prefix.
It also simplifies the external API because the user does not have to
provide this prefix.
Consequently the prefix was removed from the default value of the
selected instance in the settings: it simplifies the code but it
generates a non-backward compatible change. The impact is limited
because it can be easily fixed by resetting the settings to the
default value and there are very few users currently.
Other changes:
- manage errors when retrieving the information of a video
- fix some PEP 8 errors