It is currently April 19th, 2024, 8:31 am

[SOLVED] Create a "quote of the day" skin using brainyquote

Get help with creating, editing & fixing problems with skins
tilnic
Posts: 6
Joined: February 14th, 2017, 11:19 pm
Location: Italy

[SOLVED] Create a "quote of the day" skin using brainyquote

Post by tilnic »

Hi everyone! I have a "quote of the day" skin which uses quotationspage.com. Now I want to create a new skin which uses brainyquote.com feed with the same settings. Is it possible? I tried to change the url and the regexp but it doesn't work, I imagine it isn't enough. Here's the code:

Code: Select all

[Rainmeter] 
Update=1000
DynamicWindowSize=1

[Variables]
Prev=1

[MeasureSite] 
Measure=Plugin 
Plugin=WebParser
Url="http://feeds.feedburner.com/brainyquote/QUOTEBR"
RegExp="(?siU)<title>(.*)</title>.*<title>(.*)</title>.*<title>(.*)</title>.*<description>"(.*)"</description>"
UpdateDivider=-1
UpdateRate=-1

[MeasureAuthor1] 
Measure=Plugin 
Plugin=WebParser
URL=[MeasureSite]
DecodeCharacterReference=1
StringIndex=1
IfCondition=#prev# > 4
IfTrueAction=[!setvariable prev 1][!Update][!redraw]
IfCondition2=#prev# <= 0
IfTrueAction2=[!setvariable prev 4][!Update][!redraw]
DynamicVariables=1

[MeasureQuote1] 
Measure=Plugin 
Plugin=WebParser
URL=[MeasureSite]
StringIndex=2

[MeasureAuthor2] 
Measure=Plugin 
Plugin=WebParser
URL=[MeasureSite]
DecodeCharacterReference=1
StringIndex=3

[MeasureQuote2] 
Measure=Plugin 
Plugin=WebParser
URL=[MeasureSite]
DecodeCharacterReference=1
StringIndex=4

[MeasureAuthor3] 
Measure=Plugin 
Plugin=WebParser
URL=[MeasureSite]
DecodeCharacterReference=1
StringIndex=5

[MeasureQuote3] 
Measure=Plugin 
Plugin=WebParser
URL=[MeasureSite]
DecodeCharacterReference=1
StringIndex=6

[MeasureAuthor4] 
Measure=Plugin 
Plugin=WebParser
URL=[MeasureSite]
DecodeCharacterReference=1
StringIndex=7

[MeasureQuote4] 
Measure=Plugin 
Plugin=WebParser
URL=[MeasureSite]
DecodeCharacterReference=1
StringIndex=8

;;;;;;;;;;;;;;;

[MeterQuote] 
Meter=String 
MeasureName=MeasureQuote#prev#
X=505
ClipString=2
ClipStringW=370
FontColor=255,255,255,230
FontFace=Josefin Sans
FontSize=13
StringEffect=SHADOW
StringAlign=Center
AntiAlias=1
SolidColor=0,0,0,1
MouseScrollUpAction=[!SetVariable Prev "(#prev#-1)"][!Update][!redraw]
MouseScrollDownAction=[!SetVariable Prev "(#prev#+1)"][!Update][!redraw]
DynamicVariables=1

[MeterAuthor]
Meter=String
MeasureName=MeasureAuthor#prev#
MeterStyle=MeterQuote
StringStyle=BoldItalic
Y=2R
DynamicVariables=1
Many thanks in advance
Last edited by tilnic on February 25th, 2017, 7:28 pm, edited 1 time in total.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Create a "quote of the day" skin using brainyquote

Post by balala »

Try to add the following variable, to the [Variables] section (will be used immediately):

Code: Select all

Item=<title>(.*)</title>.*<description>"(.*)"</description>.*<link>(.*)</link>
Replace the RegExp option of the [MeasureSite] measure with:

Code: Select all

RegExp=(?siU)<title>.*</title>.*<title>.*</title>.*#Item#.*#Item#.*#Item#
Note that you can add further #Item# variables if you need, but in such case, you also will have to add further child WebParser measures.
If you did all this, you have to modify the StringIndex options, as it follows:

Code: Select all

[MeasureAuthor1] 
...
StringIndex=1

[MeasureQuote1] 
...
StringIndex=2
You also can add the following measure, which will return a link:

Code: Select all

[MeasureLink1]
Measure=Plugin 
Plugin=WebParser
URL=[MeasureSite]
StringIndex=3
tilnic
Posts: 6
Joined: February 14th, 2017, 11:19 pm
Location: Italy

Re: Create a "quote of the day" skin using brainyquote

Post by tilnic »

balala wrote:Try to add the following variable, to the [Variables] section (will be used immediately):

Code: Select all

Item=<title>(.*)</title>.*<description>"(.*)"</description>.*<link>(.*)</link>
Replace the RegExp option of the [MeasureSite] measure with:

Code: Select all

RegExp=(?siU)<title>.*</title>.*<title>.*</title>.*#Item#.*#Item#.*#Item#
Note that you can add further #Item# variables if you need, but in such case, you also will have to add further child WebParser measures.
If you did all this, you have to modify the StringIndex options, as it follows:

Code: Select all

[MeasureAuthor1] 
...
StringIndex=1

[MeasureQuote1] 
...
StringIndex=2
You also can add the following measure, which will return a link:

Code: Select all

[MeasureLink1]
Measure=Plugin 
Plugin=WebParser
URL=[MeasureSite]
StringIndex=3
Thank you so much. I have only an issue: when i scroll two quotes are working but other two appear like the picture
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Create a "quote of the day" skin using brainyquote

Post by balala »

tilnic wrote:Thank you so much. I have only an issue: when i scroll two quotes are working but other two appear like the picture
Please post the whole code of your skin.
tilnic
Posts: 6
Joined: February 14th, 2017, 11:19 pm
Location: Italy

Re: Create a "quote of the day" skin using brainyquote

Post by tilnic »

balala wrote:Please post the whole code of your skin.
Here's the code

Code: Select all

[Rainmeter] 
Update=1000
DynamicWindowSize=1

[Variables]
Prev=1
Item=<title>(.*)</title>.*<description>"(.*)"</description>.*<link>(.*)</link>

[MeasureSite] 
Measure=Plugin 
Plugin=WebParser
Url="http://feeds.feedburner.com/brainyquote/QUOTEBR"
RegExp=(?siU)<title>.*</title>.*<title>.*</title>.*#Item#.*#Item#.*#Item#
UpdateDivider=-1
UpdateRate=-1

[MeasureAuthor1] 
Measure=Plugin 
Plugin=WebParser
URL=[MeasureSite]
DecodeCharacterReference=1
StringIndex=1
IfCondition=#prev# > 4
IfTrueAction=[!setvariable prev 1][!Update][!redraw]
IfCondition2=#prev# <= 0
IfTrueAction2=[!setvariable prev 4][!Update][!redraw]
DynamicVariables=1

[MeasureQuote1] 
Measure=Plugin 
Plugin=WebParser
URL=[MeasureSite]
StringIndex=2

[MeasureAuthor2] 
Measure=Plugin 
Plugin=WebParser
URL=[MeasureSite]
DecodeCharacterReference=1
StringIndex=3

[MeasureQuote2] 
Measure=Plugin 
Plugin=WebParser
URL=[MeasureSite]
DecodeCharacterReference=1
StringIndex=4

[MeasureAuthor3] 
Measure=Plugin 
Plugin=WebParser
URL=[MeasureSite]
DecodeCharacterReference=1
StringIndex=5

[MeasureQuote3] 
Measure=Plugin 
Plugin=WebParser
URL=[MeasureSite]
DecodeCharacterReference=1
StringIndex=6

[MeasureAuthor4] 
Measure=Plugin 
Plugin=WebParser
URL=[MeasureSite]
DecodeCharacterReference=1
StringIndex=7

[MeasureQuote4] 
Measure=Plugin 
Plugin=WebParser
URL=[MeasureSite]
DecodeCharacterReference=1
StringIndex=8

[MeasureLink1]
Measure=Plugin 
Plugin=WebParser
URL=[MeasureSite]
StringIndex=9

;;;;;;;;;;;;;;;

[MeterQuote] 
Meter=String 
MeasureName=MeasureQuote#prev#
X=505
ClipString=2
ClipStringW=370
FontColor=255,255,255,230
FontFace=Josefin Sans
FontSize=13
StringEffect=SHADOW
StringAlign=Center
AntiAlias=1
SolidColor=0,0,0,1
MouseScrollUpAction=[!SetVariable Prev "(#prev#-1)"][!Update][!redraw]
MouseScrollDownAction=[!SetVariable Prev "(#prev#+1)"][!Update][!redraw]
DynamicVariables=1

[MeterAuthor]
Meter=String
MeasureName=MeasureAuthor#prev#
MeterStyle=MeterQuote
StringStyle=BoldItalic
Y=2R
DynamicVariables=1
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Create a "quote of the day" skin using brainyquote

Post by balala »

The StringIndex values are wrong. Modify them, as it follows:

Code: Select all

[MeasureAuthor1] 
...
StringIndex=1
...

[MeasureQuote1] 
...
StringIndex=2

[MeasureAuthor2] 
...
StringIndex=4

[MeasureQuote2] 
...
StringIndex=5

[MeasureAuthor3] 
...
StringIndex=7

[MeasureQuote3] 
...
StringIndex=8

[MeasureAuthor4] 
...
StringIndex=10

[MeasureQuote4] 
...
StringIndex=11
Leave alone the not posted options, of the above measures.
A few more:
  • You can add, besides [MeasureLink1], some other similar "link" measures, to get all links, of each quotation. For this, add, beside [MeasureLink1], the following measures:

    Code: Select all

    [MeasureLink1]
    Measure=Plugin 
    Plugin=WebParser
    URL=[MeasureSite]
    StringIndex=3
    
    [MeasureLink2]
    Measure=Plugin 
    Plugin=WebParser
    URL=[MeasureSite]
    StringIndex=6
    
    [MeasureLink3]
    Measure=Plugin 
    Plugin=WebParser
    URL=[MeasureSite]
    StringIndex=9
    
    [MeasureLink4]
    Measure=Plugin 
    Plugin=WebParser
    URL=[MeasureSite]
    StringIndex=12
    (Be careful, the StringIndex option of the [MeasureLink1] measure is also replaced, fix it).
  • Add the following option, to the [MeterQuote] meter: LeftMouseUpAction=["[MeasureLink#Prev#]"]. This way, if you click a quotation, the appropriate page will open.
  • Three #Item# variables into the RegExp option of the [MeasureSite] measure are not enough. When you scroll, the Prev variable gets the values between 1 and 4, so I'd add at least one more #Item# variable.
  • If on the page are less quotations, than the number of added #Item# variables, the skin won't work, because it can't get so many quotations as many variables are. To fix this, I modified the Item variable, to use the Lookahead Assertion: Item=(?(?=.*<tit).*le>(.*)</title>.*<description>"(.*)"</description>.*<link>(.*)</link>). Now you can add as many #Item# variables, as you'd like. The first ones will return the existent quotations and authors, the last one will return empty strings, but the measure will work.
tilnic
Posts: 6
Joined: February 14th, 2017, 11:19 pm
Location: Italy

Re: Create a "quote of the day" skin using brainyquote

Post by tilnic »

@balala You are a genius! Everything works well now, I really appreciate your help. Thank you so much!!!
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [SOLVED] Create a "quote of the day" skin using brainyquote

Post by balala »

Glad to help.