Update code for python 3
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
This commit is contained in:
parent
b629ee43a6
commit
8dec0f316e
|
@ -12,7 +12,7 @@ stages:
|
||||||
.apt_get_update: &apt_get_update
|
.apt_get_update: &apt_get_update
|
||||||
- apt-get update > /dev/null
|
- apt-get update > /dev/null
|
||||||
|
|
||||||
.python3_prep: &python3_prep
|
.python_prep: &python_prep
|
||||||
- apt-get install --yes python3-dev python3-pip > /dev/null
|
- apt-get install --yes python3-dev python3-pip > /dev/null
|
||||||
- python3 -m pip --quiet install -r misc/python_requirements.txt
|
- python3 -m pip --quiet install -r misc/python_requirements.txt
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ quality:
|
||||||
when: manual
|
when: manual
|
||||||
before_script:
|
before_script:
|
||||||
- *apt_get_update
|
- *apt_get_update
|
||||||
- *python3_prep
|
- *python_prep
|
||||||
script:
|
script:
|
||||||
- find . -iname '*.py' | xargs -t python3 -m pylint --rcfile=misc/pylint-rcfile.txt | tee pylint.log
|
- find . -iname '*.py' | xargs -t python3 -m pylint --rcfile=misc/pylint-rcfile.txt | tee pylint.log
|
||||||
artifacts:
|
artifacts:
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?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" provider-name="Cyrille B. + Thomas B.">
|
||||||
<requires>
|
<requires>
|
||||||
<import addon="xbmc.python" version="2.25.0"/>
|
<import addon="xbmc.python" version="3.0.0"/>
|
||||||
<import addon="script.module.addon.signals" version="0.0.3"/>
|
<import addon="script.module.addon.signals" version="0.0.6"/>
|
||||||
<import addon="script.module.requests" version="2.22.0"/>
|
<import addon="script.module.requests" version="2.25.1"/>
|
||||||
<import addon="script.module.libtorrent" version="1.2.0"/>
|
<!-- <import addon="script.module.libtorrent" version="1.2.0"/> -->
|
||||||
</requires>
|
</requires>
|
||||||
<extension point="xbmc.python.pluginsource" library="main.py">
|
<extension point="xbmc.python.pluginsource" library="main.py">
|
||||||
<provides>video</provides>
|
<provides>video</provides>
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
Kodistubs==18.0.0
|
Kodistubs>=19.0.0
|
||||||
pylint
|
pylint
|
||||||
requests
|
requests
|
||||||
|
|
|
@ -195,11 +195,11 @@ class PeerTubeAddon():
|
||||||
"""
|
"""
|
||||||
next_index = current_index + self.items_per_page
|
next_index = current_index + self.items_per_page
|
||||||
if total > next_index:
|
if total > next_index:
|
||||||
next_page = (next_index / self.items_per_page) + 1
|
next_page = (next_index // self.items_per_page) + 1
|
||||||
total_pages = (total / self.items_per_page) + 1
|
total_pages = (total // self.items_per_page) + 1
|
||||||
|
|
||||||
next_page_item = kodi.generate_item_info(
|
next_page_item = kodi.generate_item_info(
|
||||||
name=u"{} ({}/{})".format(kodi.get_string(30405),
|
name="{} ({}/{})".format(kodi.get_string(30405),
|
||||||
next_page,
|
next_page,
|
||||||
total_pages),
|
total_pages),
|
||||||
url=url
|
url=url
|
||||||
|
|
|
@ -8,18 +8,13 @@
|
||||||
See LICENSE.txt for more information.
|
See LICENSE.txt for more information.
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
try:
|
|
||||||
# Python 3.x
|
|
||||||
from urllib.parse import parse_qsl
|
|
||||||
except ImportError:
|
|
||||||
# Python 2.x
|
|
||||||
from urlparse import parse_qsl
|
|
||||||
|
|
||||||
from requests.compat import urlencode
|
from requests.compat import urlencode
|
||||||
|
from urllib.parse import parse_qsl
|
||||||
|
|
||||||
import xbmc # Kodistubs for Leia is not compatible with python3 / pylint: disable=syntax-error
|
import xbmc
|
||||||
import xbmcaddon
|
import xbmcaddon
|
||||||
import xbmcgui # Kodistubs for Leia is not compatible with python3 / pylint: disable=syntax-error
|
import xbmcgui
|
||||||
import xbmcplugin
|
import xbmcplugin
|
||||||
|
|
||||||
|
|
||||||
|
@ -210,7 +205,7 @@ class KodiUtils:
|
||||||
:param str title: Title of the box
|
:param str title: Title of the box
|
||||||
:param str message: Message in the box
|
:param str message: Message in the box
|
||||||
"""
|
"""
|
||||||
xbmcgui.Dialog().ok(heading=title, line1=message)
|
xbmcgui.Dialog().ok(heading=title, message=message)
|
||||||
|
|
||||||
def open_input_box(self, title):
|
def open_input_box(self, title):
|
||||||
"""Open a box for the user to input alphanumeric data
|
"""Open a box for the user to input alphanumeric data
|
||||||
|
|
|
@ -112,8 +112,7 @@ class PeerTube:
|
||||||
params = self.list_settings.copy()
|
params = self.list_settings.copy()
|
||||||
|
|
||||||
# Add all the arguments to the dict
|
# Add all the arguments to the dict
|
||||||
for param in kwargs:
|
params.update(kwargs)
|
||||||
params[param] = kwargs[param]
|
|
||||||
|
|
||||||
return params
|
return params
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
|
|
||||||
import AddonSignals # Module exists only in Kodi - pylint: disable=import-error
|
import AddonSignals # Module exists only in Kodi - pylint: disable=import-error
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
import xbmc # Kodistubs for Leia is not compatible with python3 / pylint: disable=syntax-error
|
import xbmc
|
||||||
import xbmcvfs # Kodistubs for Leia is not compatible with python3 / pylint: disable=syntax-error
|
import xbmcvfs
|
||||||
|
|
||||||
from resources.lib.kodi_utils import kodi
|
from resources.lib.kodi_utils import kodi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue