06-10-2025, 07:20 PM
Thanks, my C# is so rusty these day... I want to look at and intergrate LibreAutomate C# soon. For now I came up with this. If there is anyway to get just the two lines I need that would awsome.
Thanks for any help.
str s1 l2 json1 json2
typelib WinHttp {662901FC-6951-4854-9EB2-D9A2570F2B2E} 5.1
WinHttp.WinHttpRequest h._create
WinHttp.WinHttpRequest i._create
// First Request
h.Open("GET" "http://127.0.0.1:8080/requests/playlist.json")
h.setRequestHeader("content-type", "application/json")
str enc.encrypt(4 ":vlcremote") ;;replace ":vlcremote" with your password, if no username
h.SetRequestHeader("Authorization", F"Basic {enc}")
h.Send()
err out _error.description; ret
if h.Status=200
json1 = h.ResponseText
// Second Request
i.Open("GET" "http://127.0.0.1:8080/requests/status.json")
i.setRequestHeader("content-type", "application/json")
i.SetRequestHeader("Authorization", F"Basic {enc}")
i.Send()
err out _error.description; ret
if i.Status=200
json2 = i.ResponseText
// Merge JSONs
s1 = F"{{''playlist'': {json1}, ''status'': {json2}}"
// Save to file
l2 = "C:\Users\Chris\data.json"
s1.setfile(l2 0 -1 1)
// need a way to get the line with syntax "time":### in s1
// need a way to get the line directly above syntax "current":"current" in s1
// do not really want to deal with an external file.