Problem using setResolvedUrl - 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: Problem using setResolvedUrl (/showthread.php?tid=377481) Pages:
1
2
|
RE: Problem using setResolvedUrl - iceman20k - 2024-05-14 Quote:With RunPlugin(...) Kodi just runs the plugin with the provided url. The plugin can do whatever it has to do, like changing settings, logging in to remote servers, wiping your hard drive, but Kodi does not expect any interaction of the plugin by calls like xbmcplugin.addDirectoryItem(...) or xbmcplugin.setResolvedUrl(...). In fact, a plugin handle of -1 suggest that it's simply impossible to interact like that.That is a very useful hint! Thanks for your datailed explanation. At least me, did not notice that reading the wiki pages (but that can be my fault because you can't just save it all to your brain ;P). I'd never assumed that RunPlugin(...) is causing this, so really thanks, that saved me! Quote:Well, there is an entry named 'Add-ons' in the main menu from where you can open your add-on by clicking on its icon. If you insist on having a dedicated entry in the main menu, yours is probably the way to go, but I know absolutely nothing about skinning, so I can't help you there.Thats true, currently i am learning by doing Quote:That sounds good. Still, you do call PlayMedia(...) somewhere. Despite my lack of skinning knowledge, I strongly feel there should be no need to do so. If your plugin provides the right info in the ListItems it produces and passes them to Kodi correctlyAlso a very good point. That is the right way to put the "puzzles" together for my understanding so far also. But as said, currently i am still learning by doing, but putting it into that clean way is the right track! RE: Problem using setResolvedUrl - iceman20k - 2024-05-14 Uhm, i might got bogged down in details finally, but now i got the problem that if i call PlayMedia(...) directly from Python to "spawn" main.py which, of course, runs setResolvedUrl(...) i get two busysdialgs and crash This works now: Putting PlayMedia(plugin.name/?url=url) in an Items <onclick> Value. The Item's onclick execute PlayMedia(...) and spawns the main.py, i get the handle and the main.py runs setResolvedUrl(handle, listitem,..). This works without any problems. However, if i run PlayMedia(plugin.name/?url=url) from another.py and NOT from an Item's onclick value in an XML file, i get: Code: critical <general>: Logic error due to two concurrent busydialogs, this is a known issue. The application will exit. I guess because this another.py runs PlayMedia, calls main.py which runs setResolvedUrl(url) which results in two busydialgs. But if i use RunPlugin() instead of PlayMedia() from another.py i dont get a valid handle for the setResolvedUrl function. What function do i use to get a valid Handle from an other Python Script that does not spawn a busydialg, just gives over the URL and the Handle to my plugins main.py? Sorry mates for bugging... RE: Problem using setResolvedUrl - iceman20k - 2024-05-14 Or can i set the Item's onclick value (just like in an XML with the tag <onclick>) when adding items to a panel from Python instead of using <content> in the XML file: Code: item = xbmcgui.ListItem(label) # Sets Label Just like the "label", how can i set the Item's onclick value? RE: Problem using setResolvedUrl - kereltje - 2024-05-15 (2024-05-14, 22:06)iceman20k Wrote: You can't and you shouldn't. I get the feeling you're thinking very much in concepts for normal GUI programming, but that doesn't apply to the way Kodi's plugin system works.The (very) basic principle of operation of a plugin is like this:
This is of course just a basic overview, but the point is that you don't have to call RunPlugin() , PlayMedia() , etc for the normal operation of a plugin. And you don't have to handle click events. Kodi handles the click events of items and by setting things like parameter 'url' you tell Kodi what it should do when clicked.I strongly suggest that you put your custom skin with these <onclick> items on ice for the moment and try to get the plugin running as a plugin should, by opening it from the add-ons section in the default skin. Once you get that working and find you'll still want a custom skin, you'll have at least something solid to work on. I guess most of us learned by trial and error. It's certainly a path that's rather steep and rough sometimes, particularly at the start, but it gets easier once you're on the way. Just take small steps at a time and enjoy small successes. |