Search in sources :

Example 1 with ATOMLink

use of org.geometerplus.fbreader.network.atom.ATOMLink in project FBReaderJ by geometer.

the class OPDSCatalogInfoHandler method processFeedMetadata.

public boolean processFeedMetadata(OPDSFeedMetadata feed, boolean beforeEntries) {
    Icon = feed.Icon != null ? ZLNetworkUtil.url(myBaseURL, feed.Icon.Uri) : null;
    Title = feed.Title;
    Summary = feed.Subtitle;
    for (ATOMLink link : feed.Links) {
        final MimeType mime = MimeType.get(link.getType());
        final String rel = myLink.relation(link.getRel(), mime);
        if ("search".equals(rel)) {
            if (MimeType.APP_OPENSEARCHDESCRIPTION.equals(mime)) {
                myOpensearchDescriptionURLs.add(ZLNetworkUtil.url(myBaseURL, link.getHref()));
            } else if (MimeType.APP_ATOM_XML.weakEquals(mime) || MimeType.TEXT_HTML.weakEquals(mime)) {
                final String tmpl = ZLNetworkUtil.url(myBaseURL, link.getHref());
                final OpenSearchDescription descr = OpenSearchDescription.createDefault(tmpl, mime);
                if (descr.isValid()) {
                    DirectOpenSearchDescription = descr;
                }
            }
        }
    }
    return true;
}
Also used : ATOMLink(org.geometerplus.fbreader.network.atom.ATOMLink) MimeType(org.geometerplus.zlibrary.core.util.MimeType)

Aggregations

ATOMLink (org.geometerplus.fbreader.network.atom.ATOMLink)1 MimeType (org.geometerplus.zlibrary.core.util.MimeType)1