Skip to content

Instantly share code, notes, and snippets.

@scripting
Created January 30, 2015 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scripting/d3af15c22097f371aa61 to your computer and use it in GitHub Desktop.
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.
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, "&lt;%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