Kevin, how can the code you last posted be modified to only show the time and uri for the line that is current? Thanks
Something like this but I know you will show best practice.
[/code]
Something like this but I know you will show best practice.
Macro [b]Macro74[/b] [help1][/help1]
[code]str s1 s2 final
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.xml")
h.setRequestHeader("content-type", "application/xml")
str enc.encrypt(4 ":vlcremote") ;; replace with your password if needed
h.SetRequestHeader("Authorization", F"Basic {enc}")
h.Send()
err out _error.description; ret
if h.Status=200
,IXml x._create
,x.FromString(h.ResponseText)
,ARRAY(IXmlNode) a
,x.Path(".//leaf" a)
,for _i 0 a.len
,,IXmlNode attr attr2 attr3; attr=a[_i].Attribute("uri")
,,attr2=a[_i].Attribute("current")
,,if(attr2)
,,,s2=attr.Value
,,,s2.escape(8)
,,,s2.replacerx("file:///" "")
,,,
,,,// Second Request for current playback time
,,,i.Open("GET" "http://127.0.0.1:8080/requests/status.xml")
,,,i.setRequestHeader("content-type", "application/xml")
,,,i.SetRequestHeader("Authorization", F"Basic {enc}")
,,,i.Send()
,,,err out _error.description; ret
,,,if i.Status=200
,,,,IXml x1._create
,,,,x1.FromString(i.ResponseText)
,,,,attr3=x1.Path("root/time")
,,,,if(attr3)
,,,,,s1 = attr3.Value
,,,final = F"{s1},{s2}"
,,,break ;; stop after finding current item
out
out final