It is currently May 1st, 2024, 3:24 am

If command to disable webparser measure upon empty return?

Get help with creating, editing & fixing problems with skins
bohregard
Posts: 2
Joined: April 19th, 2012, 11:30 pm

If command to disable webparser measure upon empty return?

Post by bohregard »

So I'm using the webparser plugin to parse this page:

Code: Select all

<queue>
<active_lang>en</active_lang>
<paused>False</paused>
<restart_req>False</restart_req>
<power_options>True</power_options>
<slots>
<slot>
<status>Downloading</status>
<index>0</index>
<eta>20:08 Thu 19 Apr</eta>
<missing>0</missing>
<avg_age>231d</avg_age>
<script>sabToSickBeard.exe</script>
<msgid/>
<verbosity/>
<mb>4919.35</mb>
<sizeleft>3.5 GB</sizeleft>
<filename>Tenchi Muyo! Ryo Ohki (OVA 1 3)</filename>
<priority>Normal</priority>
<cat>tv</cat>
<mbleft>3584.85</mbleft>
<timeleft>0:40:15</timeleft>
<percentage>27</percentage>
<nzo_id>SABnzbd_nzo_2ai2cg</nzo_id>
<unpackopts>3</unpackopts>
<size>4.8 GB</size>
</slot>
</slots>
<speed>1.5 M</speed>
<helpuri>http://wiki.sabnzbd.org/</helpuri>
<size>4.8 GB</size>
<uptime>5d</uptime>
<refresh_rate/>
<limit>0</limit>
<isverbose>False</isverbose>
<start>0</start>
<finish>0</finish>
<version>0.6.15</version>
<new_rel_url/>
<diskspacetotal2>2794.36</diskspacetotal2>
<color_scheme>gold</color_scheme>
<diskspacetotal1>119.02</diskspacetotal1>
<nt>True</nt>
<status>Downloading</status>
<last_warning>
</last_warning>
<have_warnings>2</have_warnings>
<cache_art>0</cache_art>
<sizeleft>3.5 GB</sizeleft>
<finishaction>None</finishaction>
<paused_all>False</paused_all>
<cache_size>0 B</cache_size>
<newzbin_url>www.newzbin2.es</newzbin_url>
<new_release/>
<pause_int>0</pause_int>
<mbleft>3584.85</mbleft>
<diskspace1>71.74</diskspace1>
<scripts>
<script>None</script>
<script>sabToSickBeard.exe</script>
</scripts>
<categories>
<category>*</category>
<category>comics</category>
<category>music</category>
<category>negima 2</category>
<category>software</category>
<category>tv</category>
</categories>
<darwin>False</darwin>
<timeleft>0:40:15</timeleft>
<mb>4919.35</mb>
<noofslots>1</noofslots>
<eta>20:08 Thu 19 Apr</eta>
<nzb_quota/>
<loadavg/>
<cache_max>0</cache_max>
<kbpersec>1519.68</kbpersec>
<speedlimit/>
<webdir>
C:\Program Files (x86)\SABnzbd\interfaces\Plush\templates
</webdir>
<queue_details>0</queue_details>
<diskspace2>2034.90</diskspace2>
</queue>
However the problem I run into is that when I add a file to this website, the xml populates another <slot>....</slot> field with all the stuff in between. That's not really a problem, the problem is really when the xml removes said field when the process is finished.

My question: Is there a way to adjust the code in rainmeter to disable the webparser measures that produce errors because the measure has matching errors (due to the field no longer being there)?

Here's the code I'm using for refrence:

Code: Select all

[mSab]
Measure=Plugin
Plugin=WebParser
UpdateRate=1
URL="#HOST_PORT#/api?mode=queue&start=START&limit=LIMIT&output=xml&apikey=#APIKEY#"
RegExp=(?siU)<queue>(.*)</queue>

[mSabSpeed]
Measure=Plugin
Plugin=WebParser
UpdateRate=1
URL=[mSab]
RegExp=(?siU)<speed>(.*)</speed>
StringIndex2=1
StringIndex=1

[mSabItem1]
Measure=Plugin
Plugin=WebParser
UpdateRate=1
URL=[mSab]
RegExp=(?siU)<slot>(.*)</slot>
StringIndex2=1
StringIndex=1
ErrorString=N/A

[mSabItem2]
Measure=Plugin
Plugin=WebParser
UpdateRate=1
URL=[mSab]
RegExp=(?siU)<slot>(.*)</slot>.*<slot>(.*)</slot>
StringIndex2=2
StringIndex=1
ErrorString=N/A

[mItem1]
Measure=Plugin
Plugin=WebParser
UpdateRate=1
URL=[mSabItem1]
RegExp=(?siU)<filename>(.*)</filename>
StringIndex2=1
StringIndex=1
ErrorString=N/A

[mItem1Total]
Measure=Plugin
Plugin=WebParser
UpdateRate=1
URL=[mSabItem1]
RegExp=(?siU)<size>(.*)</size>
StringIndex2=1
StringIndex=1
ErrorString=N/A

[mItem1Left]
Measure=Plugin
Plugin=WebParser
UpdateRate=1
URL=[mSabItem1]
RegExp=(?siU)<sizeleft>(.*)</sizeleft>
StringIndex2=1
StringIndex=1
ErrorString=N/A

[mItem1Time]
Measure=Plugin
Plugin=WebParser
UpdateRate=1
URL=[mSabItem1]
RegExp=(?siU)<timeleft>(.*)</timeleft>
StringIndex2=1
StringIndex=1
ErrorString=N/A

[mItem1Percent]
Measure=Plugin
Plugin=WebParser
UpdateRate=1
URL=[mSabItem1]
RegExp=(?siU)<percentage>(.*)</percentage>
StringIndex2=1
StringIndex=1
ErrorString=N/A
MaxValue=100
MinValue=0

[mItem2]
Measure=Plugin
Plugin=WebParser
UpdateRate=1
URL=[mSabItem2]
RegExp=(?siU)<filename>(.*)</filename>
StringIndex2=1
StringIndex=2
ErrorString=N/A

[mItem2Total]
Measure=Plugin
Plugin=WebParser
UpdateRate=1
URL=[mSabItem2]
RegExp=(?siU)<size>(.*)</size>
StringIndex2=1
StringIndex=2
ErrorString=N/A

[mItem2Left]
Measure=Plugin
Plugin=WebParser
UpdateRate=1
URL=[mSabItem2]
RegExp=(?siU)<sizeleft>(.*)</sizeleft>
StringIndex2=1
StringIndex=2
ErrorString=N/A

[mItem2Time]
Measure=Plugin
Plugin=WebParser
UpdateRate=1
URL=[mSabItem2]
RegExp=(?siU)<timeleft>(.*)</timeleft>
StringIndex2=1
StringIndex=2
ErrorString=N/A

[mItem2Percent]
Measure=Plugin
Plugin=WebParser
UpdateRate=1
URL=[mSabItem2]
RegExp=(?siU)<percentage>(.*)</percentage>
StringIndex2=1
StringIndex=2
ErrorString=N/A
MaxValue=100
MinValue=0
It's not really a big deal since the only thing that bugs me is the log page has tons of error messages constantly showing up. It just makes sorting through them a pain.

Thanks!
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: If command to disable webparser measure upon empty retur

Post by jsmorley »

What might be better is to use Lookahead assertions so a given WebParser just returns an empty string when it fails, instead of sending an error to the log.

RegExp=(?siU)(?(?=<slot>(.*)</slot>.*<slot>(.*)</slot>)<slot>(.*)</slot>.*<slot>(.*)</slot>)
bohregard
Posts: 2
Joined: April 19th, 2012, 11:30 pm

Re: If command to disable webparser measure upon empty retur

Post by bohregard »

Ahhhh, ok I'll give that a go. Thanks!