It is currently April 26th, 2024, 5:16 pm

[SOLVED] WebParser Substrings Limit

Get help with creating, editing & fixing problems with skins
User avatar
WeissJT
Posts: 3
Joined: June 14th, 2012, 6:22 pm

[SOLVED] WebParser Substrings Limit

Post by WeissJT »

Hi!

I'm trying to make an uTorrent skin that can display up to 8 torrents. The total substrings are 136.
But when the 6th torrent is active, WebParser plugin starts showing the error "Too many substrings!"

There is a way to bypass this limit?

I've tested the "RegExp" with RainRegExp (great app btw) and shows no error. All the substrings after 6th torrent shows the data correctly.

Sorry if I misspelled, I'm not a native english speaker.

RegExp:

Code: Select all

[Variables]
REG=.*(?(?=.*\[\"(.*)\").*,(.*),\"(.*)\",(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),\".*\",(.*),(.*),(.*),(.*),.*,.*,(.*),".*",".*",".*",".*","(.*)".*\][.\],])

[WebUI]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=1
URL=http://#Username#:#Password#@127.0.0.1:8080/gui/?list=1
RegExp="(?siU)torrents.*#REG##REG##REG##REG##REG##REG##REG##REG#"
Last edited by WeissJT on June 22nd, 2012, 4:00 am, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: WebParser Substrings Limit

Post by jsmorley »

First, I'd personally be tempted to just use RegExp="(?siU)^(.*)$" so the entire webpage is captured by WebParser, then jump out to a Lua script, get the value of the WebParser measure and parse it in Lua. Then you can parse out unlimited discrete values as you like, and just use !SetOption bangs to send the values straight to string meters, with !SetOption SomeMeter Text SomeValue and save on having to create 136 "child" WebParser measures in the skin.

That is pretty much how I do it in this skin:

However, having said that, and now turning to actually answering your question.

The only way to get around the limit in native Rainmeter / WebParser is to have two main WebParser measures. Have the first one go out to the uTorrent web interface and get the first "up to 99" captures. Now the question is, how do we have the second one start where the first one left off? What I would do is create the RegExp for the second one that reads through the first 99, but "skips" them with .* instead of capturing them with (.*). Then at item 100, again start capturing with (.*) and get the next 36 (or whatever) StringIndexes.

So you will end up with two parent WebParser measures, one with StringIndexes 1-99, and the second with StringIndexes 1-36. Then you need 99 child WebParser measures to use the first parent as the URL to pick off the values from the first set of StringIndexes, and a second set of child measures using the second parent as the URL to get the rest.
User avatar
WeissJT
Posts: 3
Joined: June 14th, 2012, 6:22 pm

Re: WebParser Substrings Limit

Post by WeissJT »

jsmorley wrote:First, I'd personally be tempted to just use RegExp="(?siU)^(.*)$" so the entire webpage is captured by WebParser, then jump out to a Lua script, get the value of the WebParser measure and parse it in Lua. Then you can parse out unlimited discrete values as you like, and just use !SetOption bangs to send the values straight to string meters, with !SetOption SomeMeter Text SomeValue and save on having to create tons of "child" WebParser measures in the skin.

That is pretty much how I do it in this skin:

[Image]

However, having said that, and now turning to actually answering your question.

The only way to get around the limit in native Rainmeter / WebParser is to have two main WebParser measures. Have the first one go out to the uTorrent web interface and get the first "up to 99" captures. Now the question is, how do we have the second one start where the first one left off? What I would do is create the RegExp for the second one that reads through the first 99, but "skips" them with .* instead of capturing them with (.*). Then at item 100, again start capturing with (.*) and get the next 36 (or whatever) StringIndexes.

So you will end up with two parent WebParser measures, one with StringIndexes 1-99, and the second with StringIndexes 1-36. Then you need 99 child WebParser measures to use the first parent as the URL to pick off the values from the first set of StringIndexes, and a second set of child measures using the second parent as the URL to get the rest.
Wow! That was fast.
I saw that skin made by you, but my knowledge about Lua scripting equals nothing right now :D
Probably I'll learn about it in the near future, but for now I'll try the second option.
Thank so much!
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: WebParser Substrings Limit

Post by jsmorley »

WeissJT wrote:Wow! That was fast.
I saw that skin made by you, but my knowledge about Lua scripting equals nothing right now :D
Probably I'll learn about it in the near future, but for now I'll try the second option.
Thank so much!
Up to you. The thought of a skin with a bare minimum of 138 measures and 136 meters (before you even think about meters for cosmetics and such) makes me shudder a bit, but with clever use of MeterStyles for both the measures and meters, it's mostly just a ton of copy / paste and changing the measure names and StringIndexes and the meter names.
User avatar
WeissJT
Posts: 3
Joined: June 14th, 2012, 6:22 pm

Re: WebParser Substrings Limit

Post by WeissJT »

jsmorley wrote: Up to you. The thought of a skin with a bare minimum of 138 measures and 136 meters (before you even think about meters for cosmetics and such) makes me shudder a bit, but with clever use of MeterStyles for both the measures and meters, it's mostly just a ton of copy / paste and changing the measure names and StringIndexes and the meter names.
Indeed, just a ton of copy and paste. That's what I did in the last 3 days lol.
But it's finished already, I'll adapt the measures to use the 2 WebParser measures and this is it.
Thanks again.
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: WebParser Substrings Limit

Post by jsmorley »

Glad to help.
User avatar
badm0j0
Posts: 1
Joined: January 16th, 2015, 8:29 am

Re: [SOLVED] WebParser Substrings Limit

Post by badm0j0 »

I know this is an old thread,

Just wanted to thank WeisJT for asking this question
and
jsmorley for answering it.

also thanks jsmorley for your luatorrent skin, i know nothing bout lua but with the answer on this page manage to create something i really like.
You do not have the required permissions to view the files attached to this post.