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
- Install the current GitHub
master version.
- Open VRT MAX.
- Select a program.
- Open its episodes.
- 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!
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
masterversion of the addon, the GraphQL/API errors are resolved, but opening a program's episode list results in a Python exception.Environment
2.5.50+matrix.1from current GitHubmasterscript.module.dateutil: 2.8.2Error
When opening the episodes of a program:
Reproduction
masterversion.The failing code is currently:
Interestingly, the exact same
datetime.strptime()operation works normally in the system Python 3.12.3 interpreter.Workaround
Changing:
to:
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, andEpisodewere also resolved by using the current GitHubmastercode.Thanks for maintaining the addon!