From 25acc7edd66a3fd4891d882a25324c327da1802d Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Sat, 18 May 2019 22:34:35 +0200 Subject: [PATCH] Add 'Install Widevine' settings option This PR enables the (re-)installation of Widevine. --- README.md | 8 +-- addon.py | 3 + addon.xml | 8 +-- .../resource.language.en_gb/strings.po | 40 +++++++++---- .../resource.language.nl_nl/strings.po | 60 +++++++++++++------ resources/lib/kodiwrappers/kodiwrapper.py | 22 ++++++- resources/lib/vrtplayer/__init__.py | 2 +- resources/lib/vrtplayer/favorites.py | 4 +- resources/settings.xml | 16 ++--- test/apihelpertests.py | 2 +- 10 files changed, 115 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index 476cf8539..34bce46c5 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,13 @@ [![Contributors](https://img.shields.io/github/contributors/pietje666/plugin.video.vrt.nu.svg)](https://github.com/pietje666/plugin.video.vrt.nu/graphs/contributors) [![Donate!](https://img.shields.io/static/v1.svg?label=&message=Donate!&color=lightgrey&logo=paypal)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6C58R2PNAWTNW&source=url) -# VRT NU Kodi addon +# VRT NU Kodi add-on **plugin.video.vrt.nu** is a [Kodi](https://kodi.tv/) add-on for watching all live video streams *and* all video-on-demand content available on [VRT NU](https://vrt.be/vrtnu/). VRT NU is the video-on-demand platform of VRT, Flanders' public broadcasting service. -This addon can be used to watch all video content from VRT NU. +This Kodi add-on can be used to watch all video content from VRT NU. - List all videos alphabetically by program or by category - Watch live streams from Eén, Canvas and Ketnet @@ -22,7 +22,7 @@ Some video content may be geo-blocked. **This project is not endorsed by VRT.** ## Installing -In Kodi, simply search for `VRT NU`, and install the add-on. +In Kodi, simply search for `VRT`, and install the VRT NU add-on. Alternatively, you can download a ZIP archive from the [GitHub releases](https://github.com/pietje666/plugin.video.vrt.nu/releases) and install it directly in Kodi using the **Install via Zip** option. @@ -41,7 +41,7 @@ have a VRT NU account and sign in with another method, it is easy to get a passw You will receive an email that allows you to set a password. Use this password to enter in the plugin when prompted. -For more information about the VRT NU Kodi addon, look at [our GitHub Wiki page](https://github.com/pietje666/plugin.video.vrt.nu/wiki). +For more information about the VRT NU Kodi add-on, look at [our GitHub Wiki page](https://github.com/pietje666/plugin.video.vrt.nu/wiki). ## Reporting issues You can report issues at [our GitHub project](https://github.com/pietje666/plugin.video.vrt.nu) or diff --git a/addon.py b/addon.py index 0420edd76..4c35c29be 100644 --- a/addon.py +++ b/addon.py @@ -39,6 +39,9 @@ def router(params_string): _tvguide = tvguide.TVGuide(_kodi) _tvguide.show_tvguide(params) return + if action == actions.INSTALL_WIDEVINE: + _kodi.install_widevine() + return from resources.lib.vrtplayer import favorites _favorites = favorites.Favorites(_kodi) diff --git a/addon.xml b/addon.xml index db3cd26c3..fdd64f8e7 100644 --- a/addon.xml +++ b/addon.xml @@ -18,25 +18,25 @@ Watch videos from VRT NU -This addon can be used to watch all video content from VRT NU. +This Kodi add-on can be used to watch all video content from VRT NU. - List all videos alphabetically by program or by category - Watch live streams from Eén, Canvas and Ketnet - Discover recently added content - Browse the online VRT TV guides -[B]This addon is not endorsed by VRT.[/B] +[B]This add-on is not endorsed by VRT.[/B] VRT NU videos bekijken. -Met deze addon kan je alle video streams van VRT NU bekijken. +Met deze Kodi add-on kan je alle video streams van VRT NU bekijken. - Raadpleeg alle videos alfabetisch geordend per programma of per categorie - Bekijk de livestreams van Eén, Canvas en Ketnet - Ontdekt recent toegevoegde videos - Doorblader de online VRT TV-gids -[B]Deze addon wordt niet ondersteund door de VRT.[/B] +[B]Deze add-on wordt niet ondersteund door de VRT.[/B] nl all diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index 93aae8151..55c3df3cc 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -263,7 +263,7 @@ msgid "Enable My programs" msgstr "" msgctxt "#30824" -msgid "When enabled, the user can follow their favourite programs and list these separately. In this case the VRT NU addon will download and update a list of your followed programs on the VRT NU website." +msgid "When enabled, the user can follow their favourite programs and list these separately. In this case the VRT NU add-on will download and update a list of your followed programs on the VRT NU website." msgstr "" msgctxt "#30825" @@ -322,20 +322,16 @@ msgctxt "#30850" msgid "In case you have limited bandwidth available, you may want to specify a maximum bandwidth so that a lower bitrate stream can be selected for playback." msgstr "" -msgctxt "#30859" -msgid "Cache" -msgstr "" - msgctxt "#30860" msgid "Troubleshooting" msgstr "" msgctxt "#30861" -msgid "InputStream Adaptive settings..." +msgid "Cache" msgstr "" msgctxt "#30863" -msgid "Install Widevine (for DRM content)" +msgid "Clear VRT tokens" msgstr "" msgctxt "#30865" @@ -343,21 +339,29 @@ msgid "Refresh favorites" msgstr "" msgctxt "#30867" -msgid "Clear VRT cookies" +msgid "Streaming" msgstr "" msgctxt "#30869" -msgid "Log level" +msgid "Use InputStream Adaptive" msgstr "" msgctxt "#30871" -msgid "Use InputStream Adaptive" +msgid "InputStream Adaptive settings..." msgstr "" msgctxt "#30873" +msgid "Install Widevine... [COLOR gray][I](needed for DRM content)[/I][/COLOR]" +msgstr "" + +msgctxt "#30875" msgid "Logging" msgstr "" +msgctxt "#30877" +msgid "Log level" +msgstr "" + ### MESSAGES msgctxt "#30951" @@ -391,3 +395,19 @@ msgstr "" msgctxt "#30961" msgid "Using a SOCKS proxy requires the PySocks library (script.module.pysocks) installed." msgstr "" + +msgctxt "#30971" +msgid "Install Widevine using 'InputStream Helper' add-on" +msgstr "" + +msgctxt "#30972" +msgid "Installing Widevine libraries using the 'InputStream Helper' add-on is done at your own risk and the VRT NU add-on is not responsible for any results. Nor is it guaranteed that Widevine will be installed correctly." +msgstr "" + +msgctxt "#30973" +msgid "Installation of Widevine failed!" +msgstr "" + +msgctxt "#30974" +msgid "Installation of Widevine completed!" +msgstr "" diff --git a/resources/language/resource.language.nl_nl/strings.po b/resources/language/resource.language.nl_nl/strings.po index 4be6c4d67..7f0568406 100644 --- a/resources/language/resource.language.nl_nl/strings.po +++ b/resources/language/resource.language.nl_nl/strings.po @@ -256,8 +256,8 @@ msgid "Enable My programs" msgstr "Toon Mijn tv-programma's" msgctxt "#30824" -msgid "When enabled, the user can follow their favourite programs and list these separately. In this case the VRT NU addon will download and update a list of your followed programs on the VRT NU website." -msgstr "Indien actief kan de gebruiker zijn favoriete programma's volgen en apart aanroepen. Dit zorgt er wel voor dat de VRT NU addon een lijst van favoriete programma's download en aanpast op de VRT NU website." +msgid "When enabled, the user can follow their favourite programs and list these separately. In this case the VRT NU add-on will download and update a list of your followed programs on the VRT NU website." +msgstr "Indien actief kan de gebruiker zijn favoriete programma's volgen en apart aanroepen. Dit zorgt er wel voor dat de VRT NU add-on een lijst van favoriete programma's download en aanpast op de VRT NU website." msgctxt "#30825" msgid "Show episode permalink in plot" @@ -299,38 +299,46 @@ msgctxt "#30849" msgid "Maximum bandwidth (kbps)" msgstr "Maximale bandbreedte (kbps)" -msgctxt "#30859" -msgid "Cache" -msgstr "Cache" - msgctxt "#30060" msgid "Troubleshooting" msgstr "Foutopsporing" -msgctxt "#30061" -msgid "InputStream Adaptive settings..." -msgstr "InputStream Adaptive instellingen..." +msgctxt "#30861" +msgid "Cache" +msgstr "Cache" msgctxt "#30063" -msgid "Install Widevine (for DRM content)" -msgstr "Installeer Widevine (voor DRM content)" +msgid "Clear VRT tokens" +msgstr "Verwijder VRT tokens" msgctxt "#30065" msgid "Refresh favorites" msgstr "Ververs gevolgde programma's" msgctxt "#30067" -msgid "Clear VRT tokens" -msgstr "Verwijder VRT tokens" - -msgctxt "#30069" -msgid "Log level" -msgstr "Log level" +msgid "Streaming" +msgstr "Streaming" -msgctxt "#30871" +msgctxt "#30869" msgid "Use InputStream Adaptive" msgstr "Gebruik InputStream Adaptive" +msgctxt "#30071" +msgid "InputStream Adaptive settings..." +msgstr "InputStream Adaptive instellingen..." + +msgctxt "#30073" +msgid "Install Widevine... [COLOR gray][I](needed for DRM content)[/I][/COLOR]" +msgstr "Installeer Widevine... [COLOR gray][I](nodig voor DRM content)[/I][/COLOR]" + +msgctxt "#30075" +msgid "Logging" +msgstr "Logboek" + +msgctxt "#30077" +msgid "Log level" +msgstr "Log level" + ### MESSAGES msgctxt "#30951" @@ -364,3 +372,19 @@ msgstr "Verhoog de maximale bandbreedte alstublieft. De maximale bandbreedte is msgctxt "#30961" msgid "Using a SOCKS proxy requires the PySocks library (script.module.pysocks) installed." msgstr "Het gebruik van SOCKS proxies vereist dat de PySocks library (script.module.pysocks) geïnstalleerd is." + +msgctxt "#30971" +msgid "Install Widevine using 'InputStream Helper' add-on" +msgstr "Installeer Widevine met de 'InputStream Helper' add-on" + +msgctxt "#30972" +msgid "Installing Widevine libraries using the 'InputStream Helper' add-on is done at your own risk and the VRT NU add-on is not responsible for any results. Nor is it guaranteed that Widevine will be (re)installed correctly." +msgstr "Het installeren van de Widevine bestanden met de 'InputStream Helper' add-on is op eigen risico en de VRT NU add-on is niet verantwoordelijk voor enig resultaat. Ook wordt het niet gegarandeerd dat Widevine succesvol kan worden geinstalleerd." + +msgctxt "#30973" +msgid "Installation of Widevine failed!" +msgstr "Widevine installatie mislukt!" + +msgctxt "#30974" +msgid "Installation of Widevine completed!" +msgstr "Widevine installatie gelukt" diff --git a/resources/lib/kodiwrappers/kodiwrapper.py b/resources/lib/kodiwrappers/kodiwrapper.py index 1b003673d..eb662e61d 100644 --- a/resources/lib/kodiwrappers/kodiwrapper.py +++ b/resources/lib/kodiwrappers/kodiwrapper.py @@ -108,6 +108,22 @@ def __init__(self, handle, url, addon): self._usemenucaching = self.get_setting('usemenucaching') == 'true' self._system_locale_works = self.set_locale() + def install_widevine(self): + import xbmcgui + ok = xbmcgui.Dialog().yesno(self.localize(30971), self.localize(30972)) + if not ok: + return + try: + import inputstreamhelper + is_helper = inputstreamhelper.Helper('mpd', drm='com.widevine.alpha') + if is_helper.check_inputstream(): + self.show_notification(heading=self.localize(30971), message=self.localize(30974), icon='info', time=5000) + else: + self.show_notification(heading=self.localize(30971), message=self.localize(30973), icon='error', time=5000) + except Exception: + self.show_notification(heading=self.localize(30971), message=self.localize(30973), icon='error', time=5000) + self.end_of_directory() + def show_listing(self, list_items, sort='unsorted', ascending=True, content=None, cache=None): import xbmcgui listing = [] @@ -213,9 +229,11 @@ def show_ok_dialog(self, title, message): title = self._addon.getAddonInfo('name') xbmcgui.Dialog().ok(title, message) - def show_notification(self, message, time=4000): + def show_notification(self, heading='', message='', icon='info', time=4000): import xbmcgui - xbmcgui.Dialog().notification(self._addon.getAddonInfo('name'), message, xbmcgui.NOTIFICATION_INFO, time) + if not heading: + heading = self._addon.getAddonInfo('name') + xbmcgui.Dialog().notification(heading=heading, message=message, icon=icon, time=time) def set_locale(self): import locale diff --git a/resources/lib/vrtplayer/__init__.py b/resources/lib/vrtplayer/__init__.py index e3412a41a..22c479783 100644 --- a/resources/lib/vrtplayer/__init__.py +++ b/resources/lib/vrtplayer/__init__.py @@ -116,9 +116,9 @@ class actions: - CLEAR_COOKIES = 'clearcookies' FOLLOW = 'follow' + INSTALL_WIDEVINE = 'installwidevine' LISTING_ALL_EPISODES = 'listingallepisodes' LISTING_AZ_TVSHOWS = 'listingaztvshows' LISTING_CATEGORIES = 'listingcategories' diff --git a/resources/lib/vrtplayer/favorites.py b/resources/lib/vrtplayer/favorites.py index d9dc05fa4..c563f7cb9 100644 --- a/resources/lib/vrtplayer/favorites.py +++ b/resources/lib/vrtplayer/favorites.py @@ -83,12 +83,12 @@ def is_favorite(self, path): return value def follow(self, program, path): - self._kodi.show_notification('Follow ' + program) + self._kodi.show_notification(message='Follow ' + program) self.set_favorite(program, path, True) self._kodi.container_refresh() def unfollow(self, program, path): - self._kodi.show_notification('Unfollow ' + program) + self._kodi.show_notification(message='Unfollow ' + program) self.set_favorite(program, path, False) self._kodi.container_refresh() diff --git a/resources/settings.xml b/resources/settings.xml index af09f21de..98abfcb7c 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -20,14 +20,14 @@ - - - + + - - - - - + + + + + + diff --git a/test/apihelpertests.py b/test/apihelpertests.py index 05ed7d4ca..be9fdf12b 100644 --- a/test/apihelpertests.py +++ b/test/apihelpertests.py @@ -28,7 +28,7 @@ class ApiHelperTests(unittest.TestCase): def test_get_api_data_single_season(self): title_items, sort, ascending, content = self._apihelper.get_episode_items(path='/vrtnu/a-z/het-journaal.relevant/') - self.assertTrue(122 < len(title_items) < 130, 'We got %s items instead.' % len(title_items)) + self.assertTrue(121 < len(title_items) < 130, 'We got %s items instead.' % len(title_items)) self.assertEqual(sort, 'dateadded') self.assertFalse(ascending) self.assertEqual(content, 'episodes')