The calibre:// URL スキーム

calibre は自分自身を calibre:// URL のハンドラプログラムとして登録します。したがって本を開いたり本を検索したりといった動作を他のプログラムやドキュメント、またはコマンドラインから実行することが可能です。たとえばコマンドラインで次のように実行します:

calibre calibre://switch-library/Some_Library

これは Some Library という名前のライブラリを calibre で開きます。ライブラリ名はライブラリフォルダのフォルダ名のスペースをアンダースコアで置き換えたものです。特殊値 _ は現在のライブラリを意味します。URL のさまざまなタイプについては下のドキュメントを参照してください。

このリンクは HTML ファイルは Word ドキュメントなどの中にも入れられ、OS が自動的に calibre を実行して指定された動作を行います。

指定したライブラリに切替え

URL の構文は:

calibre://switch-library/Library_Name

ライブラリ名はライブラリのフォルダ名からスペースをアンダースコアで置き換えたものです。特殊値 _ は現在のライブラリを意味します。またライブラリ名には :ref:`16 進数エンコード <hex_encoding>`も使えます。URL エンコードが必要になるような特殊文字が使われているライブラリ名に便利です。16 進数エンコードのライブラリ名は次のようになります:

_hex_-AD23F4BC

_hex_- プリフィックスの後ろの部分が UTF-8 としてエンコードされたライブラリ名で、すべてのバイトは 2 つの16進文字で表されます。

指定した本を calibre で開く

URL の構文は:

calibre://show-book/Library_Name/book_id

これは calibre で book_id (数字) の本を開きます。本の ID は calibre のインタフェース上で 本の詳細 パネルで クリックして開く の上にマウスカーソルを置くと確認できます。

calibre で現在表示している本にリンクをコピーするには、本の詳細 パネルで右クリックして 本のリンクをコピー を選択します。

If a search is active and the book is not matched by the search then the search is cleared.

If a Virtual library is selected, calibre will use it when showing the book. If the book isn't found in that virtual library then the virtual library is cleared.

If you want to switch to a particular Virtual library when showing the book, use:

calibre://show-book/Library_Name/book_id?virtual_library=Library%20Name
or
calibre://show-book/Library_Name/book_id?encoded_virtual_library=hex_encoded_virtual_library_name

replacing spaces in the Virtual library name by %20. If the book isn't found in that virtual library then the virtual library is ignored.

指定した本を電子書籍ビューアで指定した位置で開く

URL の構文は:

calibre://view-book/Library_Name/book_id/book_format?open_at=location

ここで book_formatEPUBMOBI などのような本の形式です。location は本の中のオプションの場所です。このようなリンクを取得する一番簡単な方法は本をビューアで開き、ビューアコントロールから 移動 → 位置 を選択すれば、他の場所にコピー/貼り付けできるリンクが表示されます。

本を検索

URL の構文は:

calibre://search/Library_Name?q=query
calibre://search/Library_Name?eq=hex_encoded_query

ここでクエリには、有効な 検索式 であれば何でも指定可能です。検索式が複雑な場合は 16 進文字列としてエンコード し、代わりに eq を使用します。クエリを空にすると現在の検索がクリアされます。

デフォルトでは、仮想ライブラリが選択されている場合、すべての本を見つけられるよう検索前に解除します。仮想ライブラリを保持したい場合には、次のようにします:

calibre://search/Library_Name?q=query&virtual_library=_

特定の仮想ライブラリに切り替えたい場合は、次のようにします:

calibre://search/Library_Name?virtual_library=Library%20Name
or
calibre://search/Library_Name?encoded_virtual_library=hex_encoded_virtual_library_name

仮想ライブラリ名のスペースは %20 で置き換えます。

calibre で検索を実行してそのリンクを生成したい場合は、検索バーで右クリックして 検索を URL としてコピー を選択します。

Open a book details window on a book in some library

URL の構文は:

calibre://book-details/Library_Name/book_id

This opens a book details window on the specified book from the specified library without changing the current library or the selected book.

Open the notes associated with an author/series/etc.

URL の構文は:

calibre://book-details/Library_Name/Field_Name/id_Item_Id

This opens a window showing the notes of the specified item. The easiest way to create such URLs is to show the notes you want in calibre and click the Copy URL button to copy the URL to the clipboard and paste it wherever you need.

Here Field_Name is the name of the columns such as authors or tags. For user created columns, replace the leading # in the field name with an underscore, so #mytags becomes _mytags.

In addition to specifying items by id using Item_Id you can also specify them by name using either val_Item_Name or hex_Hex_Encoded_Item_Name. For example:

calibre://book-details/Library_Name/authors/val_John%20Doe

URL パラメータの 16 進エンコード

URL パラメータの 16進エンコードは、まずパラメータを UTF-8 バイト列としてエンコードし、各バイトをそのバイトを表す 2 つの 16 進文字で置き換えることによって行われます。たとえば abc という文字列は UTF-8 で 0x61 0x62 and 0x63 というバイト列になり、エンコードされると 616263 という文字列になります。