It is currently June 26th, 2019, 2:52 pm

FeedReader w/ sorting

Post your work-in-progress and completed skins to share and discuss.
User avatar
Mordasius
Posts: 1059
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

FeedReader w/ sorting

Mordasius » April 7th, 2012, 4:55 pm

This is an elaboration of the Universal FeedReader by Kaelri here using a modified version of Smurfier's LUA script here along with a smidgen of script from JS Morley's BreakingNews here.

What sets this skin apart from hundreds of other RSS/Atom FeedReaders is that:

1) It sorts news items by date/time so that you only see the ten most recent items from sites like the BBC and the Guardian (other FeedReaders just show a mish-mash of new and old stuff that is not sorted chronologicaly).
2) It shows 'bullet-marks' for all items that are less than an hour old ( you can change the value for how old you want a 'new' feed to be )
3) It trims Rainmeter Forum Feeds down to the topic titles.
Last edited by Mordasius on April 12th, 2012, 11:55 am, edited 1 time in total.
User avatar
Benjamin Linus
Posts: 171
Joined: July 12th, 2009, 4:05 pm
Location: The Island

Re: FeedReader w/ sorting

Benjamin Linus » April 8th, 2012, 11:24 am

:great:
Very useful indeed, thanks for sharing.
Image
User avatar
Mordasius
Posts: 1059
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: FeedReader w/ sorting

Mordasius » April 8th, 2012, 12:07 pm

Benjamin Linus wrote:Very useful indeed, thanks for sharing.
You're welcome.

I'm still not fully confident in the script I've used to work out the time zone each feed uses for the Publication Date and have noted that it is not only the BBC and the Guardian that don't sort news feeds by time/date, but also other 'big names' like the New York Times (http://feeds.nytimes.com/nyt/rss/HomePage). Makes me wonder how many people are sitting out there with feedreaders updating every 10-20 minutes only to show old news items.

Anyway, the code I've used in the Lua script is:

Code: Select all

function PubTime(itemDate)
	local tTimeZoneHrs={JST=9;PST=-8;PDT=-7;KST=9;CCT=8;WST=8;EET=2;BRT=-3;EDT=-4;CDT=-5;CST=-6;}
	local tMonthNum={Jan=1;Feb=2;Mar=3;Apr=4;May=5;Jun=6;Jul=7;Aug=8;Sep=9;Oct=10;Nov=11;Dec=12;}
	local weekday, day, monthText, year, hour, min, sec, zone = string.match(itemDate, "(.-), (.-) (.-) (.-) (.-):(.-):(.-) (.-)<")
	local PubTime = os.time({year=year, month=tMonthNum[monthText], day=day, hour=hour, min=min, sec=sec})
	if  tTimeZoneHrs[zone] then PubTime = PubTime - ( tTimeZoneHrs[zone] * 3600 ) 
		elseif  tonumber(zone) then	 PubTime = PubTime - ( (tonumber(zone) / 100) * 3600 ) end			
return PubTime
This works on the feeds where I've tested it, but different feeds format the Publication Date in different ways and I'd therefore appreciate any feedback you have on the bulleting of 'new' items for the feeds you are using.
User avatar
Mordasius
Posts: 1059
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: FeedReader w/ sorting

Mordasius » April 8th, 2012, 1:32 pm

It occurs to me that I've been a bit of a willy-wonker in starting a new thread for this: it should have been added to the [Proof of Concept] Universal Feed Reader thread. Would it be possible for one of the Administrators to shift this thread over to where it belongs? Pls.
User avatar
smurfier
Moderator
Posts: 1937
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

FeedReader w/ sorting

smurfier » April 8th, 2012, 2:34 pm

Since you combined a couple scripts and did provide reference links, this thread is fine where it is. No reason to bog down a lengthy older thread with new posts.
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 . . .
sclera
Posts: 3
Joined: April 22nd, 2012, 9:24 am

Re: FeedReader w/ sorting

sclera » April 22nd, 2012, 9:26 am

This is great, however I'd like to know how to make it stop switching to feeds seemingly at random.
User avatar
Mordasius
Posts: 1059
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: FeedReader w/ sorting

Mordasius » April 22nd, 2012, 10:18 am

It's not actually switching at random, it switches to show a particular feed each time that feed is updated.
sclera
Posts: 3
Joined: April 22nd, 2012, 9:24 am

Re: FeedReader w/ sorting

sclera » April 22nd, 2012, 10:47 am

I see. Can I make it stop?
User avatar
Mordasius
Posts: 1059
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: FeedReader w/ sorting

Mordasius » April 22nd, 2012, 11:14 am

sclera wrote:I see. Can I make it stop?
Sure, all you need to do is replace [MeasureFeed], [MeasureFeed2], [MeasureFeed3], [MeasureFeed4] and [MeasureFeed5] in UniFeedReader.ini with these:

Code: Select all

;--- measures

[MeasureFeed]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=#URL1#
RegExp=(?siU)(.*)$
DecodeCharacterReference=1
Substitute=#WebParserSubstitute#
FinishAction=!Execute [!EnableMeasure MeasureLuaScript ] [!ShowMeterGroup Feeds]
UpdateRate=#UpdateRate1#

[MeasureFeed2]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=#URL2#
RegExp=(?siU)(.*)$
DecodeCharacterReference=1
Substitute=#WebParserSubstitute#
UpdateRate=#UpdateRate2#

[MeasureFeed3]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=#URL3#
RegExp=(?siU)(.*)$
DecodeCharacterReference=1
Substitute=#WebParserSubstitute#
UpdateRate=#UpdateRate3#

[MeasureFeed4]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=#URL4#
RegExp=(?siU)(.*)$
DecodeCharacterReference=1
Substitute=#WebParserSubstitute#
UpdateRate=#UpdateRate4#

[MeasureFeed5]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=#URL5#
RegExp=(?siU)(.*)$
DecodeCharacterReference=1
Substitute=#WebParserSubstitute#
UpdateRate=#UpdateRate5#
sclera
Posts: 3
Joined: April 22nd, 2012, 9:24 am

Re: FeedReader w/ sorting

sclera » April 22nd, 2012, 12:26 pm

Cheers!