dasiun wrote: ↑May 15th, 2024, 9:25 pm
thanks, i think it works perfectly.
You're welcome, I'm glad if it does.
dasiun wrote: ↑May 15th, 2024, 10:41 pm
I put a
Substitute="18":"CurrSubs" in the "Subscribers" string so it doesnt show 18 again.
Yeah, I don't think that's a solution to avoid the measure matching the wrong number. CurrSubs is just a string, [CurrSubs] is the value of the that measure, but in any case it doesn't make much sense to do it. If the format of the response received in WebParserDump.txt alternates for you too like mentioned earlier, try this:
Code: Select all
[Variables]
PrevSubs=0
[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
BackgroundMode=2
SolidColor=0,0,0,255
[StatsSubs]
Measure=WebParser
URL=https://www.youtube.com/dasiun
;URL=file://#CURRENTPATH#WebParserDump.txt
UserAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
Flags=ForceReload | NoCookies
RegExp=(?siU)(?|.*"contentMetadataViewModel":.*?"metadataParts".*"text":.*"content":.*"(\d+) .*"|.*?"subscriberCountText":.*"[^"]*text":"(\d+) .*")
StringIndex=1
UpdateRate=3600
Debug=2
FinishAction=[!EnableMeasure CurrSubs][!UpdateMeasure CurrSubs]
[CurrSubs]
Disabled=1
Measure=Calc
Formula=[&StatsSubs]
UpdateDivider=-1
IfCondition=(#CURRENTSECTION#<#PrevSubs#)
IfTrueAction=[!SetVariable PrevSubs [CurrSubs]][!WriteKeyValue Variables PrevSubs [CurrSubs]][!SetOption Subscribers FontColor "255,0,0,255"][!UpdateMeter Subscribers][!Redraw]
IfCondition2=(#CURRENTSECTION#>#PrevSubs#)
IfTrueAction2=[!SetVariable PrevSubs [CurrSubs]][!WriteKeyValue Variables PrevSubs [CurrSubs]][!SetOption Subscribers FontColor "0,255,0,255"][!UpdateMeter Subscribers][!Redraw]
;IfCondition3=(#CURRENTSECTION#=#PrevSubs#)
;IfTrueAction3=[!SetVariable PrevSubs [CurrSubs]][!WriteKeyValue Variables PrevSubs [CurrSubs]][!SetOption Subscribers FontColor "255,255,255,255"][!UpdateMeter Subscribers][!Redraw]
DynamicVariables=1
[Subscribers]
Meter=String
MeasureName=StatsSubs
StringAlign=Left
Y=0
X=0
FontSize=37
FontColor=255,255,255,255
AntiAlias=1
Text=Subs: %1
I used a "
branch reset group" here as the RegExp pattern, which basically tries to match the part before the | and do the number capture, and if it fails it tries to match the part after the | and do the number capture. The | symbol means "OR".
I also left the equality test commented out in case you need that behavior. Assuming the last subs before loading the skin was 363 and you have a progression of subs like 363, 364, 364 on subsequent measure updates after loading the skin:
- if uncommented the text will be white (363=363), green (364>363), and then white again (364=364) until an increase or decrease occurs
- if commented the text will be white (default), green (364>363), and then still green (no action) until an increase or decrease occurs
In other words, when uncommented the color is strictly based on the comparison to the previous value so white will occur as soon as they are equal, while when commented the color will stay true to the green or red "trend" last registered even though the current value might be equal to the last value from one update to another.