It is currently April 27th, 2024, 11:22 pm

Getting chess board from website

Get help with creating, editing & fixing problems with skins
bredal187
Posts: 19
Joined: September 7th, 2011, 8:10 am

Getting chess board from website

Post by bredal187 »

Hi, I´m currently working on a chess focused skin.
Here's a creendump on how i want it to end up looking



The buttons all work, so i only have 2 "hard" jobs to do.... however, this is my first (ambitious) try to make a skin in rainmeter so i need some help.

I want to get the "game of the day" and the "opening of the day" from chess.com

I need helt extracting the chessboard and pieces and the "headline" that says which game or opening it is.
But i have no clue where to start :-(

Help anyone?


I will of course release the skin as soon as it´s done...free of charge and all... :great:
Last edited by smurfier on December 14th, 2011, 3:31 am, edited 1 time in total.
Reason: Added HSimg tags.
User avatar
Seahorse
Posts: 1175
Joined: June 9th, 2010, 5:56 pm
Location: Locks heath, UK

Re: Getting chess board from website

Post by Seahorse »

Start with Rainmeter 101 and move on to calcs and the webparser plugin I guess, I have not tackled or seem similar in Rainmeter. I'm sure there are other approaches such as lua (cough) but that melts my brain currently... :great:
"Regrettably your planet is one of those scheduled for demolition"
Mike

My Skins at DeviantArt

bredal187
Posts: 19
Joined: September 7th, 2011, 8:10 am

Re: Getting chess board from website

Post by bredal187 »

Thanks.

Been looking through the webparser section and found a tutorial on how to get certains information from a site.
Unfortunately i have just discovered that the site where i want to get the "opening of the day" from uses a new url pr day / opening so i guess its simply not possible :( ?
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Getting chess board from website

Post by Mordasius »

bredal187 wrote:Thanks.
Unfortunately i have just discovered that the site where i want to get the "opening of the day" from uses a new url pr day / opening so i guess its simply not possible :( ?
It is actually very possible. You can use the following to get to the correct url each day (based on the tip shown here) :

Code: Select all

[mOpeningOTDpage] 
Measure=Plugin 
Plugin=Plugins\WebParser.dll 
UpdateRate=3600
Url=http://www.chess.com/games/
RegExp="(?siU)>Opening of the Day</a>.*<a href="(.*)" id="

[mOpeningOTD]
Measure=Plugin 
Plugin=Plugins\WebParser.dll 
UpdateRate=3605
Url=http://www.chess.com/games[mOpeningOTDpage] 
RegExp= "<-Whatever you want to get->"
The hard part is formulating RegExp= "<-Whatever you want to get->". I had a quick look at the page but couldn't see any easy way to handle an unknown number of moves for the 'Opening of the Day' without resorting to a LUA script. Am I right in assuming there is a different number of opening moves each day?

P.S. It might help if you could re-post the image showing what you are trying to achieve.
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Getting chess board from website

Post by Kaelri »

Mordasius wrote:

Code: Select all

[mOpeningOTDpage] 
Measure=Plugin 
Plugin=Plugins\WebParser.dll 
UpdateRate=3600
Url=http://www.chess.com/games/
RegExp="(?siU)>Opening of the Day</a>.*<a href="(.*)" id="

[mOpeningOTD]
Measure=Plugin 
Plugin=Plugins\WebParser.dll 
UpdateRate=3605
Url=http://www.chess.com/games[mOpeningOTDpage] 
RegExp= "<-Whatever you want to get->"
I don't believe that would work, since you can't use dynamic variables with plugins. You'd need to use some variation on this method to get the result from the first measure into the URL in the second one.
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Getting chess board from website

Post by Mordasius »

Kaelri wrote:I don't believe that would work, since you can't use dynamic variables with plugins. You'd need to use some variation on this method to get the result from the first measure into the URL in the second one.
You're right as usual. I should have tested it before posting :? What is needed is something like:

Code: Select all

[Variables]
OpeningPage=Unknown Page

[mGetURL]
Measure=Plugin
Plugin=WebParser.dll
UpdateRate=3600
Url=http://www.chess.com/games/
RegExp="(?siU)>Opening of the Day</a>.*<a href="(.*)" id="
StringIndex=1
FinishAction=!Execute [!WriteKeyValue Variables "OpeningPage" "[mGetURL]"] [!WriteKeyValue mGetURL Disabled 1] [!Refresh]
Disabled=0

[mGetOpening]
Measure=Plugin
Plugin=WebParser.dll
UpdateRate=3605
Url=http://www.chess.com/#OpeningPage#
RegExp="(?siU)<title.*>(.*)- Openings.*</title>"
StringIndex=1

[TodaysOpeningName] 
Meter=STRING
MeasureName=mGetOpening
FontColor=FFFFFFDD
FontFace=Trebuchet MS
FontSize=10
W=600
H=18
Text="Today's Opening:  %1"
Unfortunately, that is the easy part..
bredal187
Posts: 19
Joined: September 7th, 2011, 8:10 am

Re: Getting chess board from website

Post by bredal187 »

Been trying to figure out how all this works but must admit i've come to the conclussion i suck :/

Thx for the feedback though :)
dgee
Posts: 1
Joined: December 14th, 2011, 3:24 am

Re: Getting chess board from website

Post by dgee »

I think you would probably have to build a way to represent the pieces within rainmeter. So you would have to have images of each piece which would be positioned based on the move list which would have to be parsed and iterated with a button on the custom skin. Assuming you had the data parsed you could start by making a chessboard in rainmeter.
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Getting chess board from website

Post by smurfier »

dgee wrote:I think you would probably have to build a way to represent the pieces within rainmeter. So you would have to have images of each piece which would be positioned based on the move list which would have to be parsed and iterated with a button on the custom skin. Assuming you had the data parsed you could start by making a chessboard in rainmeter.
Please do not grave dig old topics.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .