diff --git a/addon.xml b/addon.xml index dfc2833ad..7124a681d 100644 --- a/addon.xml +++ b/addon.xml @@ -1,20 +1,24 @@ - - - - - - - - - - video - - - - Watch videos from VRT NU - VRT NU is the video-on-demand platform of the Flemish public broadcaster (VRT). + + + + + + + + + + video + library/docu + library/movies + library/music + library/tvshows + + + + Watch videos from VRT NU + VRT NU is the video-on-demand platform of the Flemish public broadcaster (VRT). - Track the programs you like - List all videos alphabetically by program, category, channel or feature @@ -23,9 +27,9 @@ - Browse the online TV guides or search VRT NU [I]The VRT NU add-on is not endorsed by VRT, and is provided 'as is' without any warranty of any kind.[/I] - The VRT NU add-on is not endorsed by VRT, and is provided 'as is' without any warranty of any kind. - VRT NU videos bekijken. - VRT NU is het video-on-demand platform van de Vlaamse publieke omroep (VRT). + The VRT NU add-on is not endorsed by VRT, and is provided 'as is' without any warranty of any kind. + VRT NU videos bekijken. + VRT NU is het video-on-demand platform van de Vlaamse publieke omroep (VRT). - Volg je favoriete tv-programma's - Raadpleeg video's op basis van programma, categorie, kanaal of feature @@ -34,14 +38,14 @@ - Doorblader de online tv-gids of doorzoek VRT NU [I]Deze VRT NU add-on wordt niet ondersteund door de VRT, en wordt aangeboden 'as is', zonder enige garantie.[/I] - Deze VRT NU add-on wordt niet ondersteund door de VRT, en wordt aangeboden 'as is', zonder enige garantie. - en nl - all - GPL-3.0-only - https://www.facebook.com/kodivrtnu/ - https://github.com/add-ons/plugin.video.vrt.nu/wiki - https://github.com/add-ons/plugin.video.vrt.nu - + Deze VRT NU add-on wordt niet ondersteund door de VRT, en wordt aangeboden 'as is', zonder enige garantie. + en nl + all + GPL-3.0-only + https://www.facebook.com/kodivrtnu/ + https://github.com/add-ons/plugin.video.vrt.nu/wiki + https://github.com/add-ons/plugin.video.vrt.nu + v2.4.0 (2020-07-18) - Show error messages when connections fail - Improve user authentication cache @@ -80,15 +84,15 @@ v2.3.1 (2020-01-14) - Small fix for livestreams - Improvements to metadata handling specific to Kodi rendering - Support multiple YouTube links per channel - - - resources/media/icon.png - resources/media/fanart.png - resources/media/screenshot01.jpg - resources/media/screenshot02.jpg - resources/media/screenshot03.jpg - resources/media/screenshot04.jpg - - true - + + + resources/media/icon.png + resources/media/fanart.png + resources/media/screenshot01.jpg + resources/media/screenshot02.jpg + resources/media/screenshot03.jpg + resources/media/screenshot04.jpg + + true + diff --git a/resources/lib/addon.py b/resources/lib/addon.py index dade1256f..1a395a9ca 100644 --- a/resources/lib/addon.py +++ b/resources/lib/addon.py @@ -337,6 +337,38 @@ def iptv_epg(): IPTVManager(port).send_epg() +@plugin.route('/library/docu') +def library_docu(): + """Show docu listitems to be used as a Kodi source""" + from vrtplayer import VRTPlayer + VRTPlayer().show_favorites_docu_menu() + + +@plugin.route('/library/movies') +def library_movies(): + """Show movie listitems to be used as a Kodi source""" + from vrtplayer import VRTPlayer + VRTPlayer().show_library_movies() + + +@plugin.route('/library/music') +def library_music(): + """Show music listitems to be used as a Kodi source""" + from vrtplayer import VRTPlayer + VRTPlayer().show_favorites_music_menu() + + +@plugin.route('/library/tvshows') +@plugin.route('/library/tvshows/') +def library_tvshows(program=None): + """Show tvshow listitems to be used as a Kodi source""" + from vrtplayer import VRTPlayer + if program: + VRTPlayer().show_episodes_menu(program=program, season='allseasons') + else: + VRTPlayer().show_library_tvshows() + + @plugin.route('/update/repos') def update_repos(): """Force an update of the repositories""" diff --git a/resources/lib/apihelper.py b/resources/lib/apihelper.py index d9fb1ef0d..66654c09e 100644 --- a/resources/lib/apihelper.py +++ b/resources/lib/apihelper.py @@ -78,6 +78,7 @@ def list_tvshows(self, category=None, channel=None, feature=None, use_favorites= def tvshow_to_listitem(self, tvshow, program, cache_file): """Return a ListItem based on a Suggests API result""" + from addon import plugin label = self._metadata.get_label(tvshow) @@ -85,9 +86,15 @@ def tvshow_to_listitem(self, tvshow, program, cache_file): context_menu, favorite_marker, _ = self._metadata.get_context_menu(tvshow, program, cache_file) label += favorite_marker + # Support Kodi library source scanning + if plugin.path.startswith('/library'): + path = url_for('library_tvshows', program=program) + else: + path = url_for('programs', program=program) + return TitleItem( label=label, - path=url_for('programs', program=program), + path=path, art_dict=self._metadata.get_art(tvshow), info_dict=self._metadata.get_info_labels(tvshow), context_menu=context_menu, diff --git a/resources/lib/metadata.py b/resources/lib/metadata.py index e285d48c9..d78a500b0 100644 --- a/resources/lib/metadata.py +++ b/resources/lib/metadata.py @@ -187,6 +187,8 @@ def get_properties(self, api_data): """Get properties from single item json api data""" properties = {} + url = reformat_url(api_data.get('url', ''), 'medium') + # Only fill in properties when using VRT NU resumepoints because setting resumetime/totaltime breaks standard Kodi watched status if self._resumepoints.is_activated(): asset_id = self.get_asset_id(api_data) @@ -194,7 +196,6 @@ def get_properties(self, api_data): # We need to ensure forward slashes are quoted program_title = to_unicode(quote_plus(from_unicode(api_data.get('program')))) - url = reformat_url(api_data.get('url', ''), 'medium') properties.update(asset_id=asset_id, url=url, title=program_title) position = self._resumepoints.get_position(asset_id) @@ -214,6 +215,11 @@ def get_properties(self, api_data): if year: properties['year'] = year + from hashlib import md5 + message = md5() + message.update(url.encode('ascii')) + properties['hash'] = message.hexdigest().upper() + return properties @staticmethod @@ -626,6 +632,7 @@ def get_info_labels(self, api_data, season=False, date=None, channel=None): # VRT NU Suggest API if api_data.get('type') == 'program': info_labels = dict( + title=self.get_tvshowtitle(api_data), tvshowtitle=self.get_tvshowtitle(api_data), plot=self.get_plot(api_data), mediatype=self.get_mediatype(api_data, season=season), diff --git a/resources/lib/vrtplayer.py b/resources/lib/vrtplayer.py index 5a29eb81c..795a31620 100644 --- a/resources/lib/vrtplayer.py +++ b/resources/lib/vrtplayer.py @@ -192,6 +192,24 @@ def show_favorites_music_menu(self): episode_items, sort, ascending, content = self._apihelper.list_episodes(category='muziek', season='allseasons', programtype='oneoff') show_listing(episode_items, category=30046, sort=sort, ascending=ascending, content=content, cache=False) + def show_library_movies(self): + """Show movie listitems to be used as a Kodi source""" + docu_items = [] + music_items = [] + if get_setting_bool('library_include_docu', default=True): + docu_items, _, _, _ = self._apihelper.list_episodes(category='docu', season='allseasons', programtype='oneoff') + if get_setting_bool('library_include_music', default=True): + music_items, _, _, _ = self._apihelper.list_episodes(category='muziek', season='allseasons', programtype='oneoff') + movie_items, sort, _, _ = self._apihelper.list_episodes(category='films', season='allseasons', programtype='oneoff') + show_listing(movie_items + docu_items + music_items, sort=sort, content='movies') + + def show_library_tvshows(self): + """Show tvshow listitems to be used as a Kodi source""" + self._favorites.refresh(ttl=ttl('direct')) + self._resumepoints.refresh(ttl=ttl('direct')) + tvshow_items = self._apihelper.list_tvshows(use_favorites=get_setting_bool('library_use_favorites', default=True)) + show_listing(tvshow_items, sort='label', content='tvshows') + def show_tvshow_menu(self, use_favorites=False): """The VRT NU add-on 'All programs' listing menu""" # My favorites menus may need more up-to-date favorites