Beta script.module.kodi-six - a library for creating Python 2/3 compatible addons
#16
@Roman_V_M 
It will be helpful if kodi_six can handle differences in Leia and Matrix due to deprecating "Line1", "Line2", "Line3" in favour of "Msg" in dialogs
ideally if xbmcgui is imported from kodi_six, xbmcgui.Dialog and xbmcgui.DialogProgress should both continue to accept line1, line2, and line3 and on Matrix combine the three lines into a single message (with CR as joiner) and display
Kodi 21 Windows 10 and 11 | 21 Xbox One X | 21 Linux Mint Virginia XFCE | CoreELEC NO 21 nightly S905X4 aarch64
Reply
#17
@gujal  Not going to happen. You should not be using deprecated API features in the first place. And this has nothing to do with Python 2 > 3 migration.
Reply
#18
(2020-06-10, 10:28)Roman_V_M Wrote: @gujal  Not going to happen. You should not be using deprecated API features in the first place. And this has nothing to do with Python 2 > 3 migration.

It is not about migration but maintaining a single codebase oof the addon for both Leia and Matrix repos.
six library is about maintaining a single codebase that runs on Python2 and Python3, in a similar vein kodi-six could help in maintaining a single codebase that runs on Leia and Matrix. (Not asking for compatiblity with even Krypton, just Leia and Matrix)
Kodi 21 Windows 10 and 11 | 21 Xbox One X | 21 Linux Mint Virginia XFCE | CoreELEC NO 21 nightly S905X4 aarch64
Reply
#19
(2020-06-11, 06:03)gujal Wrote: It is not about migration but maintaining a single codebase oof the addon for both Leia and Matrix repos.
six library is about maintaining a single codebase that runs on Python2 and Python3, in a similar vein kodi-six could help in maintaining a single codebase that runs on Leia and Matrix. (Not asking for compatiblity with even Krypton, just Leia and Matrix)

You can definitely have a single codebase as long as you are not using deprecated API features. Deprecation notices for things removed in Matrix have been in the docs for several versions already and creating a wrapper that restores deprecated features just not make any sense, unless some things are fundamentally broken. But removing lineX arguments from dialogs or image arguments from ListItem are definitely not one of them.
Reply
#20
I totally agree with this addon not needing to restore deprecated features, however the actual deprecation of these features isn't always as clean as it could be. In other systems you have a function, say print(arg1, arg2) in V1. You get to V2 and it is changed to be print(arg1). So for V2 you support BOTH methods to give developers time to transition, and then kill the deprecated method in V3. Often with Kodi a Python function works in one version and then not in another with no time for addon devs to transition. I get that this is sometimes necessary but it does create some confusion. I had an addon I work on basically break overnight due to a python API change in a nightly Matrix build that wasn't even in the Pydocs yet. 

Once you know of the change though using Git to manage this type of stuff is super easy. I have code for addons on Krypton, Leia and Matrix and just backport needed fixes between them with merges and cherry-pick commands. You can still maintain the codebase and manage the Kodi Python changes, just not in a single branch.
Reply
#21
(2020-06-11, 10:23)Roman_V_M Wrote:
(2020-06-11, 06:03)gujal Wrote: It is not about migration but maintaining a single codebase oof the addon for both Leia and Matrix repos.
six library is about maintaining a single codebase that runs on Python2 and Python3, in a similar vein kodi-six could help in maintaining a single codebase that runs on Leia and Matrix. (Not asking for compatiblity with even Krypton, just Leia and Matrix)

You can definitely have a single codebase as long as you are not using deprecated API features. Deprecation notices for things removed in Matrix have been in the docs for several versions already and creating a wrapper that restores deprecated features just not make any sense, unless some things are fundamentally broken. But removing lineX arguments from dialogs or image arguments from ListItem are definitely not one of them.
I completely agree about image arguments from Lisitem as that has been there since atleast Isengard.

Unfortunately the dialog deprecation is quite sudden, Leia does not support the new format that Matrix expects. Normally there is version which supports both formats and then the next version deprecates. (for e.g. strings.po, settings.xml, etc). However in case of Dialog boxes and Progress Dialogs the deprecation is completely sudden and is the issue
Kodi 21 Windows 10 and 11 | 21 Xbox One X | 21 Linux Mint Virginia XFCE | CoreELEC NO 21 nightly S905X4 aarch64
Reply
#22
(2020-06-12, 00:24)gujal Wrote: Unfortunately the dialog deprecation is quite sudden, Leia does not support the new format that Matrix expects.

That is strange, I have replaced text in all my dialogs with single string versions and everything works fine in Leia. The most recent example in my addon that is currently under development: https://github.com/romanvm/kodi.tvmaze.s...ice.py#L68

I have checked Dialog.h sources in Leia and indeed there was no clear deprecation notice but using additional lineX arguments was not recommended in favor if a multi-line single string text. Anyway, as far as I can see, the change in Leia is trivial and should not prevent from using the same code in Liea and Matrix.
Reply
#23
Thanks, will follow your example
Kodi 21 Windows 10 and 11 | 21 Xbox One X | 21 Linux Mint Virginia XFCE | CoreELEC NO 21 nightly S905X4 aarch64
Reply
#24
@Roman_V_M, hello.
Are You planing to add this changes to kodi-six module?
  1. 24 April 2020 - xbmc.makeLegalFilename() was moved to the xbmcvfs module (xbmcvfs.makeLegalFilename())
  2. 01 September 2020 - xbmc.translatePath() was moved to the xbmcvfs module (xbmcvfs.translatePath())
  3. 25 April 2020 - xbmc.validatePath() was moved to the xbmcvfs module (xbmcvfs.validatePath())
My addons: Gismeteo
Reply
#25
@vl_maksime kodi-six patches original xbmc* modules at import time and has noting hardcoded. All functions and classes should be available from where they are in the current Kodi API.
Reply
#26
I have a question. By using kodi-six wrappers we can make our addons compatible for both Leia and Matrix but we'll still have to maintain 2 different versions because of the requirement of having to import python 3 for Matrix and 2.7 for Leia in the addon.xml file? Or am I missing something? Thanks.


[edit] Never mind. I think I get it.
Reply

Logout Mark Read Team Forum Stats Members Help
script.module.kodi-six - a library for creating Python 2/3 compatible addons0