v20 Help for RunScript addon function from settings.xml
#16
(2023-08-18, 14:17)jbinkley60 Wrote:
(2023-08-18, 13:20)TwilightMercy Wrote: The code indeed works and runs at Kodi launch. but then the code runs again when I launch the addon inside Kodi.
I want to run the code only once for Kodi startup only.

Is it possible?

Yes, you'll need to catch sys.argv[2]  in your kodi_startup.py file and if it is "clean_folders" then don't execute.  Another way to do it is in your service since it only runs once.  I do this here in my sevice.py file.  These three functions only get called once when the service starts.


Jeff

The thing is the code I wrote in kodi_startup.py does run when kodi starts (because service addon starts).
But later when I launch the addon later inside Kodi (searching for subtitles), the kodi_startup.py runs again and runs the code.

I want it to run only on Kodi startup once
Reply
#17
(2023-08-18, 14:23)TwilightMercy Wrote: The thing is the code I wrote in kodi_startup.py does run when kodi starts (because service addon starts).
But later when I launch the addon later inside Kodi (searching for subtitles), the kodi_startup.py runs again and runs the code.

I want it to run only on Kodi startup once

I can't see all of your code to give you an exact answer but I'd make clean_folders a function inside one of your .py files.  It really doesn't matter which one and call it from your service file when it starts.  Your start.py file won't call it since it is a function.  If the code for clean_folders is inline code in any of your .py files vs. being a function which is called, then it will run whenever the .py file it is in gets run.  That's what you don't want to do.


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply

Logout Mark Read Team Forum Stats Members Help
Help for RunScript addon function from settings.xml0