It is currently April 26th, 2024, 9:42 pm

Help with WebParser

Get help with creating, editing & fixing problems with skins
WilsAlt0248n
Posts: 2
Joined: February 5th, 2017, 6:51 pm

Help with WebParser

Post by WilsAlt0248n »

So I am trying to make a Teamspeak 3 Server Reader that blends with the Enigma Sidebar. I do this by using the WebParser to check https://www.tsviewer.com/ts3viewer.php?ID=1096257 (some random ts for this example). The problem is, there can be anywhere between 0 and 32 people on my Teamspeak 3 server at a time, and if I use the WebParser to check if there is 1 more person than what is on the teamspeak, I get "RegExp matching error (-8)". (i.e. if I check for 32 people's info, and there are 8 people connected, I get the error.)

I included my entire skin in the description, also its my first skin so pardon the spaghetti code.
If you want to test it, just add variable: #GetInfo# to the RegExp in [MeasureSite] until you the error

If anyone knows how to fix this, or if I can do anything to clean it up let me know.
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16174
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with WebParser

Post by balala »

WilsAlt0248n wrote:So I am trying to make a Teamspeak 3 Server Reader that blends with the Enigma Sidebar. I do this by using the WebParser to check https://www.tsviewer.com/ts3viewer.php?ID=1096257 (some random ts for this example). The problem is, there can be anywhere between 0 and 32 people on my Teamspeak 3 server at a time, and if I use the WebParser to check if there is 1 more person than what is on the teamspeak, I get "RegExp matching error (-8)". (i.e. if I check for 32 people's info, and there are 8 people connected, I get the error.)

I included my entire skin in the description, also its my first skin so pardon the spaghetti code.
If you want to test it, just add variable: #GetInfo# to the RegExp in [MeasureSite] until you the error

If anyone knows how to fix this, or if I can do anything to clean it up let me know.
Classical question of using the Lookahead Assertions in RegExp.
To fix your issue, you have to modify the GetInfo variable. Replace it with the following one: GetInfo=(?(?=.*nick).*name=(.*)data-c.*#GetMicStatus#.*#GetSoundStatus#). See that first time this expression will check if any new nick expressions exists. If it does, the needed information, otherwise empty strings will be returned.
Now you can add as many #GetInfo# variables to the RegExp option of the [MeasureSite] measure as many you'd like or need. 32, for example. The firsts will return the needed strings, the others will return, as I said, empty strings.
WilsAlt0248n
Posts: 2
Joined: February 5th, 2017, 6:51 pm

Re: Help with WebParser

Post by WilsAlt0248n »

Nice, works now, Thanks! :D Been tearing my hair out for like two hours trying to figure it out.
If there is anything I can do to shorten the code (900 lines seems excessive), let me know as well.
User avatar
balala
Rainmeter Sage
Posts: 16174
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with WebParser

Post by balala »

WilsAlt0248n wrote:Nice, works now, Thanks! :D Been tearing my hair out for like two hours trying to figure it out.
It's not too easy to figure out how the Lookahead Assertions work, I also spent hours and hours with it, a while ago. But sometimes it can be extremely useful.
WilsAlt0248n wrote:If there is anything I can do to shorten the code (900 lines seems excessive), let me know as well.
Not too much. Just if you can find something to remove. But probably you won't, so leave it as it is now. That's not a problem. I had much larger codes, which worked well.