@CoinTos
Many, many thanks for this addon. I spent some time this morning, trying to optimize how it locates AutoHotkey.exe, and got some good results to try and reduce the delay in starting up BigBox. I am a super duper novice in Python, mind you, so plenty of people will/should come along and say how wrong I am. Anyway:
In findApp() - main.py, line 232..you may want to put some constraints on the os.walk(), or potentially accept an exclude list of directories and/or filetypes as input to this function. As it stands I am excluding:
a list of Launchbox subdirectories that very likely do not contain what we want
constraining to the extension '.exe', as I understand this only works on Windows so should be safe
Results I saw:
without any constraints: 14.0886399746 seconds
with the ignore_dirs list and .exe constraint: 0.131103992462 seconds
If you have the addon in Github/etc I'm happy to submit a PR, otherwise I hope this helps.
def findApp(program):
result = ''
ignore_dirs = set(['Backups','Games','Images','LBThemes','Logs','Manuals','Metadata','Music','PauseThemes','Sounds','StartupThemes','Themes','Videos'])
for root, dirs, files in os.walk(launchbox):
dirs[:] = [d for d in dirs if d not in ignore_dirs]
files[:] = [f for f in files if f.endswith('.exe')]
if program in files:
result = os.path.join(root, program)
return result
Sorry to add a +1 - I am on Kodi 18.6 and am also seeing the delay in starting Big Box - in my case it's about 15-20 seconds. Before I upgraded to 1.5.7 everything was instant (until of course AHK's location changed).
I initially upgraded from 1.5.4, but to be on the safe side after seeing this problem, I blew away all of the addon files and addon_data, then reinstalled from scratch (including kodi-six, just to be double sure)..
Nothing super interesting in the kodi.log or LaunchBoxLauncher.log files. Doesn't seem to matter if I ask the script to quit Kodi or not. Happy to grab more debug info if it is needed.
**EDIT: figured it out.
locateAutoHokey() is slow because there's an os.walk() going on to figure out where AutoHotKey.exe is.
That's a ton of files in my case (with an entire Games\ directory that is actually a link to a network share..)
I assume you did that because, well, the location of the AHK binary might change again. It makes sense.
Anyway - I don't have a better solution right this minute, but I hardcoded the location of the binary and BigBox launch was instant.
Debug log below that helped me narrow things down..
2020-04-29 21:17:22.426 T:2236 DEBUG: CPythonInvoker(5, C:\Users\mediarouser\AppData\Roaming\Kodi\addons\script.launchbox.launcher\default.py): start processing
2020-04-29 21:17:22.478 T:2236 DEBUG: CPythonInvoker(5, C:\Users\mediarouser\AppData\Roaming\Kodi\addons\script.launchbox.launcher\default.py): the source file to load is "C:\Users\mediarouser\AppData\Roaming\Kodi\addons\script.launchbox.launcher\default.py"
2020-04-29 21:17:22.478 T:2236 DEBUG: CPythonInvoker(5, C:\Users\mediarouser\AppData\Roaming\Kodi\addons\script.launchbox.launcher\default.py): setting the Python path to C:\Users\mediarouser\AppData\Roaming\Kodi\addons\script.launchbox.launcher;C:\Users\mediarouser\AppData\Roaming\Kodi\addons\script.module.kodi-six\libs;C:\Program Files\Kodi\system\python\DLLs;C:\Program Files\Kodi\system\python\Lib;C:\Program Files\Kodi\python27.zip;C:\Program Files\Kodi\system\python\lib\plat-win;C:\Program Files\Kodi\system\python\lib\lib-tk;C:\Program Files\Kodi;C:\Program Files\Kodi\system\python;C:\Program Files\Kodi\system\python\lib\site-packages
2020-04-29 21:17:22.478 T:2236 DEBUG: CPythonInvoker(5, C:\Users\mediarouser\AppData\Roaming\Kodi\addons\script.launchbox.launcher\default.py): entering source directory C:\Users\mediarouser\AppData\Roaming\Kodi\addons\script.launchbox.launcher
2020-04-29 21:17:22.479 T:2236 DEBUG: CPythonInvoker(5, C:\Users\mediarouser\AppData\Roaming\Kodi\addons\script.launchbox.launcher\default.py): instantiating addon using automatically obtained id of "script.launchbox.launcher" dependent on version 2.24.0 of the xbmc.python api
2020-04-29 21:17:22.524 T:2236 DEBUG: CAddonSettings[script.launchbox.launcher]: loading setting definitions
2020-04-29 21:17:22.524 T:2236 DEBUG: CAddonSettings[script.launchbox.launcher]: trying to load setting definitions from old format...
2020-04-29 21:17:22.525 T:2236 DEBUG: CAddonSettings[script.launchbox.launcher]: loading setting values
2020-04-29 21:17:22.530 T:2236 DEBUG: script.launchbox.launcher: ****Running LaunchBox-Launcher v1.5.7....
2020-04-29 21:17:22.530 T:2236 DEBUG: script.launchbox.launcher: System text encoding in use: mbcs
2020-04-29 21:17:22.530 T:2236 DEBUG: script.launchbox.launcher: usr scripts are set to be checked for updates...
2020-04-29 21:17:22.530 T:2236 DEBUG: script.launchbox.launcher: usr scripts are not set to be deleted, running version check
2020-04-29 21:17:22.530 T:2236 DEBUG: script.launchbox.launcher: sys "llsrevision=": 037
2020-04-29 21:17:22.531 T:2236 DEBUG: script.launchbox.launcher: usr "llsrevision=": 037
2020-04-29 21:17:22.531 T:2236 DEBUG: script.launchbox.launcher: userdata script are up to date
2020-04-29 21:17:22.531 T:2236 DEBUG: script.launchbox.launcher: skipping deleting userdata scripts, option disabled: delUserScriptSett = false
2020-04-29 21:17:22.531 T:2236 DEBUG: script.launchbox.launcher: script file already exists, skipping copy to userdata: C:\Users\mediarouser\AppData\Roaming\Kodi\userdata\addon_data\script.launchbox.launcher\scripts\LaunchBoxLauncher-AHK.ahk
2020-04-29 21:17:22.531 T:2236 DEBUG: script.launchbox.launcher: script file already exists, skipping copy to userdata: C:\Users\mediarouser\AppData\Roaming\Kodi\userdata\addon_data\script.launchbox.launcher\scripts\LaunchBoxLauncher-AHK.ico
2020-04-29 21:17:22.531 T:2236 DEBUG: script.launchbox.launcher: not a smb share skipping mapped drive creation
2020-04-29 21:17:22.531 T:2236 DEBUG: script.launchbox.launcher: running program file check, option is enabled: filePathCheck = true
2020-04-29 21:17:22.531 T:2236 DEBUG: script.launchbox.launcher: BigBox executable exists C:\Launchbox\BigBox.exe
**** DELAY HERE ****
2020-04-29 21:17:41.942 T:2236 DEBUG: script.launchbox.launcher: pre launchbox script: false
2020-04-29 21:17:41.942 T:2236 DEBUG: script.launchbox.launcher: post launchbox script: false
2020-04-29 21:17:41.942 T:2236 DEBUG: script.launchbox.launcher: quit setting selected: 0
2020-04-29 21:17:41.942 T:2236 DEBUG: script.launchbox.launcher: attempting to launch: "C:\Launchbox\ThirdParty\AutoHotkey\AutoHotkey.exe" "C:\Users\mediarouser\AppData\Roaming\Kodi\userdata\addon_data\script.launchbox.launcher\scripts\LaunchBoxLauncher-AHK.ahk" "C:\Launchbox\BigBox.exe" "0" "false" "false" "false" "false" "false" "0"
2020-04-29 21:17:41.944 T:2236 INFO: CPythonInvoker(5, C:\Users\mediarouser\AppData\Roaming\Kodi\addons\script.launchbox.launcher\default.py): script successfully run
2020-04-29 21:17:41.944 T:2236 DEBUG: CPythonInvoker::onExecutionDone(5, C:\Users\mediarouser\AppData\Roaming\Kodi\addons\script.launchbox.launcher\default.py)