Skip to content

Commit

Permalink
Add 'Install Widevine' settings option
Browse files Browse the repository at this point in the history
This PR enables the (re-)installation of Widevine.
  • Loading branch information
dagwieers committed May 18, 2019
1 parent 3f0593a commit a5207db
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 51 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions addon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,25 @@
<extension point="xbmc.addon.metadata">
<summary lang="en_GB">Watch videos from VRT NU</summary>
<description lang="en_GB">
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]
</description>
<summary lang="nl_NL">VRT NU videos bekijken.</summary>
<description lang="nl_NL">
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]
</description>
<language>nl</language>
<platform>all</platform>
Expand Down
40 changes: 30 additions & 10 deletions resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -322,42 +322,46 @@ 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"
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"
Expand Down Expand Up @@ -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 ""
60 changes: 42 additions & 18 deletions resources/language/resource.language.nl_nl/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
22 changes: 20 additions & 2 deletions resources/lib/kodiwrappers/kodiwrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion resources/lib/vrtplayer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions resources/lib/vrtplayer/favorites.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion resources/lib/vrtplayer/vrtapihelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def get_episode_items(self, path=None, page=None, all_seasons=False, filtered=Fa
if variety == 'offline':
from datetime import datetime
import dateutil.tz
params['facets[assetOffTime]'] = datetime.now(dateutil.tz.tzlocal()).strftime('%Y-%m-%d')
params['facets[assetOffTime]'] = datetime.now(dateutil.tz.gettz('Europe/Brussels')).strftime('%Y-%m-%d')

if statichelper.is_filtered(filtered):
params['facets[programName]'] = '[%s]' % (','.join(self._favorites.names()))
Expand Down
16 changes: 8 additions & 8 deletions resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
<setting label="30849" help="30850" type="select" id="max_bandwidth" default="0" values="0|256|512|1024|1536|2048|2560|3072|4096|6144|8192|10240|15360|20480|25600|30720"/>
</category>
<category label="30860"> <!-- Troubleshooting -->
<setting label="30859" type="lsep"/> <!-- Cache -->
<!-- setting label="30863" help="30864" type="action" id="widevine_install" option="close" action="RunPlugin(plugin://plugin.video.vrt.nu?action=installwidevine)" enable="System.HasAddon(script.module.inputstreamhelper)"/ -->
<setting label="30867" help="30868" type="action" id="clear_tokens" action="RunPlugin(plugin://plugin.video.vrt.nu/?action=clearcookies)"/>
<setting label="30861" type="lsep"/> <!-- Cache -->
<setting label="30863" help="30864" type="action" id="clear_tokens" action="RunPlugin(plugin://plugin.video.vrt.nu/?action=clearcookies)"/>
<setting label="30865" help="30866" type="action" id="refresh_favorites" action="RunPlugin(plugin://plugin.video.vrt.nu/?action=refreshfavorites)"/>
<setting label="30845" type="lsep"/> <!-- InputStream Adaptive -->
<setting label="30871" help="30872" type="bool" id="useinputstreamadaptive" default="true" visible="System.HasAddon(inputstream.adaptive)"/>
<setting label="30861" help="30862" type="action" id="adaptive_settings" option="close" action="Addon.OpenSettings(inputstream.adaptive)" visible="System.HasAddon(inputstream.adaptive)" enable="eq(-1,true)" subsetting="true"/>
<setting label="30873" type="lsep"/> <!-- Logging -->
<setting label="30869" help="30870" type="select" id="max_log_level" values="Quiet|Info|Verbose|Debug" default="Info"/>
<setting label="30867" type="lsep"/> <!-- InputStream Adaptive -->
<setting label="30869" help="30870" type="bool" id="useinputstreamadaptive" default="true" visible="System.HasAddon(inputstream.adaptive)"/>
<setting label="30871" help="30872" type="action" id="adaptive_settings" option="close" action="Addon.OpenSettings(inputstream.adaptive)" visible="System.HasAddon(inputstream.adaptive)" enable="eq(-1,true)" subsetting="true"/>
<setting label="30873" help="30874" type="action" id="widevine_install" option="close" action="RunPlugin(plugin://plugin.video.vrt.nu?action=installwidevine)" visible="System.HasAddon(inputstream.adaptive)" enable="eq(-2,true)" subsetting="true"/>
<setting label="30875" type="lsep"/> <!-- Logging -->
<setting label="30877" help="30878" type="select" id="max_log_level" values="Quiet|Info|Verbose|Debug" default="Info"/>
</category>
</settings>
2 changes: 1 addition & 1 deletion test/apihelpertests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit a5207db

Please sign in to comment.