diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index c257544f7..54b1e0582 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -762,38 +762,54 @@ msgid "YouTube settings…" msgstr "" msgctxt "#30869" -msgid "Install Up Next add-on…" +msgid "Install Tubed add-on…" msgstr "" msgctxt "#30870" -msgid "This enables a Netflix style pop up notification for watching the next episode using the Up Next service add-on." +msgid "Show YouTube channel content in the Channels menu." msgstr "" msgctxt "#30871" -msgid "Enable Up Next integration" +msgid "Enable Tubed integration" msgstr "" msgctxt "#30873" +msgid "Tubed settings…" +msgstr "" + +msgctxt "#30875" +msgid "Install Up Next add-on…" +msgstr "" + +msgctxt "#30876" +msgid "This enables a Netflix style pop up notification for watching the next episode using the Up Next service add-on." +msgstr "" + +msgctxt "#30877" +msgid "Enable Up Next integration" +msgstr "" + +msgctxt "#30879" msgid "Up Next settings…" msgstr "" -msgctxt "#30874" +msgctxt "#30880" msgid "Open Up Next service add-on settings." msgstr "" -msgctxt "#30875" +msgctxt "#30881" msgid "Install IPTV Manager add-on…" msgstr "" -msgctxt "#30877" +msgctxt "#30883" msgid "Enable IPTV Manager integration" msgstr "" -msgctxt "#30879" +msgctxt "#30885" msgid "IPTV Manager settings…" msgstr "" -msgctxt "#30881" +msgctxt "#30887" msgid "Install PySocks library…" msgstr "" diff --git a/resources/language/resource.language.nl_nl/strings.po b/resources/language/resource.language.nl_nl/strings.po index 1969655c8..554531a48 100644 --- a/resources/language/resource.language.nl_nl/strings.po +++ b/resources/language/resource.language.nl_nl/strings.po @@ -762,38 +762,54 @@ msgid "YouTube settings…" msgstr "YouTube instellingen…" msgctxt "#30869" +msgid "Install Tubed add-on…" +msgstr "Installeer de Tubed add-on…" + +msgctxt "#30870" +msgid "Show YouTube channel content in the Channels menu." +msgstr "Toon YouTube kanaal video's in het Kanalen menu." + +msgctxt "#30871" +msgid "Enable Tubed integration" +msgstr "Activeer Tubed integratie" + +msgctxt "#30873" +msgid "Tubed settings…" +msgstr "Tubed instellingen…" + +msgctxt "#30875" msgid "Install Up Next add-on…" msgstr "Installeer de Up Next add-on…" -msgctxt "#30870" +msgctxt "#30876" msgid "This enables a Netflix style pop up notification for watching the next episode using the Up Next service add-on." msgstr "Dit activeert een pop-upmelding in Netflix-stijl voor het bekijken van de volgende aflevering met de service-add-up Up Next." -msgctxt "#30871" +msgctxt "#30877" msgid "Enable Up Next integration" msgstr "Activeer Up Next integratie" -msgctxt "#30873" +msgctxt "#30879" msgid "Up Next settings…" msgstr "Up Next instellingen…" -msgctxt "#30874" +msgctxt "#30880" msgid "Open Up Next service add-on settings." msgstr "Open de Up Next service add-on instellingen." -msgctxt "#30875" +msgctxt "#30881" msgid "Install IPTV Manager add-on…" msgstr "Installeer de IPTV Manager add-on…" -msgctxt "#30877" +msgctxt "#30883" msgid "Enable IPTV Manager integration" msgstr "Activeer IPTV Manager integratie" -msgctxt "#30879" +msgctxt "#30885" msgid "IPTV Manager settings…" msgstr "IPTV Manager instellingen…" -msgctxt "#30881" +msgctxt "#30887" msgid "Install PySocks library…" msgstr "Installeer de PySocks library…" diff --git a/resources/lib/apihelper.py b/resources/lib/apihelper.py index 35ed1d753..fbfdee021 100644 --- a/resources/lib/apihelper.py +++ b/resources/lib/apihelper.py @@ -13,11 +13,11 @@ from data import CHANNELS from helperobjects import TitleItem from kodiutils import (delete_cached_thumbnail, get_cache, get_cached_url_json, get_global_setting, - get_setting_bool, get_setting_int, get_url_json, has_addon, localize, - localize_from_data, log, ttl, update_cache, url_for) + get_setting_bool, get_setting_int, get_url_json, has_addon, kodi_version_major, localize, + localize_from_data, log, ttl, update_cache, url_for, youtube_to_plugin_url) from metadata import Metadata from utils import (add_https_proto, html_to_kodi, find_entry, from_unicode, play_url_to_id, - program_to_url, realpage, url_to_program, youtube_to_plugin_url) + program_to_url, realpage, url_to_program) class ApiHelper: @@ -735,8 +735,13 @@ def list_youtube(channels=None): youtube_items = [] - if not has_addon('plugin.video.youtube') or not get_setting_bool('showyoutube', default=True): - return youtube_items + if kodi_version_major() > 18: + if (not (has_addon('plugin.video.youtube') and get_setting_bool('showyoutube', default=True) + or has_addon('plugin.video.tubed') and get_setting_bool('showtubed', default=True))): + return youtube_items + else: + if not (has_addon('plugin.video.youtube') and get_setting_bool('showyoutube', default=True)): + return youtube_items for channel in CHANNELS: if channels and channel.get('name') not in channels: diff --git a/resources/lib/kodiutils.py b/resources/lib/kodiutils.py index 1eb2ce22f..6c6300704 100644 --- a/resources/lib/kodiutils.py +++ b/resources/lib/kodiutils.py @@ -150,6 +150,18 @@ def url_for(name, *args, **kwargs): return addon.plugin.url_for(getattr(addon, name), *args, **kwargs) +def youtube_to_plugin_url(url): + """Convert a YouTube URL to a Kodi plugin URL""" + if kodi_version_major() > 18 and has_addon('plugin.video.tubed'): + replace_str = 'plugin://plugin.video.tubed/' + else: + replace_str = 'plugin://plugin.video.youtube/' + url = url.replace('https://www.youtube.com/', replace_str) + if not url.endswith('/'): + url += '/' + return url + + def show_listing(list_items, category=None, sort='unsorted', ascending=True, content=None, cache=None, selected=None): """Show a virtual directory in Kodi""" from xbmcgui import ListItem diff --git a/resources/lib/utils.py b/resources/lib/utils.py index 062b25742..5772c9178 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -239,11 +239,3 @@ def realpage(page): def find_entry(dlist, key, value, default=None): """Find (the first) dictionary in a list where key matches value""" return next((entry for entry in dlist if entry.get(key) == value), default) - - -def youtube_to_plugin_url(url): - """Convert a YouTube URL to a Kodi plugin URL""" - url = url.replace('https://www.youtube.com/', 'plugin://plugin.video.youtube/') - if not url.endswith('/'): - url += '/' - return url diff --git a/resources/settings.xml b/resources/settings.xml index ebb942206..2a6ac6145 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -57,18 +57,22 @@ + + + + - - - + + + - - - + + + - + diff --git a/tests/test_settings.py b/tests/test_settings.py index d751198b9..7445de7e8 100644 --- a/tests/test_settings.py +++ b/tests/test_settings.py @@ -31,6 +31,7 @@ def tearDown(self): addon.settings['showfanart'] = True addon.settings['showoneoff'] = True addon.settings['showyoutube'] = True + addon.settings['showtubed'] = True addon.settings['usedrm'] = True addon.settings['usefavorites'] = True addon.settings['usehttpcaching'] = True @@ -88,6 +89,12 @@ def test_youtube_disabled(): addon.settings['showyoutube'] = False plugin.run(['plugin://plugin.video.vrt.nu/channels/radio1', '0', '']) + @staticmethod + def test_tubed_disabled(): + """Test with showtubed disabled""" + addon.settings['showtubed'] = False + plugin.run(['plugin://plugin.video.vrt.nu/channels/radio1', '0', '']) + @staticmethod def test_showfanart_disabled(): """Test with showfanart disabled""" diff --git a/tests/test_utils.py b/tests/test_utils.py index 8983c17fc..82913aaef 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -158,11 +158,6 @@ def test_find_entry(self): needle = utils.find_entry(haystack, 'foo', 'blah', dict(foo='f', bar='r', baz='z')) self.assertEqual(needle, dict(foo='f', bar='r', baz='z')) - def test_youtube_to_plugin_url(self): - """youtube_to_plugin_url""" - self.assertEqual('plugin://plugin.video.youtube/foo/bar/', utils.youtube_to_plugin_url('https://www.youtube.com/foo/bar')) - self.assertEqual('plugin://plugin.video.youtube/foo/bar/baz/', utils.youtube_to_plugin_url('https://www.youtube.com/foo/bar/baz/')) - if __name__ == '__main__': unittest.main() diff --git a/tests/userdata/addon_settings.json b/tests/userdata/addon_settings.json index 4e0b4b201..4d8e28882 100644 --- a/tests/userdata/addon_settings.json +++ b/tests/userdata/addon_settings.json @@ -31,6 +31,7 @@ "showpermalink": "true", "showsubtitles": "true", "showyoutube": "true", + "showtubed": "true", "sporza": "true", "stubru": "true", "usedrm": "true",