[help] call xbmc.executebuiltin(RunPlugin(foo)) and wait for it to stop
#1
I'm trying to make an addon that will run the subscription update functions of various other addons on custom timers, but i cannot find a way to run that function and then wait for it to finish before proceeding.

So currently I'm trying to get hulu to update subscriptions, and the appropriate process to execute is
Code:
xbmc.executebuiltin("RunPlugin(plugin://plugin.video.hulu/?mode='SubscriptionsLibrary')")
and i need the code to then wait for it complete before continuing.

What ive tried so far is to run this with subprocess.call, but it fails because there is no python executable to run, the error is
WindowsError: [Error 2] The system cannot find the file specified

and i tried to import the python file i need to run processes from (xbmclibrary.py) with
Code:
sys.path.append(xbmc.translatePath('special://home/addons/plugin.video.hulu/resources/lib'))
import xbmclibrary as hulu
which fails because the script cannot subsequently load its own modules located in
plugin.video.hulu/resources/lib

does anyone have a solution for this?
Reply
#2
I haven't tried this from inside an add-on, but I have used the concept in scripts and think it would work. Most addons write some status to the xbmc.log file. You can open the log file and keep reading periodically until you see the status you're looking for. For the addons that don't write status and use a plugin://plugin url, try adding the url to a playlist and then playing the playlist, you should get ERROR: Playlist Player: skipping unplayable item: 0, path [plugin://plugin.video.hulu/?mode='SubscriptionsLibrary'] or something like it written to the log file at the end of the update process. A player timeout may occur before the process is complete, I'm not sure. Really ugly but it might get the job done.
Reply
#3
what i ended up having to do is move the other scripts for my addon to a folder that wasnt /resources/lib so that when i add the hulu folder to sys.path it is the ONLY /resources/lib; before python would look in the /resources/lib folder from my addon's directory first, not find the modules hulu was trying to import, and just error. the code i ended up using is this:
Code:
dir = xbmc.translatePath('special://home/addons/plugin.video.hulu')
sys.path.append(dir)
sys.argv = ['plugin://plugin.video.hulu/', '0', "?mode='SubscriptionsLibrary'"]
import resources.lib.xbmclibrary as hulu
hulu.Main()
and that accomplishes exactly what i wanted to do. it runs the subscription update function but doesnt proceed until it is completed. once i work out any remaining bugs in the addon im making ill release it.
Reply

Logout Mark Read Team Forum Stats Members Help
[help] call xbmc.executebuiltin(RunPlugin(foo)) and wait for it to stop0