It is currently June 29th, 2022, 3:24 pm

Reader

Discuss the use of Lua in Script measures.
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: [Proof of Concept] Universal Feed Reader

Post by Kaelri »

ravisurdhar wrote:Hey, this looks cool...nice work! Any way it could be adapted to display entries from multiple RSS/XML/ical/whatever feeds in the same window, instead of cycling between each feed source?
The script already supports multiple instances in the same skin. You just need to use the "VariablePrefix" setting to distinguish each set of variables. See this post from earlier in this thread.
Cevandri
Posts: 18
Joined: August 6th, 2011, 9:36 pm
Location: Sweden -> gothenburg

Re: [Proof of Concept] Universal Feed Reader

Post by Cevandri »

I really should start browsing the forums more... rather than the manual.
you sure just saved me from trying to write a atom feed reader.. and the RSS feed reader itself took several days... heck how can you be this amazing?

thumbs up mate!
You are a savior of the rainmeter community, At least for me you are!
Old rainmeter user..... 4+ years ago I was active... :-p 8-)
scash
Posts: 8
Joined: January 23rd, 2011, 1:13 am

Re: [Proof of Concept] Universal Feed Reader

Post by scash »

Any way to get the feeds to rotate every 30 seconds?



And how would I go about adding a dividing line or a gap between the title and the feeds?


Thanks very much, this was exactly what I was hoping to get from Rainmeter
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: [Proof of Concept] Universal Feed Reader

Post by Kaelri »

scash wrote:Any way to get the feeds to rotate every 30 seconds?
Sure. The script includes "switch to next" and "switch to previous" functions, so you can do this with a simply Calc measure:

Code: Select all

[Switcher]
Measure=CALC
Formula=Counter % 30 = 0
IfEqualValue=1
IfEqualAction=!CommandMeasure "MeasureLuaScript" "SwitchToNext()"
scash wrote:And how would I go about adding a dividing line or a gap between the title and the feeds?
In the example skin, find the section [FeedItem1] (which is the first feed item) and add the following line:

Code: Select all

Y=10R
This will place the meter 10 pixels below the bottom edge of the previous meter, [FeedTitle], which is the title meter. Increase or decrease this value as desired. For a dividing line, you can add an Image meter between these two sections such as the following:

Code: Select all

[FeedTitle]
Meter=STRING
MeterStyle=StyleText
X=10
H=25
FontSize=15
StringStyle=BOLD
Text=#FeedTitle#
LeftMouseUpAction=#FeedLink#
ToolTipText=#FeedLink#

[FeedTitleBorder]
Meter=IMAGE
SolidColor=255,255,255,192
X=r
Y=10R
W=300
H=1

[FeedItem1]
Meter=STRING
MeterStyle=StyleText
Text=#ItemTitle1#
LeftMouseUpAction=#ItemLink1#
ToolTipText=#ItemLink1#
Y=10R
Adjust the dimensions - X, Y, W(idth), H(eight) - as desired.
scash
Posts: 8
Joined: January 23rd, 2011, 1:13 am

Re: [Proof of Concept] Universal Feed Reader

Post by scash »

Thanks for the quick reply!

Switcher only works for the first group though. I tried adding and changing a second variant to

Code: Select all

[Switcher]
Measure=CALC
Formula=Counter % 30 = 0
IfEqualValue=1
IfEqualAction=!CommandMeasure "List2.MeasureLuaScript" "SwitchToNext()"
where the only modified part is I changed the last line to include "List2." and I tried placing the whole thing in different spots. What am I missing?

Its been a while since I did any coding, and I'm not familiar with this, although it does make some sense. Definitely going to play around with it in the coming weeks :D


SCRATCH THAT! Figured it out. Haha. I had to change the name of the header, [Switcher] to [Switcher2]. Not sure if the placement helped, but I have it placed at the very end, just above metadata, while first switcher is just below the first list group. Thank you for this!!
User avatar
KreAch3R
Posts: 608
Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR

Re: [Proof of Concept] Universal Feed Reader

Post by KreAch3R »

Hi again,

I modified your skin to display feed information this way:

Code: Select all

NumberOfFeeds=2
FeedMeasureName1=MeasureFeed
FeedMeasureName2=MeasureFeed2
CurrentFeed=1

List2.NumberOfFeeds=2
List2.FeedMeasureName1=MeasureFeed3
List2.FeedMeasureName2=MeasureFeed4
List2.CurrentFeed=1

List3.NumberOfFeeds=2
List3.FeedMeasureName1=MeasureFeed5
List3.FeedMeasureName2=MeasureFeed6
List3.CurrentFeed=1

List4.NumberOfFeeds=2
List4.FeedMeasureName1=MeasureFeed7
List4.FeedMeasureName2=MeasureFeed8
List4.CurrentFeed=1
Everything works as it should. The only "hick-up" appears when you first refresh the skin; The 2 first Lists ("list1" & "List2") appear correctly, but in the last 2 the error message "no valid feed found" appears. If I press the grabbers, to change to feed6 & feed8 respectively, then the feeds' contents display correctly. Then, I can change back to the feed5 & feed7 normally. I think it may be some sort of "work overload" for the lua script (trying to read to many feeds?). But I wouldn't know, so I thought I'd share it here.

I have enabled automatic scrolling between the feeds, so that after x seconds the 2 respective feed appears. So this isn't a big problem. I would like to know though, if I could do something about it. As always, thank you in advance.
Inactive, due to life changes. Send me a PM for any question.

Desktop DeviartArt
Image
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: [Proof of Concept] Universal Feed Reader

Post by Kaelri »

You'll notice that in the original skin, the first WebParser measure for each list has a FinishAction which updates the script, as such:

Code: Select all

FinishAction=!CommandMeasure "MeasureLuaScript" "Update()"
Without these actions, the script measures won't update until 10 minutes after the skin is loaded (UpdateDivier=600). I suspect you just need to add a similar action on your [MeasureFeed5] and [MeasureFeed7] to update the scripts for List3 and List4, respectively. :)
User avatar
KreAch3R
Posts: 608
Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR

Re: [Proof of Concept] Universal Feed Reader

Post by KreAch3R »

Yes, that did it. :D When duplicating measures, I didn't notice that difference in MeasureFeeds. Now, every feed "starter" (1,3,5,7) has it's FinishAction and updates automatically. You can see my 4feed version on my signature, I hope you like it. :)

P.S: I found a feed that doesn't have <title> tag :?. Is there any easy way to inject a custom one? Here it is. (I hope you don't mind me asking so many questions :oops: ).
Inactive, due to life changes. Send me a PM for any question.

Desktop DeviartArt
Image
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: [Proof of Concept] Universal Feed Reader

Post by Kaelri »

KreAch3R wrote:I found a feed that doesn't have <title> tag :?. Is there any easy way to inject a custom one? Here it is. (I hope you don't mind me asking so many questions :oops: ).
Not a bit. Here's a few lines that would replace a blank <title> value for this specific case, as well as the general case. Insert it in your Update() function sometime before the SKIN:Bangs are sent:

Code: Select all

if sFeedTitle == '' then
	if string.match (sRaw, '<link>http://www.techgear.gr</link>') then
		sFeedTitle = 'TechGear'
	else
		sFeedTitle = 'Untitled'
	end
end
User avatar
KreAch3R
Posts: 608
Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR

Re: [Proof of Concept] Universal Feed Reader

Post by KreAch3R »

Brilliant! Thank you. :thumbup:
Inactive, due to life changes. Send me a PM for any question.

Desktop DeviartArt
Image