Skip to content

Commit 5f709ac

Browse files
authored
Merge pull request #4715 from dimkroon/matrix-viwx-174
[plugin.video.viwx] v1.7.4
2 parents 55ff135 + 5422e68 commit 5f709ac

File tree

5 files changed

+63
-54
lines changed

5 files changed

+63
-54
lines changed

plugin.video.viwx/addon.xml

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2-
<addon id="plugin.video.viwx" name="viwX" version="1.7.2" provider-name="Dimitri Kroon">
2+
<addon id="plugin.video.viwx" name="viwX" version="1.7.4" provider-name="Dimitri Kroon">
33
<requires>
44
<import addon="xbmc.python" version="3.0.0"/>
55
<import addon="inputstream.adaptive" version="19.0.5"/>
@@ -8,7 +8,7 @@
88
<import addon="script.module.tzdata" version="0.2.1"/>
99
<import addon="script.module.tzlocal" version="5.0.1"/>
1010
<import addon="script.module.codequick" version="1.0.3"/>
11-
<import addon="script.module.inputstreamhelper" version="0.6.1"/>
11+
<import addon="script.module.inputstreamhelper" version="0.8.3"/>
1212
</requires>
1313
<extension point="xbmc.python.pluginsource" library="addon.py">
1414
<provides>video</provides>
@@ -31,23 +31,9 @@
3131
<fanart>resources/fanart.png</fanart>
3232
</assets>
3333
<news>
34-
[B]v1.7.2[/B]
35-
[B]Fixes:[/B]
36-
- In some cases, Kodi continued to run the previous version for a while after the add-on was updated.
37-
- Short news clips fail to play in category News.
38-
- Support live items without start and end time.
39-
40-
[B]v 1.7.1[/B]
41-
[B]Fixes:[/B]
42-
- Short sport clips fail to play with error 'Not Found'
43-
44-
[B]v 1.7.0[/B]
45-
[B]New Features:[/B]
46-
- Optional full HD streams - must be enabled in settings, off by default.
47-
48-
[B]Fixes:[/B]
49-
- Search with live items in the results failed.
50-
- Some episode listings failed.
34+
[B]v 1.7.4[/B]
35+
- Fixed collection list was empty due to changes at ITVX.
36+
- Re-enabled inputstream helper.
5137
</news>
5238
<reuselanguageinvoker>true</reuselanguageinvoker>
5339
</extension>

plugin.video.viwx/changelog.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
v 1.7.4
2+
Fixes:
3+
- Collection list was empty, due to changes at ITVX.
4+
5+
Changes:
6+
- Re-enabled inputstream helper (undoing changes of 1.7.3 now that inputstreamhelper has been fixed).
7+
8+
v 1.7.3
9+
Hotfix:
10+
- Videos fail to play with the message: "Could not make the request. Your internet may be down."
11+
112
v 1.7.2
213
Fixes:
314
- In some cases, Kodi continued to run the previous version for a while after the add-on was updated.

plugin.video.viwx/resources/lib/itvx.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright (c) 2022-2025 Dimitri Kroon.
44
# This file is part of plugin.video.viwx.
55
# SPDX-License-Identifier: GPL-2.0-or-later
6-
# See LICENSE.txt
6+
# See LICENSE.txt or https://www.gnu.org/licenses/gpl-2.0.txt
77
# ----------------------------------------------------------------------------------------------------------------------
88

99
import time
@@ -223,21 +223,16 @@ def collection_content(url=None, slider=None, hide_paid=False):
223223
return
224224

225225
else:
226-
# `slider` is the name of an editorialSlider.
227-
# On the main page editorialSliders is a dict, on collection pages it is a list.
228-
# Although a dict on the main page, the names of the sliders are not exactly the
229-
# same as the keys of the dict.
226+
# `slider` is the id of an editorialSlider.
230227
# Until now all editorial sliders on the main page have a 'view all' button, so
231228
# the contents of the slider itself should never be used, but better allow it
232229
# now in case it ever changes.
233-
if is_main_page:
234-
sliders_list = page_data['editorialSliders'].values()
235-
else:
236-
sliders_list = page_data['editorialSliders']
230+
sliders_list = page_data['editorialSliders']
237231
items_list = None
238232
for slider_item in sliders_list:
239-
if slider_item['collection']['sliderName'] == slider:
240-
items_list = slider_item['collection']['shows']
233+
if slider_item['id'] == slider:
234+
# Try to get the items form the main page or from a collections page.
235+
items_list = slider_item.get('items') or slider_item['collection']['shows']
241236
break
242237
if items_list is None:
243238
logger.error("Failed to parse collection content: Unknown slider '%s'", slider)

plugin.video.viwx/resources/lib/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2022-2025 Dimitri Kroon.
33
# This file is part of plugin.video.viwx.
44
# SPDX-License-Identifier: GPL-2.0-or-later
5-
# See LICENSE.txt
5+
# See LICENSE.txt or https://www.gnu.org/licenses/gpl-2.0.txt
66
# ----------------------------------------------------------------------------------------------------------------------
77

88
import logging
@@ -330,7 +330,7 @@ def list_collections(_):
330330
if item:
331331
yield Listitem.from_dict(list_collection_content, **item['show'])
332332

333-
for slider in main_page['editorialSliders'].values():
333+
for slider in main_page['editorialSliders']:
334334
item = parsex.parse_editorial_slider(url, slider)
335335
if item:
336336
yield Listitem.from_dict(list_collection_content, **item['show'])

plugin.video.viwx/resources/lib/parsex.py

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright (c) 2022-2025 Dimitri Kroon.
44
# This file is part of plugin.video.viwx.
55
# SPDX-License-Identifier: GPL-2.0-or-later
6-
# See LICENSE.txt
6+
# See LICENSE.txt or https://www.gnu.org/licenses/gpl-2.0.txt
77
# ----------------------------------------------------------------------------------------------------------------------
88

99
import json
@@ -293,25 +293,34 @@ def parse_editorial_slider(url, slider_data):
293293
"""Parse editorialSliders from the main page or from a collection."""
294294
# noinspection PyBroadException
295295
try:
296-
coll_data = slider_data['collection']
297-
if not coll_data.get('shows'):
298-
# Has happened. Items without field `shows` have an invalid headingLink
299-
return None
300-
page_link = coll_data.get('headingLink')
301-
base_url = 'https://www.itv.com/watch'
302-
if page_link:
303-
# Link to the collection's page if available
304-
params = {'url': base_url + page_link['href']}
296+
header = slider_data.get('header')
297+
if header:
298+
# slider from the main page
299+
params = {'url': 'https://www.itv.com' + header['linkHref']}
300+
title = header['title']
301+
305302
else:
306-
# Provide the slider name when the collection contents are the
307-
# items in the slider on the original page.
308-
slider_name = slider_data['collection']['sliderName']
309-
params = {'url': url, 'slider': slider_name}
303+
# slider from a collection page
304+
coll_data = slider_data['collection']
305+
if not coll_data.get('shows'):
306+
# Has happened. Items without a field `shows` have an invalid headingLink
307+
return None
308+
title = coll_data['headingTitle']
309+
page_link = coll_data.get('headingLink')
310+
base_url = 'https://www.itv.com/watch'
311+
if page_link:
312+
# Link to the collection's page if available
313+
params = {'url': base_url + page_link['href']}
314+
else:
315+
# Provide the slider id when the collection contents are the
316+
# items in the slider on the original page.
317+
params = {'url': url, 'slider': slider_data['id']}
310318

311319
return {'type': 'collection',
312-
'show': {'label': coll_data['headingTitle'],
320+
'show': {'label': title,
313321
'params': params,
314-
'info': {'sorttitle': sort_title(coll_data['headingTitle'])}}}
322+
'info': {'sorttitle': sort_title(title),
323+
}}}
315324
except:
316325
logger.error("Unexpected error parsing editorialSlider from %s", url, exc_info=True)
317326
return None
@@ -499,19 +508,27 @@ def parse_item_type_collection(item_data):
499508
Only items from heroContent seem to have a field `ctaLabel`.
500509
501510
"""
502-
url = '/'.join(('https://www.itv.com/watch/collections',
503-
item_data.get('titleSlug', ''),
504-
item_data.get('collectionId') or item_data['pageId']))
511+
if 'href' in item_data:
512+
# This is a new format found in the main page's editorial rails
513+
url = 'https://www.itv.com' + item_data['href']
514+
else:
515+
# A format still found on collection pages and hero rail.
516+
url = '/'.join(('https://www.itv.com/watch/collections',
517+
item_data.get('titleSlug', ''),
518+
item_data.get('collectionId') or item_data['pageId']))
505519
if item_data['contentType'] == 'page':
506520
# This querystring is required for page items
507521
url += '?ind'
508522

509523
title = item_data['title']
510-
descr = '\n\n'.join(txt for txt in (item_data.get('ctaLabel', 'Collection'), item_data.get('description')) if txt)
524+
descr = '\n\n'.join(txt for txt in (item_data.get('ctaLabel', 'Collection'),
525+
item_data.get('description'),
526+
item_data.get('subtitle')) if txt)
527+
img_template = item_data.get('imageTemplate') or item_data['partnershipTileImageTemplate']
511528
item = {
512529
'label': title,
513-
'art': {'thumb': item_data['imageTemplate'].format(**IMG_PROPS_THUMB),
514-
'fanart': item_data['imageTemplate'].format(**IMG_PROPS_FANART)},
530+
'art': {'thumb': img_template.format(**IMG_PROPS_THUMB),
531+
'fanart': img_template.format(**IMG_PROPS_FANART)},
515532
'info': {'title': '[B]{}[/B]'.format(title),
516533
'plot': descr,
517534
'sorttitle': sort_title(title)},

0 commit comments

Comments
 (0)