Search in sources :

Example 1 with JaxbPubdateAdapter

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;
}
Also used : NewznabXmlEnclosure(org.nzbhydra.mapping.newznab.xml.NewznabXmlEnclosure) JaxbPubdateAdapter(org.nzbhydra.mapping.newznab.xml.JaxbPubdateAdapter) NewznabXmlGuid(org.nzbhydra.mapping.newznab.xml.NewznabXmlGuid) NewznabAttribute(org.nzbhydra.mapping.newznab.xml.NewznabAttribute) NewznabXmlItem(org.nzbhydra.mapping.newznab.xml.NewznabXmlItem)

Aggregations

JaxbPubdateAdapter (org.nzbhydra.mapping.newznab.xml.JaxbPubdateAdapter)1 NewznabAttribute (org.nzbhydra.mapping.newznab.xml.NewznabAttribute)1 NewznabXmlEnclosure (org.nzbhydra.mapping.newznab.xml.NewznabXmlEnclosure)1 NewznabXmlGuid (org.nzbhydra.mapping.newznab.xml.NewznabXmlGuid)1 NewznabXmlItem (org.nzbhydra.mapping.newznab.xml.NewznabXmlItem)1