[SOLVED] executeCommandLine inject variable

hello i’m trying to create a rule to play youtube videos.
I’m trying to inject the var ytid into the executeCommandLine command’s XXXXXXXXXXX position.

var ytid = "blablub"
logInfo("Kodi", ytid)
executeCommandLine("/usr/bin/kodi-send --host=123.122.145.50 --port=5656 --action='PlayMedia(plugin://plugin.video.youtube/?action=play_video&videoid=XXXXXXXXXXX)'",200)

i need the correct syntax to escape after videoid= to insert ytid and go back in. I’ve tried backslashes and brackets but it seems i’m doing something wrong. thx for your help!

Use a stringBuilder:

var ytid = "blablub"
logInfo("Kodi", ytid)
val StringBuilder myCommand = new StringBuilder
myCommand.append("/usr/bin/kodi-send --host=123.122.145.50 --port=5656 --action='PlayMedia(plugin://plugin.video.youtube/?action=play_video&videoid=")
myCommand.append(ytid)

executeCommandLine(myCommand.toString, 200)
1 Like

thank you very much! That was quick =)

Please mark the thread as solved, thanks
hc_292