A little suggestion for a further version: some htpc like mine do need a few seconds after resuming from sleep to recover network connectivity. If Kodi starts too quickly, it won't be able to connect to the shared mysql library and the only solution is to restart the app.
We could use your "start delay" option to avoid that, but it's not easy to determine the exact time required.
Until now, I have used my own AHK script to perform a "ping" on my mysql server, and only start Kodi when the network connectivity is restored.
If you want, you could easily use parts of this code to integrate the functionality into Launcher4Kodi :
Code:
; Wait for network (30sec timemout)
count := 0
While count < 30
{
If Ping()
{
Run, "C:\Program Files (x86)\Kodi\Kodi.exe"
Break
} Else {
count++
sleep 1000
}
}
Ping(Address="192.168.1.100",Timeout = 500,ByRef Data = "",Length = 0,ByRef Result = "",ByRef ResultLength = 0)
{
NumericAddress := DllCall("ws2_32\inet_addr","AStr",Address,"UInt")
If NumericAddress = 0xFFFFFFFF ;INADDR_NONE
Return, False
If DllCall("LoadLibrary","Str","icmp","UPtr") = 0 ;NULL
Return, False
hPort := DllCall("icmp\IcmpCreateFile","UPtr") ;open port
If hPort = -1 ;INVALID_HANDLE_VALUE
Return, False
StructLength := 278 ;ICMP_ECHO_REPLY structure
VarSetCapacity(Reply,StructLength)
Count := DllCall("icmp\IcmpSendEcho","UPtr",hPort,"UInt",NumericAddress,"UPtr",&Data,"UShort",Length,"UPtr",0,"UPtr",&Reply,"UInt",StructLength,"UInt",Timeout)
If NumGet(Reply,4,"UInt") = 11001 ;IP_BUF_TOO_SMALL
{
VarSetCapacity(Reply,StructLength * Count)
DllCall("icmp\IcmpSendEcho","UPtr",hPort,"UInt",NumericAddress,"UPtr",&Data,"UShort",Length,"UPtr",0,"UPtr",&Reply,"UInt",StructLength * Count,"UInt",Timeout)
}
If NumGet(Reply,4,"UInt") != 0 ;IP_SUCCESS
Return, False
If !DllCall("icmp\IcmpCloseHandle","UInt",hPort) ;close port
Return, False
ResultLength := NumGet(Reply,12,"UShort")
VarSetCapacity(Result,ResultLength)
DllCall("RtlMoveMemory","UPtr",&Result,"UPtr",NumGet(Reply,16),"UPtr",ResultLength)
Return, True
}
Note that credits for the Ping() function is not mine, I found it somewhere on the net (sorry can't find the author anymore).