Kodi Community Forum
Changes to the python API (and addon structure) for Kodi Matrix (v19) - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Changes to the python API (and addon structure) for Kodi Matrix (v19) (/showthread.php?tid=344263)

Pages: 1 2


RE: Changes to the python API (and addon structure) for Kodi Matrix (v19) - enen92 - 2021-08-23

I think the best source of info is the original PR: https://github.com/xbmc/xbmc/pull/19459#issuecomment-806450382


RE: Changes to the python API (and addon structure) for Kodi Matrix (v19) - jbinkley60 - 2021-11-21

So I submitted a new Matrix addon via PR 3789 and got a comment about the older infolabels method being deprecated in v20.  This new Matrix addon is actually an abandoned older addon I am helping get into Matrix.  Here's the current section of code:

    liz = xbmcgui.ListItem(name)
    infolabels={ "Title": name,
             "Aired": aired_text,
             "Year": aired_text.split('-',1)[0],
             "mediatype": 'episode',
             "Duration": duration,
             "Plot": plot_text }
    liz.setInfo( "video", infolabels)

I thought I followed the new format properly above and tried this for the new method from the PR 19459 request sample code itself:


    liz = xbmcgui.ListItem(name)
    videoInfoTag = liz.getVideoInfoTag()
    videoInfoTag.setFirstAired(aired_text)
    videoInfoTag.setYear(year_text)
    videoInfoTag.setMediaType('episode')
    videoInfoTag.setDuration(duration)
    videoInfoTag.setPlot(plot_text)

However I get the following error on Kodi 19.1:

2021-11-20 21:21:12.876 T:34252   ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'AttributeError'>
                                                   Error Contents: 'xbmc.InfoTagVideo' object has no attribute 'setFirstAired'
                                                   Traceback (most recent call last):
                                                     File "C:\Users\Audio1\AppData\Roaming\Kodi\addons\plugin.video.cbc-sports\addon.py", line 423, in <module>
                                                       INDEX(url)
                                                     File "C:\Users\Audio1\AppData\Roaming\Kodi\addons\plugin.video.cbc-sports\addon.py", line 110, in INDEX
                                                       addDir2(title, url, iduration, 2, image)
                                                     File "C:\Users\Audio1\AppData\Roaming\Kodi\addons\plugin.video.cbc-sports\addon.py", line 364, in addDir2
                                                       videoInfoTag.setFirstAired(aired_text)
                                                   AttributeError: 'xbmc.InfoTagVideo' object has no attribute 'setFirstAired'
                                                   -->End of Python script error report<--

Is this new format not implemented yet in Kodi or am I doing something wrong for the new format ?   I wasn't able to find any working examples yet in the Kodi repo.


Jeff


RE: Changes to the python API (and addon structure) for Kodi Matrix (v19) - black_eagle - 2021-11-21

SetFirstAired is v20 onwards.  I don't think any of that was backported to v19 as it's not a fix for an issue.


RE: Changes to the python API (and addon structure) for Kodi Matrix (v19) - jbinkley60 - 2021-11-21

(2021-11-21, 13:57)black_eagle Wrote: SetFirstAired is v20 onwards.  I don't think any of that was backported to v19 as it's not a fix for an issue.

Thanks.  That was my thought.  So the comment in the PR request was for awareness vs,. me needing to fix anything.  I suspect the deprecation period for this old method is going to have to last quite some time.  There are a lot of addons which will need updated vs. having them break if the old functionality is suddenly not supported.


Jeff


RE: Changes to the python API (and addon structure) for Kodi Matrix (v19) - black_eagle - 2021-11-21

(2021-11-21, 14:10)jbinkley60 Wrote: I suspect the deprecation period for this old method is going to have to last quite some time.

I think what usually happens is that when the team deprecate something in a version, both methods continue to work in that version and then the deprecated stuff is removed in the following version.  So something being deprecated in v20 will continue to work (although there should be log notifications regarding it) and then be removed in v21.  No eta for either of those but I'd guess not any time soon!


RE: Changes to the python API (and addon structure) for Kodi Matrix (v19) - malvinas2 - 2024-04-14

@enen92
Does a listing of the Python API (and add-on structure) changes for Kodi Nexus (v20) and Omega (v21) exist somewhere? Maybe on doxygen?


RE: Changes to the python API (and addon structure) for Kodi Matrix (v19) - scott967 - 2024-04-15

https://xbmc.github.io/docs.kodi.tv/master/kodi-base/d9/d86/python_revisions.html

scott s.
.