Now torrents are downloaded with vfs.libtorrent[1].
Some parts of the code were removed as they will probably be useless
in the future. For instance, the service is disabled (temporarily?)
because the download in background/foreground is now managed by
vfs.libtorrent.
Use the Read() API of vfs.libtorrent to retrieve the path where the
torrent was downloaded.
Also:
* Display a warning if there are more than 1 file in the torrent
because the add-on will play only the first file
* Remove the "start downloading" notification since an equivalent
message is now displayed by vfs.libtorrent
[1]:https://framagit.org/thombet/vfs.libtorrent
Drop support of python 2 and make the code compatible with python 3 so that the add-on works on Kodi 19.
Update Kodistubs version in the CI and get rid of the python 2 actions.
Note: script.module.libtorrent is disabled because it will not be used on Matrix (and is not compatible).
It will be replaced by vfs.libtorrent[1] when ready.
[1]: https://framagit.org/thombet/vfs.libtorrent
In order to support more systems (especially the ones where the
libtorrent python bindings cannot be installed manually), the add-on
script.module.libtorrent is now used to import libtorrent.
While adding the German translation some encodings errors occurred due
to non-ASCII characters. Only these errors were fixed because a full
analysis of the strings will be performed when implementing support for
python3.
* Remove empty tags in addon.xml and add a disclaimer
* Update the description of the add-on in addon.xml
* Move icon.png into the "resources" folder to match Kodi guidelines (a
solid white background is added automatically by Kodi so the icon was
modified with a white background to avoid unexpected display and to
match Kodi guidelines)
* Improve the translation guidelines
* Add a missing dot in a localized string
New features:
* Add the description of each video and each instance. The total number
of local videos and users of an instance are also added to the
description of the instance in Kodi.
* Add the total number of pages in the "Next page" item (+ fix the
number of the current page)
* Display a notification when the download of the torrent starts (will
help the user to know that something is going on, especially on slow
machines)
* Support instance URL that are prefixed with "https://" in the settings
Internal changes:
* Create a smaller entry point file to match Kodi's best practices
(main.py)
* Create a new main module (addon.py) containing only the code related
to the add-on execution. The other lines of code were moved to the
classes PeerTube or KodiUtils.
* KodiUtils is now a class and an instance of this class is made
available to all the modules of the add-on to reuse easily its methods
and attributes.
* Create helper functions in KodiUtils for creating items in Kodi UI
easily
See merge request StCyr/plugin.video.peertube!17 for more information
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
- 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
This reverts commit 5f590f48cd.
In the end, a service is needed: The addon is ended when kodi starts playing the file, so the
downloader thread would be ended also. I need to launch the downloader thread from something that
isn't expected to end, which is why services exist.
First Proof-Of-Concept:
The addon notably lacks the ability to browse a peertube instance, and
it is not able to download torrent in the background (so they are almost
never completly downloaded as the downloas stops when kodi starts playing
the media).