It is currently May 2nd, 2024, 11:04 am

Exporting "pictures of the day" from rss-feeds

Get help with creating, editing & fixing problems with skins
noirZ
Posts: 12
Joined: November 16th, 2011, 7:18 pm

Exporting "pictures of the day" from rss-feeds

Post by noirZ »

I'm trying to create two "picture of the day"-feeds but it seems like i can't figure out how.
So i'd be very happy if someone could help me, I think if you have the right knowledge this should be no problem at all.

So to precise what i want:
  • - without any fancy gimmicks on the desktop (i.e. no frame or anything)
  • - but with the abilities:
  • to view them full-sized when clicked
  • to downscale correctly because the pictures are of different sizes (if that is possible)
Thanks in advance!

PS: I'm not requesting someone to do it for me (but feel free to :p) with the right resources and/or some tips i may be able to do it myself.
Last edited by noirZ on November 26th, 2011, 10:37 am, edited 1 time in total.
noirZ
Posts: 12
Joined: November 16th, 2011, 7:18 pm

Re: Exporting "pictures of the day" from rss-feeds

Post by noirZ »

*push*
I found out that the Omnimo UI shows the NatGeo pods, but the code looks so overloaded to me I didn't find how the creator did it.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Exporting "pictures of the day" from rss-feeds

Post by jsmorley »

Here is a simple skin that will get "today's" image from Nasa:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeasureImageSite]
Measure=Plugin
Plugin=WebParser.dll
URL=http://apod.nasa.gov/apod/astropix.html
RegExp="(?siU)<IMG SRC="(.*)""
UpdateRate=600

[MeasureImage]
Measure=Plugin
Plugin=WebParser.dll
URL=http://apod.nasa.gov/apod/[MeasureImageSite]
StringIndex=1
Download=1

[MeterOne]
Meter=Image
MeasureName=MeasureImage
W=200
PreserveAspectRatio=1
LeftMouseUpAction=!Execute [[MeasureImage]]
DynamicVariables=1
I haven't really looked at it, but I suspect something similar will work for NatGeo.
Kraden
Posts: 9
Joined: September 5th, 2012, 2:33 pm

Re: Exporting "pictures of the day" from rss-feeds

Post by Kraden »

I tried it like this

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeasureImageSite]
Measure=Plugin
Plugin=WebParser.dll
URL=http://photography.nationalgeographic.com/photography/photo-of-the-day/
RegExp="(?siU)<img src="http://images.nationalgeographic.com/wpf/media-live/photos/*.*""
UpdateRate=3600

[MeasureImage]
Measure=Plugin
Plugin=WebParser.dll
URL=http://photography.nationalgeographic.com/photography/[MeasureImageSite]
StringIndex=1
Download=1

[MeterOne]
Meter=Image
MeasureName=MeasureImage
W=250
PreserveAspectRatio=1
LeftMouseUpAction=!Execute [[MeasureImage]]
DynamicVariables=1
also with the link to the feed, but it doesn work, do i have to change the regexp expression somehow?
Actually i'm quite sure that i have to change that regexp thing. but i don't know how :(
updated to a more serious try, still doesn't work.
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: Exporting "pictures of the day" from rss-feeds

Post by MerlinTheRed »

You have to "capture" the part of the string you want to use. This is done via enclosing the relevant part of the regular expression in braces.

The content of those braces is then accessible by StringIndex. The number of each captured group depends on the number of opening braces up till then. In your example, you simply need to wrap the ".*" into braces.

It's probably also a good idea to escape any quotes with a backslash, just to be sure, although apparently Rainmeter doesn't care about that (I hope escaping them doesn't break anything).

Dots theoretically need to be escaped, too, because in regexp syntax, a dot means "any character". A star means "repeat the previous statement 0 or more times". That's why I removed the "*.*" and replaced it by ".*" meaning "any character combination of characters of any length". Since the regex is set to be "ungreedy" (by the "U" at the start), this statement will match the smallest amount of characters possible, until the next part of the expression (the closing quotes) is found. Finally, here is your regular expression:

"(?siU)<img src=\"http://images\.nationalgeographic\.com/wpf/media-live/photos/(.*)\""

If it doesn't work, try removing the backslashes from the quotes. I'm not entirely sure how Rainmeter treats those, but it should be correct according to the normal rules for regexps.
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
Kraden
Posts: 9
Joined: September 5th, 2012, 2:33 pm

Re: Exporting "pictures of the day" from rss-feeds

Post by Kraden »

Had to do a little bit more, but i got help in the chat. Thank you anyways :)
So here is a working version

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeasureImageSite]
Measure=Plugin
Plugin=WebParser
URL=http://photography.nationalgeographic.com/photography/photo-of-the-day/
RegExp="(?siU)<img src=\"(http://images\.nationalgeographic\.com/wpf/media-live/photos/.*)\""
UpdateRate=3600

[MeasureImage]
Measure=Plugin
Plugin=WebParser
URL=[MeasureImageSite]
StringIndex=1
Download=1

[MeterOne]
Meter=Image
MeasureName=MeasureImage
W=250
PreserveAspectRatio=1
LeftMouseUpAction=[[MeasureImage]]
DynamicVariables=1
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: Exporting "pictures of the day" from rss-feeds

Post by MerlinTheRed »

Yeah I guess that's the most comfortable way ;) I thought you wanted to add the prefix url manually, but that's easier.
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
User avatar
wiedzmawiedzma
Posts: 112
Joined: August 18th, 2012, 5:19 pm

Re: Exporting "pictures of the day" from rss-feeds

Post by wiedzmawiedzma »

MerlinTheRed wrote: "(?siU)<img src=\"http://images\.nationalgeographic\.com/wpf/media-live/photos/(.*)\""
Yes! But he's here is the address given on the plate as
<img src="http://images.nationalgeographic.com/wpf/media-live/photos/000/589/cache/crocodile-teeth-serengeti_58922_990x742.jpg" width="990" height="742" alt="Picture of a crocodile’s teeth"> And as well it should look like RegExp =
when it is like this:
<div id="bgDiv" style="width: 1366px; height: 768px; top: -2.5px; left: 0px; opacity: 1; background-image: url(http://www.bing.com/az/hprichbg?p=rb%2fAfricanLynx_ROW10690415429_1366x768.jpg); ">

or as in the screenshot:
You do not have the required permissions to view the files attached to this post.