想要產生 OPDS Catalog 以及提供 OpenSearch 的功能,如圖右上角,讓 Stanza 這個閱讀器可以看得懂,但 OPDS Catalog 1.0 的規格還沒有完全支援(今天是 2010/10/18,Stanza 軟體是 3.0.3 版本),因此像是一些 link 中 rel 這個 attribute ,填入 OPDS Catalog 1.0 的規格後,也會導致 Stanza 讀不出來,之前測試的結果,把 rel 留空白應該可以。
最近想要試的是 OpenSearch,在 OPDS Catalog 1.0 中 7.5 裡有的定義:
7.5. Search
An OPDS Catalog MAY provide a search facility through an [OpenSearch] description document. Links to [OpenSearch] description documents MUST use the “search” relation value and the “application/opensearchdescription+xml” media type as defined in the “Autodiscovery” section of the [OpenSearch] specification.
<link rel="search"
href="search.xml"
type="application/opensearchdescription+xml"/>
In an [OpenSearch] description document, the search interface SHOULD use the media type associated to OPDS Catalogs:
<Url type="application/atom+xml;profile=opds-catalog"
template="http://example.com/search?q={searchTerms}" />
OPDS Catalog Feed Documents MAY include elements from the [OpenSearch] namespace such as “opensearch:totalResults” or “opensearch:itemsPerPage” in [OpenSearch] responses.
只是我嘗試的結果,那個 type 沒被認出來,倒是直接用 type="application/atom+xml" 就可以看到,以 Feedbooks Catalog 為例:
<link type="application/atom+xml" rel="search" title="Search Feedbooks" href="http://www.feedbooks.com/search.atom?query={searchTerms}"/>
所以,可以很偷懶乾脆一起寫:
<link type="application/opensearchdescription+xml" rel="search" title="Search on Feedbooks" href="http://www.feedbooks.com/opensearch.xml"/>
<link type="application/atom+xml" rel="search" title="Search Feedbooks" href="http://www.feedbooks.com/search.atom?query={searchTerms}"/>
至於 opensearch.xml 描述檔該怎樣寫,也可以直接參考 Feedbooks OpenSearch,甚至我還在想,乾脆全部導到 Feedbooks 也不錯
7.5. Search
An OPDS Catalog MAY provide a search facility through an [OpenSearch] description document. Links to [OpenSearch]
description documents MUST use the “search” relation value and the
“application/opensearchdescription+xml” media type as defined in the
“Autodiscovery” section of the [OpenSearch] specification.
<link rel="search"
href="search.xml"
type="application/opensearchdescription+xml"/>
In an [OpenSearch] description document, the search interface SHOULD use the media type associated to OPDS Catalogs:
<Url type="application/atom+xml;profile=opds-catalog"
template="http://example.com/search?q={searchTerms}" />
OPDS Catalog Feed Documents MAY include elements from the [OpenSearch] namespace such as “opensearch:totalResults” or “opensearch:itemsPerPage” in [OpenSearch] responses.
沒有留言:
張貼留言