add-ons / add-ons/plugin.video.vrt.nu

VRT MAX addon fails with current VRT API and Python 3.12

Open Beginner friendly
#1,345 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
125
Forks
27
Avg merge
3h 46m
Merged PRs (30d)
12

Description

VRT MAX addon fails with current VRT API and Python 3.12

Description

The current VRT MAX API changes appear to have broken the addon.

With the latest GitHub master version of the addon, the GraphQL/API errors are resolved, but opening a program's episode list results in a Python exception.

Environment
  • Ubuntu 24.04
  • Kodi 21.3
  • Python 3.12.3
  • VRT MAX addon: 2.5.50+matrix.1 from current GitHub master
  • script.module.dateutil: 2.8.2
Error

When opening the episodes of a program:

Error Type: <class 'TypeError'>
Error Contents: descriptor '__init__' requires a 'int' object but received a 'State'

Traceback (most recent call last):
  File ".../plugin.video.vrt.nu/resources/lib/vrtplayer.py", line 213, in show_episodes_menu
    episodes, sort, ascending, content = get_episodes(...)
  File ".../plugin.video.vrt.nu/resources/lib/api.py", line 3192, in get_episodes
    seasons = convert_seasons(api_data, program_name)
  File ".../plugin.video.vrt.nu/resources/lib/api.py", line 3232, in convert_seasons
    _, _, _, title_item = convert_episode(episode_tile)
  File ".../plugin.video.vrt.nu/resources/lib/api.py", line 2748, in convert_episode
    start_dt = datetime.strptime(value, fmt)
  File "/usr/lib/python3.12/_strptime.py", line 554, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/lib/python3.12/_strptime.py", line 317, in _strptime
    format_regex = _TimeRE_cache.compile(format)
  File "/usr/lib/python3.12/_strptime.py", line 263, in compile
    return re_compile(self.pattern(format), IGNORECASE)
  ...
  File "/usr/lib/python3.12/re/_parser.py", line 975, in parse
    state = State()
TypeError: descriptor '__init__' requires a 'int' object but received a 'State'
Reproduction
  1. Install the current GitHub master version.
  2. Open VRT MAX.
  3. Select a program.
  4. Open its episodes.
  5. The addon crashes while converting the episode metadata.

The failing code is currently:

date_part = aired.split()[1]
fmt = '%d/%m/%Y' if date_part.count('/') == 2 else '%d/%m/%Y'
value = date_part if date_part.count('/') == 2 else f'{date_part}/{now.year}'
start_dt = datetime.strptime(value, fmt)

Interestingly, the exact same datetime.strptime() operation works normally in the system Python 3.12.3 interpreter.

Workaround

Changing:

start_dt = datetime.strptime(value, fmt)

to:

start_dt = dateutil.parser.parse(value)

fixes the problem on my system and allows the episode list to open normally.

The addon already depends on python-dateutil, so this seems like a relatively simple workaround.

The earlier GraphQL errors involving ClientDrivenAction, ProgramTile.program, EpisodeTile.episode, and Episode were also resolved by using the current GitHub master code.

Thanks for maintaining the addon!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in resources/lib/api.py at convert_episode around the datetime.strptime call shown in the traceback, then review the existing python-dateutil dependency and the date conversion inputs. Reproduce by opening a program's episode list under Python 3.12, and confirm that episode metadata loads without the exception and that the existing date handling remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.