From c03cddef7622d6e1e7718f91dacf43c96674bd77 Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Sun, 23 Sep 2018 03:03:31 -0500 Subject: [PATCH] Add live tv support --- resources/lib/emby/core/api.py | 7 +++++++ resources/lib/entrypoint/default.py | 2 ++ resources/lib/monitor.py | 9 +++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/resources/lib/emby/core/api.py b/resources/lib/emby/core/api.py index 14686430..bf188324 100644 --- a/resources/lib/emby/core/api.py +++ b/resources/lib/emby/core/api.py @@ -183,6 +183,13 @@ def get_items_by_letter(parent_id=None, media=None, letter=None): 'IncludeItemTypes': media }) +def get_channels(): + return _get("LiveTv/Channels", { + 'UserId': "{UserId}", + 'EnableImages': True, + 'EnableUserData': True + }) + def get_intros(item_id): return user_items("/%s/Intros" % item_id) diff --git a/resources/lib/entrypoint/default.py b/resources/lib/entrypoint/default.py index 614a5755..4d9ac4ff 100644 --- a/resources/lib/entrypoint/default.py +++ b/resources/lib/entrypoint/default.py @@ -256,6 +256,8 @@ def browse(media, view_id=None, folder=None, server_id=None): listing = TheVoid('RecentlyAdded', {'Id': view_id, 'ServerId': server_id}).get() elif folder == 'genres': listing = TheVoid('Genres', {'Id': view_id, 'ServerId': server_id}).get() + elif media == 'livetv': + listing = TheVoid('LiveTV', {'Id': view_id, 'ServerId': server_id}).get() elif folder == 'unwatched': listing = TheVoid('Browse', {'Id': view_id, 'ServerId': server_id, 'Filters': ['IsUnplayed']}).get() elif folder == 'favorite': diff --git a/resources/lib/monitor.py b/resources/lib/monitor.py index f979107b..c26b0b1b 100644 --- a/resources/lib/monitor.py +++ b/resources/lib/monitor.py @@ -56,7 +56,7 @@ class Monitor(xbmc.Monitor): 'PlayPlaylist', 'Play', 'GetIntros', 'GetAdditionalParts', 'RefreshItem', 'Genres', 'FavoriteItem', 'DeleteItem', 'AddUser', 'GetSession', 'GetUsers', 'GetThemes', 'GetTheme', 'Playstate', 'GeneralCommand', 'GetTranscodeOptions', 'RecentlyAdded', - 'BrowseSeason'): + 'BrowseSeason', 'LiveTV', 'GetLiveStream'): return data = json.loads(data)[0] @@ -119,7 +119,7 @@ class Monitor(xbmc.Monitor): elif method == 'GetLiveStream': - sources = server['api'].get_play_info(data['Id'], data['PlaySessionId'], data['Token'], data['Profile']) + sources = server['api'].get_live_stream(data['Id'], data['PlaySessionId'], data['Token'], data['Profile']) self.void_responder(data, sources) elif method == 'GetToken': @@ -168,6 +168,11 @@ class Monitor(xbmc.Monitor): result = server['api'].get_seasons(data['Id']) self.void_responder(data, result) + elif method == 'LiveTV': + + result = server['api'].get_channels() + self.void_responder(data, result) + elif method == 'RecentlyAdded': result = server['api'].get_recently_added(data.get('Media'), data.get('Id'), data.get('Limit'))