Kodi Community Forum

Full Version: v19 - Can't playing local plugin url (Kodi crashes)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hi,

In Kodi 17.6 I could play url such as:
http://127.0.0.1:65007/?url=plugin://plu...=2&mode=11

But in Kodi 19 when I try to play it, kodi crashes.
Why is that?
How can I solve this?

It seems that in Kodi 17.6 it used InputStream to open it.

Thanks.
(2021-08-30, 11:46)burekas Wrote: [ -> ]But in Kodi 19 when I try to play it, kodi crashes.

Running that same plugin will crash because Kodi is Python-3 dependant as per v19.
If it is already a Python-3 script/add-on, provide a debug log (wiki).
(2021-08-30, 11:51)Klojum Wrote: [ -> ]
(2021-08-30, 11:46)burekas Wrote: [ -> ]But in Kodi 19 when I try to play it, kodi crashes.

Running that same plugin will crash because Kodi is Python-3 dependant as per v19.
If it is already a Python-3 script/add-on, provide a debug log (wiki).

I'm trying to play it through "plugin.video.playlistLoader" order an item from "plugin.video.israelive" addon.
(Basically it should be used as a url in my pvr list for Live TV)

Both addons are Python-3 supported.
Kodi debug log: https://paste.ubuntu.com/p/PYvqtSCPVd (Using Kodi Player)
Kodi debug log #2: https://paste.ubuntu.com/p/dShWcJ82Cw (Using different player in the addon setting - Livestreamer)

65007 is the LiveStreamer port.

As I wrote, in Kodi 17.6 it seems to use InputStream to open it.
Maybe it relates to that?
This paste expires in <1 day

This is not gonna be helpful... Use Kodi's paste, it retends 60 days.
(2021-08-30, 12:45)Klojum Wrote: [ -> ]This paste expires in <1 day

This is not gonna be helpful... Use Kodi's paste, it retends 60 days.
Updated links (Not expired)
Kodi debug log: https://paste.ubuntu.com/p/PYvqtSCPVd (Using Kodi Player)
Kodi debug log #2: https://paste.ubuntu.com/p/dShWcJ82Cw (Using different player in the addon setting - Livestreamer)
It's a bit difficult to debug without the source file but I am seeing a number of errors related to is and is not being replaced by == and != .  I'd suggest fixing these first.  I'd suggest you run the Python 2to3 script against your Python files as part of the porting process from Python 18 to 19.  It's included with Python 3.  Here's the steps I go through to create a Kodi 19 version of a Kodi 18 addon:

1.  Run the Python 2to3 script against all .py files
2.  Update any Kodi 18 deprecated calls and changes
3.  Update the addon settings file to the new format using the conversion script
4.  Update the addon.xml file for the Python 3 dependency


Jeff
(2021-08-30, 14:25)jbinkley60 Wrote: [ -> ]It's a bit difficult to debug without the source file but I am seeing a number of errors related to is and is not being replaced by == and != .  I'd suggest fixing these first.  I'd suggest you run the Python 2to3 script against your Python files as part of the porting process from Python 18 to 19.  It's included with Python 3.  Here's the steps I go through to create a Kodi 19 version of a Kodi 18 addon:

1.  Run the Python 2to3 script against all .py files
2.  Update any Kodi 18 deprecated calls and changes
3.  Update the addon settings file to the new format using the conversion script
4.  Update the addon.xml file for the Python 3 dependency


Jeff

Regardin (1) and (4) The addons are already after using 2to3, update addon.xml to python3, fixes alt the errors I get from the log file.
Regarding (2) If I don't get error in the log I can't know what else I need to fix.
Regarding (3) what is the conversion script for the seeting file?

This is the addon that the item exist there: https://f2h.io/d4mbz6ea7la2
The addon_data for the addon: https://f2h.io/ln03npzx8r4k
When I'm inside the addon the it plays it ok, but when playing it using the "http" url from another place in kodi (Playlist Loader / Live TV), it crashes.
Here's the link to the settings conversion script between Kodi 18 and 19.  The old format still works in 19 but you'll see the log messages.


Jeff
(2021-08-30, 18:57)jbinkley60 Wrote: [ -> ]Here's the link to the settings conversion script between Kodi 18 and 19.  The old format still works in 19 but you'll see the log messages.


Jeff

Thanks.
I installed the addon but when using it I got this error:
Code:
2021-08-30 21:36:26.439 T:12516   ERROR <general>: 
    EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
        - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
       Error Type: <class 'xml.etree.ElementTree.ParseError'>
       Error Contents: not well-formed (invalid token): line 4, column 136
       Traceback (most recent call last):
         File "D:\Program Files (x86)\Kodi v19.1 x64\portable_data\addons\script.settings-convert\default.py", line 844, in <module>
           Main()
         File "D:\Program Files (x86)\Kodi v19.1 x64\portable_data\addons\script.settings-convert\default.py", line 47, in __init__
           newsettings = self.updateSettings(settingsxml)
         File "D:\Program Files (x86)\Kodi v19.1 x64\portable_data\addons\script.settings-convert\default.py", line 78, in updateSettings
           data = ET.parse(settingsxml).getroot()
         File "D:\Program Files (x86)\Kodi v19.1 x64\system\python\Lib\xml\etree\ElementTree.py", line 1202, in parse
           tree.parse(source, parser)
         File "D:\Program Files (x86)\Kodi v19.1 x64\system\python\Lib\xml\etree\ElementTree.py", line 595, in parse
           self._root = parser._parse_whole(source)
         File "<string>", line None
       xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 4, column 136
       -->End of Python script error report<--

This is the settings.xml content:
https://paste.ubuntu.com/p/t49RxzZDdY
Ronie will likely need to look at this.  He owns the settings conversion script.



Jeff
Ok, I posted the error in the other thread.
After the settings will be in the correct format I will test it again.
(2021-08-31, 02:38)jbinkley60 Wrote: [ -> ]Ronie will likely need to look at this.  He owns the settings conversion script.



Jeff

Ok so I found the problem, it was because in the settings.xml there were & chars instead of &amp ; 

Now I don't have this problem with the settings format regarding this plugin,
but kodi still crashes when using this external url:
http://127.0.0.1:65007/?url=plugin://plu...=2&mode=11
(By the way I tried it also in this &amp format, but it still the same)

Updated kodi log: https://paste.ubuntu.com/p/Xxd6H7dqzZ

There is an error there that I don't know why:
Code:
ERROR <general>: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

In Kodi 17.6, after this log line it starts playing:
Code:
ERROR: 127.0.0.1 - - [31/Aug/2021 15:57:40] "GET /?url=plugin://plugin.video.israelive/&channelid=2&mode=11 HTTP/1.1" 200 -

Another different that I found is:
In Kodi 17.6:
Code:
DEBUG: XFILE::CPluginDirectory::StartScript - calling plugin GlobeTV('plugin://plugin.video.israelive/','20','?channelid=2&mode=11')
Code:
DEBUG: XFILE::CPluginDirectory::StartScript - calling plugin עידן+ פלוס('plugin://plugin.video.idanplus/','21','?mode=5&url=ch_12')
(The external URL should calling to "plugin.video.israelive" which there is an item that should calling an item in "plugin.video.idanplus")

While in Kodi 19 in different format and params, and doesn't call the second addon (It calls twice to the same addon instead):
Code:
DEBUG <general>: XFILE::CPluginDirectory::StartScript - calling plugin GlobeTV('plugin://plugin.video.israelive/','1','?channelid=2&mode=11','resume:false')
Code:
DEBUG <general>: XFILE::CPluginDirectory::StartScript - calling plugin GlobeTV('plugin://plugin.video.israelive/channelid=2','2','?mode=11','resume:false')

Just to mention again: Everything is work when I enter to the addon manually, the issue is with the external URL.
This error, means there is no value assigned to something you are trying to use or compare:

ERROR <general>: int() argument must be a string, a bytes-like object or a number, not 'NoneType'


Typically when I face these I start instrumenting my code to find the offending call.  I'll add something like this:

 xbmc.log('I am here instance 1  ', xbmc.LOGINFO)

in various parts of the Python file and then look in the logs to see where the error occurs (i.e. between instances 3 and 4) and then I start narrowing the range till I find it. 

The &amp is UTF-8 encoding.  You might try UTF-8 encoding your URL call prior calling the addon to see if that works.


Jeff
@jbinkley60 

I think I found the problem in the code:
Code:
listItem = xbmcgui.ListItem(path=url)
When the url is:
Code:
"plugin://plugin.video.idanplus/?mode=5&url=ch_12"

How can I know if listItem was set and set correctly?

Because after that there is "listItem.setInfo" function but the log after that function isn't running.
Code:
    listItem.setInfo(type="video", infoLabels={"mediatype": "movie", "studio": channelName, "title": programmeName, "plot": description, "tvshowtitle": channelName, "episode": 0, "season": 0})

Code:
DEBUG <general>: programmeName: [COLOR yellow]ערוץ 12 - קשת (HD)[/COLOR]
DEBUG <general>: description
DEBUG <general>: channelName: [COLOR yellow]ערוץ 12 - קשת (HD)[/COLOR]
(description was orinally set as None, I change it to empty string "", but still the same)

So I guess there is a problem with the "xbmcgui.ListItem" or with the "setInfo" that makes setInfo to fail.

Thanks for your help.
Glad you got it working.  I don't count on debug to articulate variable information without some help.  I instrument my code like so when I want to see information during debug:

xbmc.log('The variable value I want to see is: ' + str(variable), xbmc.LOGDEBUG)

The only time this won't work is if the variable is a None type but you'll get an error so you know it hasn't been set and can fix it in code. 

Here's my code for setting the description and it seems to work even when thee is no description from the source:

description_text = ''
description = container.find('.//{urn:/schemas-upnp-org:metadata-1-0/upnp/}longDescription')
if description != None and description.text != None:
     description_text = description.text

I then use description_text to set the plot in the info dictionary.  In my case I am parsing an XML response from a uPNP server.




Jeff
Pages: 1 2 3