Fb2RSS

A Facebook to RSS conversion tool
git clone git://xatko.vsos.ethz.ch/Fb2RSS.git
Log | Files | Refs | Submodules

commit 1414cb1721dd82cc338193f3a66d85a405432fe5
parent 29aa231e84a904166ed4177f529d01fd9e0dc6b9
Author: Dominik Schmidt <das1993@hotmail.com>
Date:   Tue, 30 Jun 2015 22:21:43 +0200

Move some functionality into struct Post.

It should be the responsibility of identifying itself,
or generating the title.

Diffstat:
Fb2RSS.d | 37+++++++++++++++++++++++++++++--------
1 file changed, 29 insertions(+), 8 deletions(-)

diff --git a/Fb2RSS.d b/Fb2RSS.d @@ -154,14 +154,12 @@ class FBStream : RandomFiniteAssignable!(Post){ //rss.addChild(new XmlNode("updated").addCData(posts[0].time.toISOExtString())); foreach(ref Post p; posts){ XmlNode e=new XmlNode("entry"); - e.addChild(new XmlNode("title").addCData(p.time.toString())); - e.addChild(new XmlNode("link").setAttribute("href","http://facebook.com"~p.href)); - e.addChild(new XmlNode("id").addCData("http://facebook.com"~p.href)); - e.addChild(new XmlNode("published").addCData(p.time.toISOExtString())); - e.addChild(new XmlNode("updated").addCData(p.time.toISOExtString())); - UCData uc=new UCData(); - uc.setCData(p.content.toString()); - e.addChild(new XmlNode("content").setAttribute("type","html").addChild(uc)); + e.addChild(new XmlNode("title").addCData(p.title)); + e.addChild(new XmlNode("link").setAttribute("href",p.link)); + e.addChild(new XmlNode("id").addCData(p.id)); + e.addChild(new XmlNode("published").addCData(p.ISOTime())); + e.addChild(new XmlNode("updated").addCData(p.ISOTime())); + e.addChild(new XmlNode("content").setAttribute("type","html").addChild(p.getUCContent())); rss.addChild(e); } into.writeln(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>`); @@ -173,6 +171,29 @@ struct Post{ XmlNode content; SysTime time; string href; + + @property string title(){ + return time.toString(); + } + + @property string link(){ + return "https://facebook.com"~href; + } + + @property string id(){ + return link(); + } + + @property string ISOTime(){ + return time.toISOExtString(); + } + + @property UCData getUCContent(){ + UCData uc=new UCData(); + uc.setCData(content.toString()); + return uc; + } + } void main(string args[]){