Libtorrent is required to play videos but its installation is still
manual so now a message is displayed when libtorrent could not be
imported instead of having a "service could not start" error at Kodi
startup.
The message contains a link to a page which explains how to install
libtorrent. It will be displayed when:
* the add-on starts
* the user selects a video to play (including when called externally)
Other additions:
* Create a kodi_utils module to centralize some calls to the Kodi API
* Add license information in the header of the files
* Ignore some files in Git (python cache and Mac OS system file)
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
Use "local" instead of "all-local" by default because "all-local"
requires admin privileges
Other improvements:
* Replace urllib with requests to make the management of the HTTP
requests simpler (better error handling and easier implementation of
complex requests in the future)
* Refactor the functions used to build the HTTP request to improve
maintainability (don't know if it makes sense to keep a single
function for the "search" and the "list videos" request).
* Use "urlencode" to generate the Kodi URL using a dict to make it more
generic.
* Create a function to log messages easily in Kodi's debug log. It will
decrease the amount of duplicate code.
* Fix some errors reported by pylint with regards to PEP 8
Merge branch 'local_videos' into 'master'
Add a video_filter parameter to be able to browse only local
- when browsing ( and not searching ) it is possible to select
filter=local that will show only local video
- create dedicated method to build kodi and peertube api url
- bumped version to 0.3.1.1 to indicate this change
- if selected upstream might want to change it to 0.3.2
See merge request StCyr/plugin.video.peertube!2
- when browsing ( and not searching ) it is possible to select
filter=local that will show only local video
- create dedicated method to build kodi and peertube api url
- bumped version to 0.3.1.1 to indicate this change
- if selected upstream might want to change it to 0.3.2
Addon will use, by order of preferrence:
1) The video matching exactly the user's preferrence
2) A video with the best resolution that is lower than the user's preferrence
3) The video with the lowest resolution that is higher than the user's preferrence