use of org.nzbhydra.mapping.newznab.xml.JaxbPubdateAdapter in project nzbhydra2 by theotherp.
the class RssItemBuilder method build.
public NewznabXmlItem build() {
NewznabXmlItem rssItem = new NewznabXmlItem();
rssItem.setTitle(title);
rssItem.setLink(link);
rssItem.setPubDate(pubDate);
rssItem.setDescription(description);
rssItem.setComments(comments);
rssItem.setCategory(category);
rssItem.setGrabs(grabs);
rssItem.setNewznabAttributes(newznabAttributes);
rssItem.setTorznabAttributes(torznabAttributes);
if (rssGuid == null) {
rssItem.setRssGuid(new NewznabXmlGuid(title + "-guid", false));
} else {
rssItem.setRssGuid(rssGuid);
}
newznabAttributes.add(new NewznabAttribute("size", String.valueOf(size)));
if (enclosure == null) {
rssItem.setEnclosure(new NewznabXmlEnclosure(link, size, "application/x-nzb"));
} else {
rssItem.setEnclosure(enclosure);
}
newznabAttributes.add(new NewznabAttribute("usenetdate", new JaxbPubdateAdapter().marshal(pubDate)));
if (grabs != null) {
newznabAttributes.add(new NewznabAttribute("grabs", String.valueOf(grabs)));
}
return rssItem;
}
Aggregations