Get The Script
Place the Reader.lua script file somewhere in your skin folder.
How It Works
Here's the simplest way to add Reader to your skin:
Code: Select all
[MyWebParser]
Measure=Plugin
Plugin=WebParser
UpdateRate=600
Url=http://rainmeter.net/forum/feed.php
RegExp=(?siU)(.*)$
FinishAction=!CommandMeasure MyReader Refresh()
[MyReader]
Measure=Script
ScriptFile=Reader.lua
MeasureName=MyWebParser
What It Does
The script creates dynamic variables for all the feed metadata:
- FeedTitle: the title of the feed (or "Untitled", if no title is found).
- FeedLink: the main feed link.
- CurrentFeed: the number of the current-displayed feed (in the order given in MeasureName).
And for each item, where "N" is the item number:
- ItemNTitle: the title of the item (or "Untitled").
- ItemNLink: the item link (or the main feed link, or blank).
- ItemNDesc: the item description/summary (or blank).
- ItemNDate: the item date. Format can be set for Google Calendar feeds. See Timestamp below.
- ItemNUnread: "1" if the item is marked unread, "0" if marked read. There are three bangs to change an item's "Unread" state:
- !CommandMeasure MeasureName MarkRead(N) will mark the given item as read, changing #ItemNUnread# to 0.
- !CommandMeasure MeasureName MarkUnread(N) will mark the given item as unread (1).
- !CommandMeasure MeasureName ToggleUnread(N) will toggle the item between read (0) and unread (1).
The script is able to keep track of feeds from multiple WebParser measures:
Code: Select all
[MyWebParser1]
Measure=Plugin
Plugin=WebParser
UpdateRate=600
Url=http://rainmeter.net/forum/feed.php
RegExp=(?siU)(.*)$
FinishAction=!CommandMeasure MyReader Refresh(1)
[MyWebParser2]
Measure=Plugin
Plugin=WebParser
UpdateRate=600
Url=http://feeds.gawker.com/lifehacker/excerpts.xml
RegExp=(?siU)(.*)$
FinishAction=!CommandMeasure MyReader Refresh(2)
[MyReader]
Measure=Script
ScriptFile=Reader.lua
MeasureName=MyWebParser1|MyWebParser2
There are three bangs you can use to change which feed is displayed:
- !CommandMeasure MeasureName ShowNext(): show the next feed. Loops around to the first feed.
- !CommandMeasure MeasureName ShowPrevious(): show the previous feed. Loops around to the last feed.
- !CommandMeasure MeasureName Show(N): show feed #N.
Code: Select all
[MyReader2]
Measure=Script
ScriptFile=Reader.lua
MeasureName=MyWebParser1
[MyReader2]
Measure=Script
ScriptFile=Reader.lua
MeasureName=MyWebParser2
VariablePrefix=Group2_
Minimum and Maximum Items
Code: Select all
[MyReader]
Measure=Script
ScriptFile=Reader.lua
MeasureName=MyWebParser1
MinItems=10
MaxItems=100
The optional MaxItems sets the maximum number of items in the database for each feed. If there are ever more items than the maximum, the oldest ones are discarded to make room for the newest ones. This is meant for putting a limit on the number of items that are saved in the history file (see below).
FinishAction
Code: Select all
[MyReader]
Measure=Script
ScriptFile=Reader.lua
MeasureName=MyWebParser1
FinishAction=[!UpdateMeterGroup ListOfItems][!Redraw]
You can use the FinishAction for anything you want. I like to have it update the item meters, which makes the feeds show up a little quicker when the skin loads (see the example above).
Timestamp
Code: Select all
[MyReader]
Measure=Script
ScriptFile=Reader.lua
Timestamp=%I.%M %p
Code: Select all
[MyReader]
Measure=Script
ScriptFile=Reader.lua
MeasureName=MyWebParser1
KeepOldItems=1
Calendar Events
Code: Select all
[MyReader]
Measure=Script
ScriptFile=Reader.lua
MeasureName=MyWebParser1|MyWebParser2
WriteEvents=1
;EventFile=Calendar1.xml|Calendar2.xml
The EventFile option contains the filenames for each feed. If there are multiple feeds, each file is separated by a pipe, just as in MeasureName. If a feed's file is not defined, it defaults to "MeasureName_FeedNEvents.xml" in the local folder. Events are only written if the feed is in the Google Calendar format.
History
Code: Select all
[MyReader]
Measure=Script
ScriptFile=Reader.lua
MeasureName=MyWebParser1|MyWebParser2
WriteHistory=1
;HistoryFile=MyHistoryFile.xml
History is saved by feed URL, so it doesn't matter if you change the order of the feeds, or remove a feed and then re-add it at a later time. In addition, if KeepOldItems (above) is enabled, older items will be permanently saved. For this reason, you may want to set a MaxItems limit (see above) to keep the history file from growing too large and slowing down the skin.
You can also wipe your history with !CommandMeasure MeasureName ClearHistory(), which deletes the history file and instantly refreshes the skin.
Demo Skin
Credits
Credit is due to JSMorley, who helped conceive the original version of this script, and Smurfier, who contributed the calendar file feature and numerous other fixes and improvements.