Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
String from XML?
#22
sorry for the delay was not near pc

From what i see the time request will only show the current time position of currently playing track
so for the others in your playlist it wont show the time. this will get the time for current track or will get the total time for all others

Function Function457
Code:
Copy      Help
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 ":vlcremote" with your password, if no username
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 attr1 attr2 attr3; attr=a[_i].Attribute("uri")
,,s2=attr.Value
,,s2.escape(8);; remove url formatting showing true path
,,s2.replacerx("file:///" "")
,,attr2=a[_i].Attribute("current")
,,if(attr2)
,,,// Second Request gets current time of currently playing playlist track
,,,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
,,else
,,,attr1=a[_i].Attribute("duration")
,,,s1=attr1.Value
,,final.addline(F"{s1},{s2}")
out final.rtrim

edited the previous post.Had some code double removed now.


Messages In This Thread
String from XML? - by pctechtv - 03-04-2022, 12:14 PM
RE: String from XML? - by Kevin - 03-04-2022, 04:33 PM
RE: String from XML? - by pctechtv - 03-06-2022, 05:51 AM
RE: String from XML? - by pctechtv - 03-06-2022, 09:34 AM
RE: String from XML? - by Kevin - 03-06-2022, 02:18 PM
RE: String from XML? - by pctechtv - 03-06-2022, 09:10 PM
RE: String from XML? - by Kevin - 03-09-2022, 02:57 PM
RE: String from XML? - by pctechtv - 03-12-2022, 02:41 PM
RE: String from XML? - by pctechtv - 05-23-2023, 04:29 AM
RE: String from XML? - by pctechtv - 05-23-2023, 12:51 PM
RE: String from XML? - by Kevin - 05-23-2023, 05:34 PM
RE: String from XML? - by pctechtv - 05-25-2023, 03:54 PM
RE: String from XML? - by Kevin - 05-27-2023, 12:08 PM
RE: String from XML? - by pctechtv - 06-07-2023, 04:22 PM
RE: String from XML? - by pctechtv - 06-10-2025, 12:36 AM
RE: String from XML? - by Gintaras - 06-10-2025, 07:32 AM
RE: String from XML? - by pctechtv - 06-10-2025, 07:20 PM
RE: String from XML? - by pctechtv - 06-11-2025, 02:30 AM
RE: String from XML? - by Kevin - 06-11-2025, 02:45 AM
RE: String from XML? - by pctechtv - 06-11-2025, 11:41 AM
RE: String from XML? - by Kevin - 06-11-2025, 12:09 PM
RE: String from XML? - by Kevin - 06-11-2025, 04:23 PM
RE: String from XML? - by pctechtv - 06-11-2025, 04:50 PM
RE: String from XML? - by pctechtv - 06-12-2025, 08:33 PM
RE: String from XML? - by Kevin - 06-17-2025, 02:53 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)