-
Notifications
You must be signed in to change notification settings - Fork 456
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
756 additions
and
558 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
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
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 was deleted.
Oops, something went wrong.
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,7 @@ | ||
"""Managers.""" | ||
|
||
from .catchup_manager import CatchupManager | ||
from .iptv_manager import IPTVManager | ||
from .stream_manager import StreamManager | ||
|
||
__all__ = ["CatchupManager", "IPTVManager", "StreamManager"] |
54 changes: 54 additions & 0 deletions
54
plugin.video.orange.fr/resources/lib/managers/catchup_manager.py
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,54 @@ | ||
"""Catchup TV Manager.""" | ||
|
||
import xbmc | ||
import xbmcplugin | ||
|
||
from lib.providers import get_provider | ||
from lib.router import router | ||
from lib.utils.gui import create_directory_items | ||
from lib.utils.kodi import build_addon_url | ||
|
||
|
||
class CatchupManager: | ||
"""Navigate through catchup TV content.""" | ||
|
||
def __init__(self): | ||
"""Initialize Catchup Manager object.""" | ||
self.provider = get_provider() | ||
|
||
def get_channels(self) -> list: | ||
"""Return channels available for catchup TV.""" | ||
channels = self.provider.get_catchup_channels() | ||
directory_items = create_directory_items(channels) | ||
|
||
succeeded = xbmcplugin.addDirectoryItems(router.handle, directory_items, len(directory_items)) | ||
xbmcplugin.endOfDirectory(router.handle, succeeded) | ||
|
||
def get_categories(self, catchup_channel_id: str) -> list: | ||
"""Return content categories for the required channel.""" | ||
categories = self.provider.get_catchup_categories(catchup_channel_id) | ||
directory_items = create_directory_items(categories) | ||
|
||
succeeded = xbmcplugin.addDirectoryItems(router.handle, directory_items, len(directory_items)) | ||
xbmcplugin.endOfDirectory(router.handle, succeeded) | ||
|
||
def get_articles(self, catchup_channel_id: str, category_id: str) -> list: | ||
"""Return content (TV show, movie, etc) for the required channel and category.""" | ||
articles = self.provider.get_catchup_articles(catchup_channel_id, category_id) | ||
directory_items = create_directory_items(articles) | ||
|
||
succeeded = xbmcplugin.addDirectoryItems(router.handle, directory_items, len(directory_items)) | ||
xbmcplugin.endOfDirectory(router.handle, succeeded) | ||
|
||
def get_videos(self, catchup_channel_id: str, article_id: str) -> list: | ||
"""Return the video list for the required show.""" | ||
videos = self.provider.get_catchup_videos(catchup_channel_id, article_id) | ||
directory_items = create_directory_items(videos) | ||
|
||
succeeded = xbmcplugin.addDirectoryItems(router.handle, directory_items, len(directory_items)) | ||
xbmcplugin.endOfDirectory(router.handle, succeeded) | ||
|
||
def play_video(self, video_id: str): | ||
"""Play catchup video.""" | ||
player = xbmc.Player() | ||
player.play(build_addon_url(f"/catchup-streams/{video_id}")) |
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
48 changes: 48 additions & 0 deletions
48
plugin.video.orange.fr/resources/lib/managers/stream_manager.py
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,48 @@ | ||
"""Video stream manager.""" | ||
|
||
import inputstreamhelper | ||
import xbmcgui | ||
import xbmcplugin | ||
|
||
from lib.providers import get_provider | ||
from lib.router import router | ||
from lib.utils.gui import create_video_item | ||
from lib.utils.kodi import localize, ok_dialog | ||
|
||
|
||
class StreamManager: | ||
"""Load streams based using active provider.""" | ||
|
||
def __init__(self): | ||
"""Initialize Stream Manager object.""" | ||
self.provider = get_provider() | ||
|
||
def load_live_stream(self, stream_id: str) -> xbmcgui.ListItem: | ||
"""Load live TV stream.""" | ||
stream_info = self.provider.get_live_stream_info(stream_id) | ||
if not stream_info: | ||
ok_dialog(localize(30900)) | ||
return | ||
|
||
is_helper = inputstreamhelper.Helper(stream_info["manifest_type"], drm=stream_info["drm"]) | ||
if not is_helper.check_inputstream(): | ||
ok_dialog(localize(30901)) | ||
return | ||
|
||
list_item = create_video_item(stream_info) | ||
xbmcplugin.setResolvedUrl(router.handle, True, list_item) | ||
|
||
def load_chatchup_stream(self, stream_id: str) -> xbmcgui.ListItem: | ||
"""Load catchup TV stream.""" | ||
stream_info = self.provider.get_catchup_stream_info(stream_id) | ||
if not stream_info: | ||
ok_dialog(localize(30900)) | ||
return | ||
|
||
is_helper = inputstreamhelper.Helper(stream_info["manifest_type"], drm=stream_info["drm"]) | ||
if not is_helper.check_inputstream(): | ||
ok_dialog(localize(30901)) | ||
return | ||
|
||
list_item = create_video_item(stream_info) | ||
xbmcplugin.setResolvedUrl(router.handle, True, list_item) |
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
Oops, something went wrong.