Get Current Plugin URL?
#1
Hi all. I'm very new to Kodi plugins and development. I am writing a script to go along with a RetroPie installation that will allow the use of Kodi's numerous rom launchers with retropie's runcommand.sh method of launching emulators. Its a long story, but suffice to say that Kodi must be exited before an emulator launches because Kodi hogs the framebuffer, so the emulator never displays.

Anyway. I have my script working, I'm just trying to tweak it and for that I need a kodi plugin expert's advice.

So the way the script works now is you go to for example AEL (Advanced Emulator Launcher), you point it to my script. My script executes, closes kodi, opens emulator. When emulator closes, script reopens Kodi again. Trouble is that Kodi always opens at its home screen, not at the last place you were at when Kodi quit (AEL). If you're in the middle of a retrogaming marathon, it could be annoying to have to navigate manually back to the launcher to pick a different title.

The way I understand things is that kodi addons display the information on screen that they do based on url calls. Something to the tune of (plugin://plugin.program.launcher/someurl). I'm trying to figure out how to (programatically) get what the current or most recent displayed url is. This way, when my script closes Kodi, it can pass the url to a file, which will then be read at Kodi launch and bring the interface back to the same url it was at when Kodi closed.

I've been hunting for the solution to this via google and other posts for about a week, but no one has an answer, or even knows if this is possible. At this point I'd be happy with the URL in a line in the kodi.log that I could read from my script.

Does anyone have any guidance they could share with me?
Reply
#2
Thread moved to addon development
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply
#3
Call parameters are passed via sys.argv list.
Reply
#4
Yes, but I'm trying to hook into a plugin that isn't actively passing anything except to Kodi itself through Kodi's built in ActivateWindow function. There's no "getActiveWindow" function, so I'm trying to figure out how to get that url string myself.
Reply
#5
you (as in Roman_V_M) didn't get the point. kodi pass the parameters to the plugin through sys.argv. the url is simply constructed as

Code:
plugin://<plugin id>/ + parameters

on execution the url is split, and the parameters are in sys.argv[1].

that is what was answered. but crono141 is after the path from a separate script. for this you read the container.folderpath info label through
Code:
xbmc.getInfoLabel('container.folderpath')

since you are interfacing with a program plugin, i have no idea why you wonder what the window ID is - it's the program window Smile

also you can use another builtin,
Code:
RunPlugin(id, parameters)

instead and it will choose the appropriate window based on the plugin type. that way you can blissfully ignore your need to identify the static 'Programs' window ID Wink
Reply
#6
xbmcgui.getCurrentWindowDialogID() or xbmcgui.getCurrentWindowId() before closing and it will have to be integrated into the skin. then you can save it a setting either in the addon dir or set property and have skin setstring to save setting before closeing then have the skin runscript on startup pull setting replace window and your back where you left off. easier said then done of course but it should work... there is also a BIGBOX launcher script that is floating around that already does something similar for launchbox. but I think it only mini the window.
Shield TV | Windows 10 | Mariadb | Mii Box
Evolve Ecosystem Repo | TV Melodies | Madnox Holiday Mod
Reply

Logout Mark Read Team Forum Stats Members Help
Get Current Plugin URL?0