Skip to content

Commit

Permalink
Include list of channels
Browse files Browse the repository at this point in the history
A central database of all channels is very useful, and opens up the
possibility to fall back when web scraping fails.

It also makes it possible to start adding audio streams, or studio
translations.
  • Loading branch information
dagwieers committed May 1, 2019
1 parent 6e8df5a commit 4df1292
Show file tree
Hide file tree
Showing 13 changed files with 456 additions and 164 deletions.
18 changes: 8 additions & 10 deletions addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ def router(params_string):
addon = xbmcaddon.Addon()
kodi_wrapper = kodiwrapper.KodiWrapper(_ADDON_HANDLE, _ADDON_URL, addon)
token_resolver = tokenresolver.TokenResolver(kodi_wrapper)
stream_service = streamservice.StreamService(vrtplayer.VRTPlayer.VRT_BASE,
vrtplayer.VRTPlayer.VRTNU_BASE_URL,
kodi_wrapper, token_resolver)
stream_service = streamservice.StreamService(kodi_wrapper, token_resolver)
api_helper = vrtapihelper.VRTApiHelper(kodi_wrapper)
vrt_player = vrtplayer.VRTPlayer(addon.getAddonInfo('path'), kodi_wrapper, stream_service, api_helper)
params = dict(parse_qsl(params_string))
content_type = params.get('content_type')
action = params.get('action')
if action == actions.LISTING_AZ_TVSHOWS:
vrt_player.show_tvshow_menu_items(path=None)
Expand All @@ -39,19 +38,18 @@ def router(params_string):
elif action == actions.LISTING_LIVE:
vrt_player.show_livestream_items()
elif action == actions.LISTING_EPISODES:
vrt_player.show_episodes(params.get('video_url'))
vrt_player.show_episodes(path=params.get('video_url'))
elif action == actions.LISTING_CATEGORY_TVSHOWS:
vrt_player.show_tvshow_menu_items(path=params.get('video_url'))
elif action == actions.LISTING_TVGUIDE:
tv_guide = tvguide.TVGuide(addon.getAddonInfo('path'), kodi_wrapper)
tv_guide.show_tvguide(params)
elif action == actions.PLAY:
video = dict(
video_url=params.get('video_url'),
video_id=params.get('video_id'),
publication_id=params.get('publication_id'),
)
vrt_player.play(video)
vrt_player.play(params)
elif action == actions.PLAY_RADIO:
vrt_player.play_radio(params)
elif content_type == 'audio':
vrt_player.show_radio_menu_items()
else:
vrt_player.show_main_menu_items()

Expand Down
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</requires>

<extension point="xbmc.python.pluginsource" library="addon.py">
<provides>video</provides>
<provides>video audio</provides>
</extension>
<extension point="xbmc.service" library="service.py"/>
<extension point="xbmc.addon.metadata">
Expand Down
32 changes: 4 additions & 28 deletions resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -132,36 +132,12 @@ msgid "Episode"
msgstr "Episode"

msgctxt "#32101"
msgid "Eén live"
msgstr "Eén live"
msgid "%s live"
msgstr "%s live"

msgctxt "#32102"
msgid "Watch Eén live TV stream (via Internet)"
msgstr "Watch Eén live TV stream (via Internet)"

msgctxt "#32111"
msgid "Canvas live"
msgstr "Canvas live"

msgctxt "#32112"
msgid "Watch Canvas live TV stream (via Internet)"
msgstr "Watch Canvas live TV stream (via Internet)"

msgctxt "#32121"
msgid "Ketnet live"
msgstr "Ketnet live"

msgctxt "#32122"
msgid "Watch Ketnet live TV stream (via Internet)"
msgstr "Watch Ketnet live TV stream (via Internet)"

msgctxt "#32131"
msgid "Sporza live"
msgstr "Sporza live"

msgctxt "#32132"
msgid "Watch Sporza live TV stream (via Internet)"
msgstr "Watch Sporza live TV stream via (Internet)"
msgid "Watch %s live TV stream (via Internet)"
msgstr "Watch %s live TV stream (via Internet)"

msgctxt "#32201"
msgid "[B][COLOR red]Geo-blocked[/COLOR][/B]\n"
Expand Down
32 changes: 4 additions & 28 deletions resources/language/resource.language.nl_nl/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -133,36 +133,12 @@ msgid "Episode"
msgstr "Aflevering"

msgctxt "#32101"
msgid "Eén live"
msgstr "Eén live"
msgid "%s live"
msgstr "%s live"

msgctxt "#32102"
msgid "Watch Eén live TV stream (via Internet)"
msgstr "Bekijk Eén live tv stream (via Internet)"

msgctxt "#32111"
msgid "Canvas live"
msgstr "Canvas live"

msgctxt "#32112"
msgid "Watch Canvas live TV stream (via Internet)"
msgstr "Bekijk Canvas live tv stream (via Internet)"

msgctxt "#32121"
msgid "Ketnet live"
msgstr "Ketnet live"

msgctxt "#32122"
msgid "Watch Ketnet live TV stream (via Internet)"
msgstr "Bekijk Ketnet live tv stream (via Internet)"

msgctxt "#32131"
msgid "Sporza live"
msgstr "Sporza live"

msgctxt "#32132"
msgid "Watch Sporza live TV stream (via Internet)"
msgstr "Bekijk Sporza live tv stream (via Internet)"
msgid "Watch %s live TV stream (via Internet)"
msgstr "Bekijk %s live tv stream (via Internet)"

msgctxt "#32201"
msgid "[B][COLOR red]Geo-blocked[/COLOR][/B]\n"
Expand Down
11 changes: 9 additions & 2 deletions resources/lib/kodiwrappers/kodiwrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(self, handle, url, addon):
self._addon = addon
self._addon_id = addon.getAddonInfo('id')

def show_listing(self, list_items, sort='unsorted', ascending=True, content_type='episodes', cache=True):
def show_listing(self, list_items, sort='unsorted', ascending=True, content_type='episodes', list_type='video', cache=True):
listing = []

xbmcplugin.setContent(self._handle, content=content_type)
Expand Down Expand Up @@ -90,7 +90,7 @@ def show_listing(self, list_items, sort='unsorted', ascending=True, content_type
list_item.setArt(title_item.art_dict)

if title_item.video_dict:
list_item.setInfo('video', infoLabels=title_item.video_dict)
list_item.setInfo(type=list_type, infoLabels=title_item.video_dict)

listing.append((url, list_item, not title_item.is_playable))

Expand Down Expand Up @@ -121,6 +121,13 @@ def play(self, video):
xbmc.sleep(100)
xbmc.Player().showSubtitles(subtitles_visible)

def play_radio(self, stream):
xbmc.Player().play(stream)
play_item = xbmcgui.ListItem(path=stream)
xbmcplugin.setResolvedUrl(self._handle, True, listitem=play_item)
while not xbmc.Player().isPlaying() and not xbmc.Monitor().abortRequested():
xbmc.sleep(100)

def show_ok_dialog(self, title, message):
xbmcgui.Dialog().ok(self._addon.getAddonInfo('name'), title, message)

Expand Down
Loading

0 comments on commit 4df1292

Please sign in to comment.