It is currently April 19th, 2024, 1:37 am

Reader

Discuss the use of Lua in Script measures.
astyagi2
Posts: 15
Joined: February 11th, 2012, 5:48 am

Re: [Proof of Concept] Universal Feed Reader

Post by astyagi2 »

smurfier wrote:Are there any errors in the Log tab of the About window?

My issue has been resolved automatically.
onimorza
Posts: 2
Joined: August 21st, 2012, 9:12 am

Re: [Proof of Concept] Universal Feed Reader

Post by onimorza »

I tried a lot of readers but this one seems to be the only one that fulfills (almost) all my needs :D
I have feeds that other readers don't read, so I tried with the Google trick first but it displays only max 9 topics, this one takes as much topics as are on the feed page if necessary and reads all feeds that I follow :thumbup: So yes, the name "Universal Feed Reader" says enough :D
I only found a small issue (for me): I display 15 topics per feed (fits nice on my desktop), 3 feeds per list. But one of the feed pages has only 10 topics. When switching to that 10 topic list, the bottom 5 topics from the other list (with 15 topics) are copied to the bottom of that 10 topic list (and thus don't belong there).. Would be nicer if they would be just empty offcourse :)

Anyone an idea how to avoid that?
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: [Proof of Concept] Universal Feed Reader

Post by Kaelri »

onimorza wrote:I only found a small issue (for me): I display 15 topics per feed (fits nice on my desktop), 3 feeds per list. But one of the feed pages has only 10 topics. When switching to that 10 topic list, the bottom 5 topics from the other list (with 15 topics) are copied to the bottom of that 10 topic list (and thus don't belong there).. Would be nicer if they would be just empty offcourse :)

Anyone an idea how to avoid that?
Set MinItems=15 on the script measure. When you show a feed with fewer than 15 items, it will fill in the rest with blank spaces. I apparently did not document this feature very well, so apologies for that.

(Also, this is a weird coincidence: I'm actually about to release a pretty major update to this script. So look for that sometime today or tomorrow.)
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: [Proof of Concept] Universal Feed Reader

Post by MerlinTheRed »

Please tell me you are including descriptions in this new update! That's exactly what I need right now.
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: [Proof of Concept] Universal Feed Reader

Post by Kaelri »

MerlinTheRed wrote:Please tell me you are including descriptions in this new update! That's exactly what I need right now.
Yes, actually. :)
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Universal Feed Reader

Post by Kaelri »

The first post has been updated with all the newest code and documentation. A brief overview of changes:

New Features

- Item dates and descriptions are now exposed.
- Items can be marked as read/unread.
- Google Calendar items can be saved to an event file that is compatible with Lua Calendar and Enigma.
- New items can be merged with old items instead of overwriting them.
- Items can be synced with a history file, so that the state is saved and restored when the skin is reloaded/refreshed. History is saved by feed URL, so you can re-order your feeds, or remove a feed and re-add it later; the history will be kept.
- A new MaxItems option keeps the history file from growing too big.
- The script now returns useful debug information about the last feed parsed as the string value.

Performance Improvements

- Detecting the format is now much more reliable, and should work on more feeds that aren't as strictly formatted.
- Feeds are only re-parsed when they have changed since the last update.
- Feeds that are not currently being shown will update in the background.
- The script automatically sets its own UpdateDivider.

To-Do List

- If I can figure out reliable date parsing for all feed formats, I'll be able to allow sorting by date and formatting for additional feed types beyond Google Calendar.

What the script needs now is some good hearty beta testing, so please don't hesitate to give the demo skin a try and report any bugs, errors, glitches, or other general fails. :)
User avatar
Mordasius
Posts: 1171
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Reader

Post by Mordasius »

I tried the demo skin with a few different feeds and came across some that failed with the Error message Script: Reader.lua:213: attempt to index field '?' (a nil value):

1) http://www.nasa.gov/rss/hurricaneupdate.rss -> this feed works without problems in my (modified) version of EverReader 0.3
2) http://www.costanachrichten.com/component/option,com_rd_rss/id,1/ -> this also works in Version 0.3
3) http://www.reforma.com/rss/portada.xml -> this fails with the message 'empty' in Version 0.3

EDIT: I've just noticed that these all had <10 items and the problem was fixed by setting MinItems=1 in [MeasureReader] / [List2_MeasureReader]. However, the unfilled slots for empty items were not blanked out.

The marking of read and unread items worked well and the history file kept track of things nicely even after changing the feeds and refreshing the skin numerous times. I didn't do anything with Google Calendar items as that's not something I use.

Looking forward to a reliable way of date parsing to allow sorting by date and I guess it will also be used to make sure the oldest items are discarded when the number of items in history exceeds MaxItems.
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Reader

Post by Kaelri »

Fixed the problem for all three. I replaced the loop at 213 with the following:

Code: Select all

		for i = 1, math.max(#Feed, MinItems) do
			local Item = Feed[i] or {}			
			Queue['Item'..i..'Title']   = Item.Title   or ''
			Queue['Item'..i..'Link']    = Item.Link    or Feed.Link or ''
			Queue['Item'..i..'Desc']    = Item.Desc    or ''
			Queue['Item'..i..'Date']    = Item.Date    or ''
			Queue['Item'..i..'Date']    = Type.DateToString(Queue['Item'..i..'Date'], Timestamp)
			Queue['Item'..i..'Unread']  = Item.Unread  or ''
		end
I'll post a fixed version of the script & skin tomorrow. Thanks very much for testing, I appreciate it. :)
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: Reader

Post by MerlinTheRed »

Very nice! Will be an invaluable tool for all people creating new RSS feed skins. Even more valuable now. It's a bit overkill for me, but I LIKE OVERKILL! MWAHAHAHA!

One question before I try it: So the script sets variables for all the feed items. And it keeps track of old feed items. Will all those be available vie those variables? If a new item is added to the feed, do all the other shift? How many variables will the skin create? I guess if I want to make a feed reader that just displays the 5 most recent entries or so, I set MinItems and MaxItems to 5? Ok, that was more than one question...
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Reader

Post by Kaelri »

MerlinTheRed wrote:So the script sets variables for all the feed items. And it keeps track of old feed items. Will all those be available vie those variables?
Yes - if you set KeepOldItems=1. If you don't enable this option, then only items that are still found in the feed will be kept.
MerlinTheRed wrote:If a new item is added to the feed, do all the other shift?
Yes. Specifically, items that are still in the feed are shown at the top, and older items are moved below them. (This seemed like the best way to handle the possibility that the feed could have been reordered since the last update.)
MerlinTheRed wrote:How many variables will the skin create?
2 for each feed (title and link), and up to 5 for each feed item (title, link, description, date, and unread mark). If description or date are missing, they are ignored.
MerlinTheRed wrote:I guess if I want to make a feed reader that just displays the 5 most recent entries or so, I set MinItems and MaxItems to 5?
That would work. :)

To be clear, all of the extra features - keeping old items, writing history & calendar events, etc. - are optional. If you use the script with no options (besides MeasureName), it will show only the current feed items, and keep no data. So if you just want a simple RSS feed skin, this will work fine for you. It's meant to be used for any feed-parsing job, large or small.