Temporary commit to test vfs.libtorrent

vfs.libtorrent is at https://framagit.org/thombet/vfs.libtorrent
This commit is contained in:
Thomas Bétous 2021-08-08 21:32:58 +02:00
parent b629ee43a6
commit e82b916bbf
2 changed files with 25 additions and 4 deletions

View File

@ -1,10 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.peertube" name="PeerTube" version="1.2.0" provider-name="Cyrille B. + Thomas B.">
<addon id="plugin.video.peertube" name="PeerTube" version="1.2.0-dev" provider-name="Cyrille B. + Thomas B.">
<requires>
<import addon="xbmc.python" version="2.25.0"/>
<import addon="script.module.addon.signals" version="0.0.3"/>
<import addon="script.module.requests" version="2.22.0"/>
<import addon="script.module.libtorrent" version="1.2.0"/>
<!-- <import addon="script.module.libtorrent" version="1.2.0"/> -->
<!-- <import addon="vfs.libarchive"/> -->
<!-- <import addon="vfs.libtorrent"/> -->
</requires>
<extension point="xbmc.python.pluginsource" library="main.py">
<provides>video</provides>

View File

@ -13,6 +13,8 @@ import AddonSignals # Module exists only in Kodi - pylint: disable=import-error
from resources.lib.kodi_utils import kodi
from resources.lib.peertube import PeerTube, list_instances
import xbmcvfs
import xbmc
class PeerTubeAddon():
"""
@ -421,6 +423,8 @@ class PeerTubeAddon():
:param dict params: Parameters the add-on was called with
"""
from urllib import quote_plus as url_quote
# Check the parameters passed to the plugin
if params:
action = params["action"]
@ -429,10 +433,25 @@ class PeerTubeAddon():
self._browse_videos(int(params["start"]))
elif action == "search_videos":
# Search for videos on the selected instance
self._search_videos(int(params["start"]))
# self._search_videos(int(params["start"]))
filename = "torrent://{}".format(url_quote(
"https://framatube.org/static/torrents/c448032c-9d98-4190-a533-02afe7a214b1-270.torrent"))
kodi.debug("filename = {}".format(filename))
f = xbmcvfs.File(filename)
data = f.read()
kodi.debug("data = {}".format(data))
f.close()
elif action == "browse_instances":
# Browse PeerTube instances
self._browse_instances(int(params["start"]))
# self._browse_instances(int(params["start"]))
if xbmcvfs.exists("/Users/Thomas/Desktop/c448032c-9d98-4190-a533-02afe7a214b1-270.torrent"):
kodi.debug("Exists returned True")
else:
kodi.debug("Exists returned False")
elif action == "play_video":
# This action comes with the id of the video to play as
# parameter. The instance may also be in the parameters. Use