Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
String from XML?
#12
That is super! I learn something every time I come here. I also realize my idea about using <time> needs to be relooked at. The way you answered was perfect. However, my question/idea is not. The reason is the one second intervals VLC updates in is too much for a key press. To be clear, there is always potential to get stuck there. No change is able to be compared to using >=. I am taking a look at using <position>. The position divides the length by 1/0.00000000000000, so the number changes quicker than a millisecond. Here is what I got to work. I will keep working on it. I now need to come up with the logic to go backward. This is a little more tricky because it needs a reasonable time it advances to, for it to be eligible to go back. Thanks so much!
Macro VLCPosFwd
Trigger CF18     Help - how to add the trigger to the macro
 
Code:
Copy      Help
typelib WinHttp {662901FC-6951-4854-9EB2-D9A2570F2B2E} 5.1
WinHttp.WinHttpRequest h._create
str s1="http://127.0.0.1:8080/requests/status.xml"
h.Open("GET" s1)
h.setRequestHeader("content-type", "application/xml");
str enc.encrypt(4 ":vlcremote");;password for vlc http server(username:password) if no usename then just :password
h.SetRequestHeader("Authorization", F"Basic {enc}")
h.send()
err
,out _error.description
,ret
if h.Status=200
,IXml x._create
,x.FromString(h.ResponseText)
,str vlcState =x.RootElement.Child("state").Value
,if vlcState !="stopped"
,,;str vlcLength=x.RootElement.Child("length").Value
,,int vlcLength=1
,,str vlcTime=x.RootElement.Child("position").Value
,,str vlcVolume=x.RootElement.Child("volume").Value
,,str filename=x.Path("root/information/category/info[@name='filename']").Value
,,out vlcLength
,,out vlcTime
,,out vlcVolume
,,out filename
,,double d=val(vlcTime 2) / vlcLength
,,str seek
,,if(d<0.05)
,,,seek="5%"
,,if(d>=0.05 and d<0.10)    
,,,seek="10%"
,,if(d>=0.10 and d<0.15)    
,,,seek="15%"
,,if(d>=0.15 and d<0.20)    
,,,seek="20%"
,,if(d>=0.20 and d<0.25)    
,,,seek="25%"
,,if(d>=0.25 and d<0.30)    
,,,seek="30%"
,,if(d>=0.30 and d<0.35)    
,,,seek="35%"
,,if(d>=0.35 and d<0.40)    
,,,seek="40%"
,,if(d>=0.40 and d<0.45)    
,,,seek="45%"
,,if(d>=0.45 and d<0.50)    
,,,seek="50%"
,,if(d>=0.50 and d<0.55)    
,,,seek="55%"
,,if(d>=0.55 and d<0.60)    
,,,seek="60%"
,,if(d>=0.60 and d<0.65)    
,,,seek="65%"
,,if(d>=0.65 and d<0.70)    
,,,seek="70%"
,,if(d>=0.70 and d<0.75)    
,,,seek="75%"
,,if(d>=0.75 and d<0.80)    
,,,seek="80%"
,,if(d>=0.80 and d<0.85)    
,,,seek="85%"
,,if(d>=0.85 and d<0.90)    
,,,seek="90%"
,,if(d>=0.90 and d<0.95)    
,,,seek="95%"
,,if(d>=0.95)
,,,seek="5%"        
,,seek.escape(9)
,,s1=F"http://127.0.0.1:8080/requests/status.xml?command=seek&val={seek}"
,,h.Open("GET" s1)
,,h.setRequestHeader("content-type", "application/xml");
,,h.SetRequestHeader("Authorization", F"Basic {enc}")
,,h.send()
,,out seek
,else
,,out x.RootElement.Child("state").Value
,,,


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

Forum Jump:


Users browsing this thread: 2 Guest(s)