forked from f-lawe/plugin.video.orange.fr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Orange auth and rework plugin architecture
- Loading branch information
Showing
34 changed files
with
709 additions
and
759 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,26 +15,27 @@ jobs: | |
strategy: | ||
fail-fast: false | ||
matrix: | ||
kodi-version: [ matrix ] | ||
python-version: [ 3.9 ] | ||
kodi-version: [ nexus ] | ||
python-version: [ 3.8 ] | ||
steps: | ||
- name: Check out ${{ github.sha }} from repository ${{ github.repository }} | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: pip install -r ./requirements.txt | ||
|
||
- name: Run pylint | ||
run: pylint ./resources | ||
- name: Run ruff | ||
run: ruff check . | ||
|
||
- name: Run kodi-addon-checker | ||
uses: xbmc/[email protected] | ||
with: | ||
rewrite-for-matrix: true | ||
is-pr: true | ||
rewrite-for-matrix: false | ||
kodi-version: ${{ matrix.kodi-version }} | ||
addon-id: ${{ github.event.repository.name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.ruff_cache | ||
.vscode | ||
|
||
*.py[cod] | ||
__pycache__ | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<addon id="plugin.video.orange.fr" name="Orange TV France" version="1.5.0" provider-name="BreizhReloaded"> | ||
<addon id="plugin.video.orange.fr" name="Orange TV France" version="1.5.0" provider-name="Flawe"> | ||
<requires> | ||
<import addon="xbmc.python" version="3.0.0"/> | ||
<import addon="xbmc.python" version="3.0.1"/> | ||
<import addon="script.module.routing" version="0.2.3"/> | ||
<import addon="script.module.inputstreamhelper" version="0.5.2"/> | ||
</requires> | ||
<extension point="xbmc.python.pluginsource" library="resources/addon.py"> | ||
<provides>video</provides> | ||
</extension> | ||
<extension point="xbmc.service" library="resources/service.py"/> | ||
<extension point="xbmc.addon.metadata"> | ||
<summary lang="en">Watch TV channels provided by your Orange subscription from Kodi!</summary> | ||
<description lang="en">This addon brings to Kodi all the TV channels included in your Orange subscription. Easy install via IPTV Manager.</description> | ||
|
@@ -19,8 +18,8 @@ | |
<platform>all</platform> | ||
<license>MIT</license> | ||
<forum>https://forum.kodi.tv/showthread.php?tid=360391</forum> | ||
<source>https://github.com/BreizhReloaded/plugin.video.orange.fr</source> | ||
<email>[email protected]</email> | ||
<source>https://github.com/f-lawe/plugin.video.orange.fr</source> | ||
<email>[email protected]</email> | ||
<assets> | ||
<icon>resources/media/icon.png</icon> | ||
<fanart>resources/media/fanart.jpg</fanart> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[project] | ||
requires-python = ">=3.8" | ||
|
||
[tool.ruff] | ||
line-length = 120 | ||
target-version = "py38" | ||
|
||
[tool.ruff.format] | ||
docstring-code-format = false | ||
docstring-code-line-length = "dynamic" | ||
indent-style = "space" | ||
line-ending = "auto" | ||
quote-style = "double" | ||
skip-magic-trailing-comma = false | ||
|
||
[tool.ruff.lint] | ||
fixable = ["ALL"] | ||
ignore = ["D203", "D213"] | ||
select = [ | ||
"E", # pycodestyle | ||
"F", # Pyflakes | ||
"UP", # pyupgrade | ||
"B", # flake8-bugbear | ||
"SIM", # flake8-simplify | ||
"I", # isort | ||
"D", # pydocstyle | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
kodistubs==19.* | ||
pylint==2.14.* | ||
kodistubs==21.* | ||
ruff==0.3.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,47 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Addon entry point""" | ||
import routing # pylint: disable=import-error | ||
import inputstreamhelper # pylint: disable=import-error | ||
import xbmcgui | ||
import xbmcplugin | ||
"""Addon entry point.""" | ||
|
||
import sys | ||
|
||
import xbmc | ||
import xbmcplugin | ||
from lib.channelmanager import ChannelManager | ||
from lib.iptvmanager import IPTVManager | ||
from lib.providers import get_provider | ||
from lib.utils import localize, log, LogLevel, ok_dialog | ||
from lib.utils.xbmc import log, ok_dialog | ||
from routing import Plugin | ||
|
||
plugin = routing.Plugin() | ||
router = Plugin() | ||
|
||
@plugin.route('/') | ||
|
||
@router.route("/") | ||
def index(): | ||
"""Addon index""" | ||
ok_dialog(localize(30902)) | ||
"""Display a welcome message.""" | ||
log("Hello from plugin.video.orange.fr", xbmc.LOGINFO) | ||
ok_dialog("Hello from plugin.video.orange.fr") | ||
|
||
|
||
@plugin.route('/channel/<channel_id>') | ||
@router.route("/channels/<channel_id>") | ||
def channel(channel_id: str): | ||
"""Load stream for the required channel id""" | ||
log(f'Loading channel {channel_id}', LogLevel.INFO) | ||
|
||
stream = get_provider().get_stream_info(channel_id) | ||
if not stream: | ||
ok_dialog(localize(30900)) | ||
return | ||
|
||
is_helper = inputstreamhelper.Helper(stream['manifest_type'], drm=stream['drm']) | ||
if not is_helper.check_inputstream(): | ||
ok_dialog(localize(30901)) | ||
return | ||
|
||
listitem = xbmcgui.ListItem(path=stream['path']) | ||
listitem.setMimeType(stream['mime_type']) | ||
listitem.setProperty('inputstream', 'inputstream.adaptive') | ||
listitem.setProperty('inputstream.adaptive.manifest_type', stream['manifest_type']) | ||
listitem.setProperty('inputstream.adaptive.manifest_update_parameter', 'full') | ||
listitem.setProperty('inputstream.adaptive.license_type', stream['license_type']) | ||
listitem.setProperty('inputstream.adaptive.license_key', stream['license_key']) | ||
xbmcplugin.setResolvedUrl(plugin.handle, True, listitem=listitem) | ||
|
||
@plugin.route('/iptv/channels') | ||
"""Load stream for the required channel id.""" | ||
log(f"Loading channel {channel_id}", xbmc.LOGINFO) | ||
xbmcplugin.setResolvedUrl(router.handle, True, listitem=ChannelManager().load_channel_listitem(channel_id)) | ||
|
||
|
||
@router.route("/iptv/channels") | ||
def iptv_channels(): | ||
"""Return JSON-STREAMS formatted data for all live channels""" | ||
log('Loading channels for IPTV Manager', LogLevel.INFO) | ||
port = int(plugin.args.get('port')[0]) | ||
IPTVManager(port, get_provider()).send_channels() | ||
"""Return JSON-STREAMS formatted data for all live channels.""" | ||
log("Loading channels for IPTV Manager", xbmc.LOGINFO) | ||
port = int(router.args.get("port")[0]) | ||
IPTVManager(port).send_channels() | ||
|
||
@plugin.route('/iptv/epg') | ||
|
||
@router.route("/iptv/epg") | ||
def iptv_epg(): | ||
"""Return JSON-EPG formatted data for all live channel EPG data""" | ||
log('Loading EPG for IPTV Manager', LogLevel.INFO) | ||
port = int(plugin.args.get('port')[0]) | ||
IPTVManager(port, get_provider()).send_epg() | ||
"""Return JSON-EPG formatted data for all live channel EPG data.""" | ||
log("Loading EPG for IPTV Manager") | ||
port = int(router.args.get("port")[0]) | ||
IPTVManager(port).send_epg() | ||
|
||
|
||
if __name__ == '__main__': | ||
plugin.run() | ||
if __name__ == "__main__": | ||
log(sys.version, xbmc.LOGDEBUG) | ||
router.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
# -*- coding: utf-8 -*- | ||
# pylint: disable=missing-module-docstring | ||
# noqa: D104 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""Channel stream loader.""" | ||
|
||
import inputstreamhelper | ||
import xbmcgui | ||
|
||
from lib.providers import get_provider | ||
from lib.utils.xbmc import localize, ok_dialog | ||
|
||
|
||
class ChannelManager: | ||
""".""" | ||
|
||
def load_channel_listitem(self, channel_id: str): | ||
""".""" | ||
stream = get_provider().get_stream_info(channel_id) | ||
if not stream: | ||
ok_dialog(localize(30900)) | ||
return | ||
|
||
is_helper = inputstreamhelper.Helper(stream["manifest_type"], drm=stream["drm"]) | ||
if not is_helper.check_inputstream(): | ||
ok_dialog(localize(30901)) | ||
return | ||
|
||
listitem = xbmcgui.ListItem(path=stream["path"]) | ||
listitem.setMimeType(stream["mime_type"]) | ||
listitem.setContentLookup(False) | ||
listitem.setProperty("inputstream", "inputstream.adaptive") | ||
listitem.setProperty("inputstream.adaptive.license_type", stream["license_type"]) | ||
listitem.setProperty("inputstream.adaptive.license_key", stream["license_key"]) | ||
|
||
return listitem |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.