diff --git a/plugin.video.viwx/addon.xml b/plugin.video.viwx/addon.xml index 4f9e3ebbc..77aa3a250 100644 --- a/plugin.video.viwx/addon.xml +++ b/plugin.video.viwx/addon.xml @@ -1,5 +1,5 @@ - + @@ -8,7 +8,7 @@ - + video @@ -31,23 +31,9 @@ resources/fanart.png -[B]v1.7.2[/B] -[B]Fixes:[/B] -- In some cases, Kodi continued to run the previous version for a while after the add-on was updated. -- Short news clips fail to play in category News. -- Support live items without start and end time. - -[B]v 1.7.1[/B] -[B]Fixes:[/B] -- Short sport clips fail to play with error 'Not Found' - -[B]v 1.7.0[/B] -[B]New Features:[/B] -- Optional full HD streams - must be enabled in settings, off by default. - -[B]Fixes:[/B] -- Search with live items in the results failed. -- Some episode listings failed. +[B]v 1.7.4[/B] +- Fixed collection list was empty due to changes at ITVX. +- Re-enabled inputstream helper. true diff --git a/plugin.video.viwx/changelog.txt b/plugin.video.viwx/changelog.txt index ce77bfc0e..0d5b96381 100644 --- a/plugin.video.viwx/changelog.txt +++ b/plugin.video.viwx/changelog.txt @@ -1,3 +1,14 @@ +v 1.7.4 +Fixes: +- Collection list was empty, due to changes at ITVX. + +Changes: +- Re-enabled inputstream helper (undoing changes of 1.7.3 now that inputstreamhelper has been fixed). + +v 1.7.3 +Hotfix: +- Videos fail to play with the message: "Could not make the request. Your internet may be down." + v 1.7.2 Fixes: - In some cases, Kodi continued to run the previous version for a while after the add-on was updated. diff --git a/plugin.video.viwx/resources/lib/itvx.py b/plugin.video.viwx/resources/lib/itvx.py index 347d076bf..e32bb7ed6 100644 --- a/plugin.video.viwx/resources/lib/itvx.py +++ b/plugin.video.viwx/resources/lib/itvx.py @@ -3,7 +3,7 @@ # Copyright (c) 2022-2025 Dimitri Kroon. # This file is part of plugin.video.viwx. # SPDX-License-Identifier: GPL-2.0-or-later -# See LICENSE.txt +# See LICENSE.txt or https://www.gnu.org/licenses/gpl-2.0.txt # ---------------------------------------------------------------------------------------------------------------------- import time @@ -223,21 +223,16 @@ def collection_content(url=None, slider=None, hide_paid=False): return else: - # `slider` is the name of an editorialSlider. - # On the main page editorialSliders is a dict, on collection pages it is a list. - # Although a dict on the main page, the names of the sliders are not exactly the - # same as the keys of the dict. + # `slider` is the id of an editorialSlider. # Until now all editorial sliders on the main page have a 'view all' button, so # the contents of the slider itself should never be used, but better allow it # now in case it ever changes. - if is_main_page: - sliders_list = page_data['editorialSliders'].values() - else: - sliders_list = page_data['editorialSliders'] + sliders_list = page_data['editorialSliders'] items_list = None for slider_item in sliders_list: - if slider_item['collection']['sliderName'] == slider: - items_list = slider_item['collection']['shows'] + if slider_item['id'] == slider: + # Try to get the items form the main page or from a collections page. + items_list = slider_item.get('items') or slider_item['collection']['shows'] break if items_list is None: logger.error("Failed to parse collection content: Unknown slider '%s'", slider) diff --git a/plugin.video.viwx/resources/lib/main.py b/plugin.video.viwx/resources/lib/main.py index be236b077..7380df5ff 100644 --- a/plugin.video.viwx/resources/lib/main.py +++ b/plugin.video.viwx/resources/lib/main.py @@ -2,7 +2,7 @@ # Copyright (c) 2022-2025 Dimitri Kroon. # This file is part of plugin.video.viwx. # SPDX-License-Identifier: GPL-2.0-or-later -# See LICENSE.txt +# See LICENSE.txt or https://www.gnu.org/licenses/gpl-2.0.txt # ---------------------------------------------------------------------------------------------------------------------- import logging @@ -330,7 +330,7 @@ def list_collections(_): if item: yield Listitem.from_dict(list_collection_content, **item['show']) - for slider in main_page['editorialSliders'].values(): + for slider in main_page['editorialSliders']: item = parsex.parse_editorial_slider(url, slider) if item: yield Listitem.from_dict(list_collection_content, **item['show']) diff --git a/plugin.video.viwx/resources/lib/parsex.py b/plugin.video.viwx/resources/lib/parsex.py index a3cf9f259..4bd2f3a1f 100644 --- a/plugin.video.viwx/resources/lib/parsex.py +++ b/plugin.video.viwx/resources/lib/parsex.py @@ -3,7 +3,7 @@ # Copyright (c) 2022-2025 Dimitri Kroon. # This file is part of plugin.video.viwx. # SPDX-License-Identifier: GPL-2.0-or-later -# See LICENSE.txt +# See LICENSE.txt or https://www.gnu.org/licenses/gpl-2.0.txt # ---------------------------------------------------------------------------------------------------------------------- import json @@ -293,25 +293,34 @@ def parse_editorial_slider(url, slider_data): """Parse editorialSliders from the main page or from a collection.""" # noinspection PyBroadException try: - coll_data = slider_data['collection'] - if not coll_data.get('shows'): - # Has happened. Items without field `shows` have an invalid headingLink - return None - page_link = coll_data.get('headingLink') - base_url = 'https://www.itv.com/watch' - if page_link: - # Link to the collection's page if available - params = {'url': base_url + page_link['href']} + header = slider_data.get('header') + if header: + # slider from the main page + params = {'url': 'https://www.itv.com' + header['linkHref']} + title = header['title'] + else: - # Provide the slider name when the collection contents are the - # items in the slider on the original page. - slider_name = slider_data['collection']['sliderName'] - params = {'url': url, 'slider': slider_name} + # slider from a collection page + coll_data = slider_data['collection'] + if not coll_data.get('shows'): + # Has happened. Items without a field `shows` have an invalid headingLink + return None + title = coll_data['headingTitle'] + page_link = coll_data.get('headingLink') + base_url = 'https://www.itv.com/watch' + if page_link: + # Link to the collection's page if available + params = {'url': base_url + page_link['href']} + else: + # Provide the slider id when the collection contents are the + # items in the slider on the original page. + params = {'url': url, 'slider': slider_data['id']} return {'type': 'collection', - 'show': {'label': coll_data['headingTitle'], + 'show': {'label': title, 'params': params, - 'info': {'sorttitle': sort_title(coll_data['headingTitle'])}}} + 'info': {'sorttitle': sort_title(title), + }}} except: logger.error("Unexpected error parsing editorialSlider from %s", url, exc_info=True) return None @@ -499,19 +508,27 @@ def parse_item_type_collection(item_data): Only items from heroContent seem to have a field `ctaLabel`. """ - url = '/'.join(('https://www.itv.com/watch/collections', - item_data.get('titleSlug', ''), - item_data.get('collectionId') or item_data['pageId'])) + if 'href' in item_data: + # This is a new format found in the main page's editorial rails + url = 'https://www.itv.com' + item_data['href'] + else: + # A format still found on collection pages and hero rail. + url = '/'.join(('https://www.itv.com/watch/collections', + item_data.get('titleSlug', ''), + item_data.get('collectionId') or item_data['pageId'])) if item_data['contentType'] == 'page': # This querystring is required for page items url += '?ind' title = item_data['title'] - descr = '\n\n'.join(txt for txt in (item_data.get('ctaLabel', 'Collection'), item_data.get('description')) if txt) + descr = '\n\n'.join(txt for txt in (item_data.get('ctaLabel', 'Collection'), + item_data.get('description'), + item_data.get('subtitle')) if txt) + img_template = item_data.get('imageTemplate') or item_data['partnershipTileImageTemplate'] item = { 'label': title, - 'art': {'thumb': item_data['imageTemplate'].format(**IMG_PROPS_THUMB), - 'fanart': item_data['imageTemplate'].format(**IMG_PROPS_FANART)}, + 'art': {'thumb': img_template.format(**IMG_PROPS_THUMB), + 'fanart': img_template.format(**IMG_PROPS_FANART)}, 'info': {'title': '[B]{}[/B]'.format(title), 'plot': descr, 'sorttitle': sort_title(title)},