Created
January 30, 2015 18:26
-
-
Save scripting/d3af15c22097f371aa61 to your computer and use it in GitHub Desktop.
A Frontier script that generates the OPML subscription list for liveblog.co. An example script for Marco.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on buildLiveblogOpml () { | |
«Changes | |
«1/30/15; 12:19:27 PM by DW | |
«Created. | |
local (jsontext = tcp.httpreadurl ("http://liveblog.co/prefs/userwhitelist.json"), jstruct); | |
json.compile (jsontext, @jstruct); | |
«scratchpad.jstruct = jstruct | |
local (xstruct = nodeEditorSuite.data.opmlShellStruct, now = clock.now ()); | |
local (adrbody = xml.opml.getBodyAddress (@xstruct), adritem, name, i); | |
for i = 1 to sizeof (jstruct) { | |
local (name = jstruct [i], baseurl = "http://liveblog.co/users/" + name); | |
adritem = xml.addtable (adrbody, "outline"); | |
xml.addattribute (adritem, "title", name); | |
xml.addattribute (adritem, "text", name); | |
xml.addattribute (adritem, "type", "rss"); | |
xml.addattribute (adritem, "htmlUrl", baseurl); | |
xml.addattribute (adritem, "xmlUrl", baseurl + "/rss.xml"); | |
xml.addattribute (adritem, "created", date.netstandardstring (now))}; | |
«scratchpad.xstruct = xstruct | |
local (s = xml.decompile (@xstruct), replacetable); | |
new (tabletype, @replacetable); | |
replacetable.programname = string.popFileFromAddress (this); | |
replacetable.now = now; | |
replacetable.title = "Feeds of people publishing on liveblog.co"; | |
s = string.multiplereplaceall (s, @replacetable, false, "<%", "%>"); | |
s = string.replace (s, "<%title%>", replacetable.title); | |
s = string.replace (s, "encoding=\"ISO-8859-1\" version=\"1.0\"", "version=\"1.0\" encoding=\"ISO-8859-1\""); | |
local (s3path = "/liveblog.co/data/users.opml"); | |
s3.newobject (s3path, s); | |
speaker.beep (); | |
clipboard.putvalue ("http:/" + s3path); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment