table of contents
- NAME
- 通用選項
- LIST
- ADD
- REMOVE
- ADD_FORMAT
- REMOVE_FORMAT
- SHOW_METADATA
- SET_METADATA
- EXPORT
- CATALOG
- SAVED_SEARCHES
- ADD_CUSTOM_COLUMN
- CUSTOM_COLUMNS
- REMOVE_CUSTOM_COLUMN
- SET_CUSTOM
- RESTORE_DATABASE
- CHECK_LIBRARY
- LIST_CATEGORIES
- BACKUP_METADATA
- CLONE
- EMBED_METADATA
- SEARCH
- FTS_INDEX
- FTS_SEARCH
- NOTES
- ITEMS
- VIRTUAL_LIBRARIES
- ANNOTATIONS
- TRASH
- DATA_FILES
- Author
- Copyright
- trixie 8.5.0+ds-1+deb13u3
- trixie-backports 8.16.2+ds+~0.10.5-3~bpo13+1
- testing 9.18.0+ds+~1.1.2-1
- unstable 9.18.0+ds+~1.1.2-1
- العربية
- български
- català (ca)
- čeština
- dansk
- Deutsch
- Ελληνικά
- English
- español
- eesti
- euskara
- فارسی
- suomi
- français
- galego
- עברית
- hrvatski
- magyar
- íslenska
- italiano
- 日本語
- ಕನ್ನಡ
- 한국어
- lietuvių
- latviešu
- मराठी
- Melayu
- norsk bokmål
- Nederlands
- polski
- português (pt)
- português (pt-BR)
- română
- русский
- slovenčina
- slovenščina
- српски
- srpskohrvatski
- svenska
- Türkçe
- українська
- Tiếng Việt
- 中文 (zh-CN)
- 繁體中文 (zh-HK)
- 繁體中文 (zh-TW)
| CALIBREDB(1) | calibre | CALIBREDB(1) |
NAME¶
calibredb - calibredb
calibredb command [options] [arguments]
calibredb is the command line interface to the calibre database. It has several sub-commands, documented below.
calibredb can be used to manipulate either a calibre database specified by path or a calibre Content server running either on the local machine or over the internet. You can start a calibre Content server using either the calibre-server program or in the main calibre program click Connect/share → Start Content server. Since calibredb can make changes to your calibre libraries, you must setup authentication on the server first. There are two ways to do that:
- If you plan to connect only to a server running on the same computer, you can simply use the --enable-local-write option of the Content server, to allow any program, including calibredb, running on the local computer to make changes to your calibre data. When running the server from the main calibre program, this option is in Preferences → Sharing over the net → Advanced. Be careful though, because some browsers, primarily Firefox, allow arbitrary websites to also access local servers. If you use Firefox, it is better to setup username and password, as described below. Local Network Access restriction has still not been implemented as of Firefox v149.
- If you want to enable access over the internet, then you should setup user accounts on the server and use the --username and --password options to calibredb to give it access. You can setup user authentication for calibre-server by using the --enable-auth option and using --manage-users to create the user accounts. If you are running the server from the main calibre program, use Preferences → Sharing over the net → Require username/password.
To connect to a running Content server, pass the URL of the server to the --with-library option, see the documentation of that option for details and examples.
- 通用選項
- list
- add
- •
- 正在從資料夾中加入
- remove
- add_format
- remove_format
- show_metadata
- set_metadata
- export
- catalog
- •
- EPUB 選項
- saved_searches
- add_custom_column
- custom_columns
- remove_custom_column
- set_custom
- restore_database
- check_library
- list_categories
- backup_metadata
- clone
- embed_metadata
- search
- fts_index
- fts_search
- notes
- items
- virtual_libraries
- annotations
- trash
- data_files
通用選項¶
- --help, -h
- 顯示說明訊息並退出
- --library-path, --with-library
- Path to the calibre library. Default is to use the path stored in the settings. You can also connect to a calibre Content server to perform actions on remote libraries. To do so use a URL of the form: <http://hostname:port/#library_id> for example, <http://localhost:8080/#mylibrary>. library_id is the library id of the library you want to connect to on the Content server. You can use the special library_id value of - to get a list of library ids available on the server. For details on how to setup access via a Content server, see <https://manual.calibre-ebook.com/generated/en/calibredb.html>.
- --password
- 用來連線至 calibre 伺服器的密碼。要使用標準輸入中讀取密碼,請使用特殊值:<stdin>。如果要從檔案中讀取密碼,請使用:<f:/path/to/file>( 例如: <f: 檔案的完整路徑以及後置 >)。前方所寫的角括號是必須使用的,請記得在命令介面中使用跳脫字元或是引號。
- --timeout
- 透過網路連接到 calibre 書庫時的逾時時間,以秒為單位。預設值為兩分鍾。
- --username
- 登入Calibre網路伺服器時所用之使用者名稱
- --version
- 顯示程式版本編號並退出
LIST¶
calibredb list [options]
列出 calibre 資料庫中可用書本。
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --ascending
- 以遞增次序排列結果
- --fields, -f
- 在列出資料庫中書籍時要顯示的欄位。應該是逗號分隔的欄位列表。 可用欄位: author_sort, authors, comments, cover, formats, identifiers, isbn, languages, last_modified, pubdate, publisher, rating, series, series_index, size, tags, template, timestamp, title, uuid 預設值:title,authors。特殊欄位「all」可用於選擇所有欄位。除了上述內建欄位之外,自訂欄位還等價於*field_name,例如,對於自訂欄位#rating,使用名稱:*rating
- --for-machine
- 產生適用於機器讀取用的JSON檔案,線寬及分隔符號將被忽略。
- --limit
- 結果顯示的最大數目。預設:全部
- --line-width, -w
- 輸出中單一行的最大寬度。預設值為偵測螢幕大小。
- --prefix
- 所有檔案路徑的前綴。預設值為書庫資料夾的絕對路徑。
- --search, -s
- 以搜尋的查詢來過濾結果。要了解搜尋的查詢格式,請參閱使用者手冊中的搜尋相關文件。預設值為不做任何過濾。
- --separator
- 用來分離欄位的字串。預設為空白。
- --sort-by
- The field by which to sort the results. You can specify multiple fields by separating them with commas. Available fields: author_sort, authors, comments, cover, formats, identifiers, isbn, languages, last_modified, pubdate, publisher, rating, series, series_index, size, tags, template, timestamp, title, uuid Default: id. In addition to the builtin fields above, custom fields are also available as *field_name, for example, for a custom field #rating, use the name: *rating
- --template
- The template to run if "template" is in the field list. Note that templates are ignored while connecting to a calibre server. Default: None
- --template_file, -t
- Path to a file containing the template to run if "template" is in the field list. Default: None
- --template_heading
- Heading for the template column. Default: template. This option is ignored if the option --for-machine is set
ADD¶
calibredb add [選項] file1 file2 file3 ...
加入指定檔案為書籍到資料庫。您可以指定目錄,請檢視下面目錄相關選項。
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- 編輯已加入的書本作者
- --automerge, -m
- 如果找到具有相似標題和作者的圖書,請自動將傳入格式(檔案)合併到現有圖書記錄中。值「Ignore」表示丟棄重複的格式。值「overwrite」表示書庫中的重複格式將被新加入的檔案覆蓋。值「new_record」表示將重複的格式放入新的圖書記錄中。
- --cover, -c
- 供已加入書本使用之書本封面路徑
- --duplicates, -d
- 即使已經存在,也加入書籍到資料庫中。 根據書名和作者進行比較。 請注意,--automerge 選項優先。
- --empty, -e
- 加入空的電子書(沒有格式的書本)
- --identifier, -I
- 為這本書設定識別項,例如 -I asin:XXX -I isbn:YYY
- --isbn, -i
- 編輯已加入的書本 ISBN
- --languages, -l
- 以逗號分隔的語言清單(最好使用ISO639所規範的語言格式,不過有些語言的名稱也能夠識別)
- --series, -s
- 編輯已加入的書本系列
- --series-index, -S
- 編輯已加入的書本編號
- 編輯已加入的書本標籤
- --title, -t
- 編輯已加入的書本標題
正在從資料夾中加入¶
用來控制從資料夾中加入書本的選項。預設情況下,只會加入具有已知電子書檔案類型的檔案。
- --add
- 檔名 (glob) 模式,在掃描資料夾中的檔案時將加入與此模式相符的檔案,即使這些檔案不是已知的電子書檔案類型。可以為多個模式多次指定。
- --ignore
- 檔名模式 (glob) ,在掃瞄資料夾中的檔案時,與此模式相符的檔案將被忽略。可以為多個模式多次指定。例如:*.pdf 將忽略所有 PDF 檔案
- --one-book-per-directory, -1
- 假定每個資料夾只有一本書,而在其中的所有檔案都是那本書的不同電子書格式
- --recurse, -r
- 遞迴地處理資料夾
REMOVE¶
calibredb remove ids
從資料庫移除指定 id 的書籍。ids 應為以逗號分隔的 id 號列表(您可以使用搜尋命令來取得 id 號)。例如,23,34,57-85 (如果指定一個區間,該區間的最後一個數字不會被包括在內)。
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --permanent
- Do not use the trash bin
ADD_FORMAT¶
calibredb add_format [options] id ebook_file
用 ebook_file 將電子書加入到由 id 標識的邏輯圖書的可用格式中。如果格式已經存在,則取代它,除非指定了不取代選項。
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --as-extra-data-file
- 將檔案作為額外的數據檔案而不是電子書格式新增到書籍中
- --dont-replace
- 在格式已存在時不要取代
REMOVE_FORMAT¶
calibredb remove_format [options] id fmt
從 ID 辨識的邏輯書中刪除 fmt 格式。您可以透過使用搜尋命令取得 ID。fmt 應該是形如 LRF 或 TXT 或 EPUB 的一個檔案副檔名。如果邏輯書沒有 fmt 可用則什麼也不做。
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
SHOW_METADATA¶
calibredb show_metadata [options] id
顯示在 calibre 資料庫中儲存的 id 所標識的圖書的中繼資料。 id 是來自搜尋命令的 id 編號。
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --as-opf
- 以 OPF 格式(XML) 列印詮釋資料
SET_METADATA¶
calibredb set_metadata [options] book_id [/path/to/metadata.opf]
Set the metadata stored in the calibre database for the book identified by book_id from the OPF file metadata.opf. book_id is a book id number from the search command. You can get a quick feel for the OPF format by using the --as-opf switch to the show_metadata command. You can also set the metadata of individual fields with the --field option. If you use the --field option, there is no need to specify an OPF file.
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --field, -f
- 設定欄位。格式是field_name:value,例如:--field tags:tag1,tag2。使用:option:--list-fields`來取得所有欄位名稱的列表。您可以多次指定此選項來設定多個欄位。注意:對於語言,您必須使用ISO639語言代碼 (例如en代表英文,fr代表法語等)。對於識別項,語法是:option:--field` identifiers:isbn:XXXX,doi:YYYYY。對於布林(是/否)欄位使用真與假或是和否。
- --list-fields, -l
- 列出所有 --field 選項所可以使用的詮釋資料欄位
EXPORT¶
calibredb export [options] ids
Export the books specified by ids (a comma separated list) to the filesystem. The export operation saves all formats of the book, its cover and metadata (in an OPF file). Any extra data files associated with the book are also saved. You can get id numbers from the search command.
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --all
- 匯出資料庫中所有的書本,忽略 id 列表。
- --dont-asciiize
- 讓 calibre 將所有非英文字元轉換成英文對應字元的檔名。如果儲存到不完全支援 Unicode 檔名的舊檔案系統中,這將非常有用。 指定這個開關會關閉這個行為。
- --dont-save-cover
- Normally, calibre will save the cover in a separate file along with the actual e-book files. 指定這個開關會關閉這個行為。
- --dont-save-extra-files
- Save any data files associated with the book when saving the book 指定這個開關會關閉這個行為。
- --dont-update-metadata
- 通常calibre將會更新從書庫中所儲存的詮釋資料,這會讓儲存至磁碟變慢。 指定這個開關會關閉這個行為。
- --dont-write-opf
- 通常calibre會把詮釋資料寫入個別的OPF檔,和真實的電子書分離。 指定這個開關會關閉這個行為。
- --formats
- 每本書本的格式列表,逗號間隔。預設保存所有可用格式。
- --progress
- 回報進度
- --replace-whitespace
- 以底線替代空格。
- --single-dir
- 匯出全部的書本到單一個資料夾中
- --template
- The template to control the filename and folder structure of the saved files. Default is "{author_sort}/{title}/{title} - {authors}" which will save books into a per-author subfolder with filenames containing title and author. Available controls are: {author_sort, authors, id, isbn, languages, last_modified, pages, pubdate, publisher, rating, series, series_index, tags, timestamp, title}
- --timefmt
- 顯示日期的格式。 %d - 日、 %b - 月、 %m - 數字月、 %Y - 年。預設值為: %b, %Y
- --to-dir
- 匯出書本到指定的資料夾中,預設為: .
- --to-lowercase
- 路徑轉換為小寫。
CATALOG¶
calibredb catalog /path/to/destination.(csv|epub|mobi|xml...) [options]
以Path/to/Destination extension指定的格式匯出目錄。 選項控制列目在產生的目錄輸出中的顯示方式。 請注意,不同的目錄格式支援不同的選項集。 要檢視不同的選項,請指定輸出檔案的名稱,然後指定 --help選項。
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --ids, -i
- 逗號分割資料庫 ID 到書目的列表。 一旦聲明,則忽略 --search 預設值:全部
- --search, -s
- 為搜尋查詢過濾結果。搜尋查詢格式請參見使用者手冊中搜尋相關內容。預設:不過濾
- --verbose, -v
- 顯示詳細的輸出資訊,便於除錯。
EPUB 選項¶
- --catalog-title
- 生成目录的标题用作元数据标题。 默认值:'My Books' 适用于:AZW3,ePub,MOBI 等输出格式
- --cross-reference-authors
- 为具有多个作者的书籍在作者节中创建交叉引用。 默认值: 'False' 适用于: AZW3, EPUB, MOBI输出格式
- --debug-pipeline
- Save the output from different stages of the conversion pipeline to the specified folder. Useful if you are unsure at which stage of the conversion process a bug is occurring. Default: 'None' Applies to: AZW3, EPUB, MOBI output formats
- --exclude-genre
- 描述以排除类型的标签正则表达式。 默认值: '[.+]|^+$' 不包括括号内的标签,例如 '[Project Gutenberg]', 和 '+', 默认的用于阅读书籍的标签。 适用于: AZW3, EPUB, MOBI 输出格式
- --exclusion-rules
- 指定用於從產生的目錄中排除書籍的規則。 排除規則的模型是('<rule name>','標籤','<comma-separated list of tags>') 或('<rule name>','<custom column>','<pattern>')。 例如: (('已封存的書籍','#狀態','已封存'),) 將在自訂列「狀態」中排除值為「已封存」的圖書。定義多個規則時,將套用所有規則。 預設: "(('Catalogs','Tags','Catalog'),)" 適用於: AZW3, EPUB, MOBI 輸出格式
- --generate-authors
- 目录中包括“作者”部分。 默认值: 'False' 适用于: AZW3, EPUB, MOBI 输出格式
- --generate-descriptions
- 目录中包括“描述”部分。 默认值: 'False' 适用于: AZW3, EPUB, MOBI 输出格式
- --generate-genres
- 目录中包括“类型”部分。 默认值: 'False' 适用于: AZW3, EPUB, MOBI 输出格式
- --generate-recently-added
- 目录中包括“最近添加”部分。 默认值: 'False' 适用于: AZW3, EPUB, MOBI 输出格式
- --generate-series
- 目录中包括“丛书系列”部分。 默认值: 'False' 适用于: AZW3, EPUB, MOBI 输出格式
- --generate-titles
- 目录中包括“标题”部分。 默认值: 'False' 适用于: AZW3, EPUB, MOBI 输出格式
- --genre-source-field
- “类型”部分的源字段。 默认值: '標籤' 适用于: AZW3, EPUB, MOBI 输出格式
- --header-note-source-field
- 包含要在描述标头中插入的注释文本的自定义域。 默认值: '' 适用于: AZW3, EPUB, MOBI输出格式
- --merge-comments-rule
- #<custom field>:[before|after]:[True|False] 指定: <custom field> 包含與註解合併的註解的自訂欄位 [before|after] 關於註解的註解放置位置 [True|False] - 在備註和註解之間插入水平規則 預設值: '::' 適用於: AZW3, EPUB, MOBI 輸出格式
- --output-profile
- 指定输出配置文件。在某些情况下,输出配置文件用于优化某些设备的书目分类。例如,'kindle' 或 'kindle_dx' 以章节和文章的方式来生成目录结构。默认:'None' 适用于:AZW3、EPUB、MOBI 等输出格式
- --prefix-rules
- 指定用於包括表示已讀書籍,收藏清單項目和其他使用者定前綴的前綴的規則。 前綴規則的模型 ('<rule name>','<source field>','<pattern>','<prefix>')。 當定義了多個規則時,將使用第一個相符規則。 預設規則: "(('Read books','tags','+','✓'),('Wishlist item','tags','Wishlist','×'))" 適用於:AZW3, EPUB, MOBI 輸出格式
- --preset
- 使用GUI目录生成器创建的命名预设。 预设指定用于构建目录的所有设置。 默认值: 'None' 适用于: AZW3, EPUB, MOBI 输出格式
- --thumb-width
- 目录中书籍封面的大小提示(英寸)。 范围: 1.0 - 2.0 默认值: '1.0' 适用于: AZW3, EPUB, MOBI 输出格式
- --use-existing-cover
- 在產生目錄時取代現有的封面。 預設值: 'False' 適用於: AZW3, EPUB, MOBI 輸出格式
SAVED_SEARCHES¶
calibredb saved_searches [options] [list|add|remove]
Manage the saved searches stored in this database. If you try to add a query with a name that already exists, it will be replaced.
Syntax for listing, the default action:
calibredb saved_searches list
Syntax for adding:
calibredb saved_searches add search_name search_expression
Syntax for removing:
calibredb saved_searches remove search_name
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
ADD_CUSTOM_COLUMN¶
calibredb add_custom_column [options] label name datatype
建立一個自訂的欄位,標籤名為機器讀取用的名稱,不能包含空格或冒號。名稱則是方便人類閱讀。資料類型可為:bool, comments, composite, datetime, enumeration, float, int, rating, series, text
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --display
- 一個自訂選項如何解釋該列中資料的字典。這是一個 JSON 字串。對於枚舉列,使用 --display"{\ "enum_values\ ":[\ "val1\ ", \ "val2\ "]}" 有許多選項可以進入顯示變數,按列類型的選項是: composite: composite_template, composite_sort, make_category,contains_html, use_decorations datetime: date_format enumeration: enum_values, enum_colors, use_decorations int, float: number_format text: is_names, use_decorations 找到適當組合的最好方法是在 GUI 中建立適當類型的自訂列,然後檢視圖書的備份 OPF (確保自從加入該列以來已經建立了新的 OPF)。在 OPF 中的新列中,您將看到 JSON 的「顯示」。
- --is-multiple
- 這個欄位儲存類似標籤的資料(例如多個逗號分隔的數值)。只有在資料類型為文字時套用。
CUSTOM_COLUMNS¶
calibredb custom_columns [options]
列出可用的自訂列欄位。顯示欄位標籤和 ids。
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --details, -d
- 顯示每個欄位的詳細資料。
REMOVE_CUSTOM_COLUMN¶
calibredb remove_custom_column [options] label
用標籤刪除的自訂列標識。可以使用custom_columns command命令檢視可用列
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --force, -f
- 不需要進行詢問確認
SET_CUSTOM¶
calibredb set_custom [options] column id value
為 id 標識的書設定自訂列的值。 您可以使用搜尋命令取得 id 列表。 您可以使用 custom_columns 命令取得自訂列名的列表。
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --append, -a
- 如果欄位可存多值,將選定的屬性加入現有屬性中,而非取代。
RESTORE_DATABASE¶
calibredb restore_database [options]
Restore this database from the metadata stored in OPF files in each folder of the calibre library. This is useful if your metadata.db file has been corrupted.
WARNING: This command completely regenerates your database. You will lose all saved searches, user categories, plugboards, stored per-book conversion settings, and custom recipes. Restored metadata will only be as accurate as what is found in the OPF files.
The exit status is 0 if the restore succeeded, 1 if it failed completely and 2 if the database was restored but some books or other data could not be.
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --really-do-it, -r
- 確實執行還原。這個指令除非指定這個選項否則不會執行。
CHECK_LIBRARY¶
calibredb check_library [options]
對表示書庫的檔案系統執行一些檢查。產生報告是 invalid_titles, extra_titles, invalid_authors, extra_authors, missing_formats, extra_formats, extra_files, missing_covers, extra_covers, malformed_formats, malformed_paths, failed_folders
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --csv, -c
- 輸出為 CSV
- --ignore_extensions, -e
- 以逗號分割忽略的副檔名。 預設值:全部
- --ignore_names, -n
- 以逗號分割忽略的檔名。 預設值:全部
- --report, -r
- 以逗號分割報告清單。 預設值:全部
- --vacuum-fts-db
- 清空全文搜尋資料庫。這可能非常緩慢且佔用大量記憶體,具體取決於資料庫的大小。
LIST_CATEGORIES¶
calibredb list_categories [options]
在資料庫中產生一個目錄資訊的報告。 該資訊與標籤窗格中顯示的資訊等效。
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --categories, -r
- 以逗號分割分類查詢名稱。 預設值:全部
- --csv, -c
- 輸出為 CSV
- --dialect
- 指定輸出的CSV檔案格式,格式: excel, excel-tab, unix
- --item_count, -i
- 只列出每個分類中的書本總數,而不是列出每個分類中的書本。
- --width, -w
- 輸出中單一行的最大寬度。預設值為偵測螢幕大小。
BACKUP_METADATA¶
calibredb backup_metadata [選項]
將儲存在資料庫中的中繼資料備份到每個圖書資料夾中的 單個 OPF 檔案中。這通常是自動發生的,但是您可以執行 此命令來強制重新產生 OPF 檔案,並使用 --all 選項。
請注意,通常不需要這樣做,因為每次中繼資料變更時, OPF 檔案都會自動備份。
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --all
- 此命令通常僅對於過時的OPT檔案進行操作,此選項會使它在所有的書本上操作。
CLONE¶
calibredb 複製到 path/to/new/library
建立目前書庫的副本。它建立了一個新的、空的書庫,它所有的自訂列、虛擬書庫和其他設定與目前書庫相同。
副本書庫將沒有任何書籍。如果您想要建立一個完整的副本書庫,包括所有的書籍,那麼只需使用您的檔案系統工具來複製書庫資料夾。
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
EMBED_METADATA¶
calibredb embed_metadata [options] book_id
從 calibre 資料庫中的中繼資料更新儲存在 calibre 書庫中的實際圖書檔案中的中繼資料。 通常,只有從 calibre 匯出檔案時才更新中繼資料,如果希望檔案就地更新,則此命 令很有用。請注意,不同的檔案格式支援不同數量的中繼資料。您可以使用book_id 的特殊值「all」來更新所有書籍中的中繼資料。還可以指定許多由空間分隔的書籍 ID 和由連字號分隔的 ID 範圍。例如:calibredb embed_metadata 1 2 10-15 23
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --only-formats, -f
- 只更新特定格式檔案的詮釋資料,可以指定多個檔案格式。預設值將會更新所有格式的檔案。
SEARCH¶
calibredb search [options] search expression
搜尋書庫中指定的搜尋項目,返回與搜尋運算式相符的以逗號分隔的圖書ID列表。輸出格式對於輸入格式接受ID列表的其他命令非常有用。 搜尋運算式可以是來自calibre強大的搜尋查詢語言中的任何內容,例如:calibredb search author:asimov 'title:"i robot"'
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --limit, -l
- 結果回傳結果的最大數目。預設回傳全部結果
FTS_INDEX¶
calibredb fts_index [options] enable/disable/status/reindex
Control the Full text search indexing process.
- enable
- Turns on FTS indexing for this library
- disable
- Turns off FTS indexing for this library
- status
- Shows the current indexing status
- reindex
- Can be used to re-index either particular books or the entire library. To re-index particular books specify the book ids as additional arguments after the reindex command. If no book ids are specified the entire library is re-indexed.
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --indexing-speed
- 索引的速度。使用快速索引可使用所有電腦資源進行快速索引,使用慢速索引可使用較少的資源進行索引。請注意,每次呼叫索引後,索引速度都會重設為 Slow。
- --wait-for-completion
- 等到所有圖書都被編入索引,定期顯示索引進度
FTS_SEARCH¶
calibredb fts_search [options] search expression
Do a full text search on the entire library or a subset of it.
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --do-not-match-on-related-words
- 僅比對精確字詞,而非相關字詞。因此 correction 將不會比對到 correcting。
- --include-snippets
- 包括每個匹配項相關的文字片段。請注意,這會使搜索速度慢得多。
- --indexing-threshold
- How much of the library must be indexed before searching is allowed, as a percentage. Defaults to 90
- --match-end-marker
- 用於指示 程式碼 片段中相符字詞結束的標記
- --match-start-marker
- 用於指示 程式碼 片段中相符字詞開始的標記
- --output-format
- The format to output the search results in. Either "text" for plain text or "json" for JSON output.
- --restrict-to
- Restrict the searched books, either using a search expression or ids. For example: ids:1,2,3 to restrict by ids or search:tag:foo to restrict to books having the tag foo.
NOTES¶
calibredb notes [options] [list|search|show|set|remove]
Manage the notes attached to items such as authors, series, tags and publishers. FIELD is the lookup name of the field, for example: authors, series, tags, publisher or #mycolumn. ITEM is the name of the item, for example the name of an author. Items are matched case insensitively.
List the items that have notes, optionally only those in the specified field. This is the default action:
calibredb notes list [FIELD]
Search the text of notes using the same SQLite full text search syntax as the Browse notes tool in calibre. Print the field, item name and an excerpt for each match. Use --field to search only the notes in a particular field:
calibredb notes search "search expression" calibredb notes search --field authors "search expression"
Print the note for an item as Markdown formatted text, or with --as-html as an HTML document with any images embedded, suitable for use with set:
calibredb notes show FIELD ITEM
Replace the note for an item with the contents of an HTML file. Use - to read the HTML from standard input. Images embedded as base64-encoded data: URLs are added to the note for both local and remote libraries. When using a local library and reading from a file, images referenced by paths relative to the file are added as well:
calibredb notes set FIELD ITEM FILE
Remove the note for an item:
calibredb notes remove FIELD ITEM
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --as-html
- When showing a note, output it as HTML instead of Markdown formatted text
- --field
- When searching notes, restrict the search to this field, for example: authors, tags or #mycolumn
ITEMS¶
calibredb items [options] (rename|remove) FIELD ITEM ...
Rename or remove items such as authors, tags, series and publishers in all books, the same as the Manage authors, tags, etc. actions in the calibre interface. FIELD is the lookup name of the field, for example: authors, tags, series, publisher or #mycolumn. Items are matched case insensitively.
Rename an item. If an item named NEW_NAME already exists, the two items are merged. For fields that contain multiple values, NEW_NAME can contain more than one value, separated by the separator for the field, for example a comma for tags. The item is then replaced by all the values:
calibredb items rename FIELD ITEM NEW_NAME
Remove one or more items from all books. Authors cannot be removed:
calibredb items remove FIELD ITEM [ITEM ...]
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --search, -s
- Only change books that match the specified search expression, for example: tags:"=Fiction"
VIRTUAL_LIBRARIES¶
calibredb virtual_libraries [options] [list|add|rename|remove]
Manage the Virtual libraries of this library. A Virtual library is a search that behaves as though the library contains only the books it matches. To list or search the books in a Virtual library, use: calibredb search 'vl:"name"'
List the Virtual libraries, with their searches and number of books. This is the default action:
calibredb virtual_libraries list
Create a Virtual library from a search:
calibredb virtual_libraries add name search_expression
Rename a Virtual library:
calibredb virtual_libraries rename name new_name
Remove Virtual libraries, the books in them are not changed:
calibredb virtual_libraries remove name ...
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --for-machine
- Generate output in JSON format, which is more suitable for machine parsing
- --replace
- Replace the search of an existing Virtual library with the same name when adding
ANNOTATIONS¶
calibredb annotations [options] [list|search|export|import|remove]
Manage the annotations, that is the highlights and bookmarks, of books, as created in the calibre E-book viewer or synced from other applications.
List the annotations, with their ids. This is the default action:
calibredb annotations list
Search highlighted text, annotation notes and bookmark titles using the same SQLite full text search syntax as the Browse annotations tool. Results are ordered by relevance and include annotation ids, book titles and matching excerpts. Use --search to restrict the books, --type to restrict the annotation type, --user-type and --annotation-user to restrict the user, --no-stemming to match exact word forms, or --format json for a JSON array of results including the annotation data and excerpts:
calibredb annotations search "search expression"
Export the annotations as plain text, Markdown or JSON, grouped by book. The JSON is the same calibre annotation collection as created by the Export button in the Browse annotations tool:
calibredb annotations export
Import a calibre annotation collection exported as JSON by this command or the Browse annotations tool. The collection must contain annotations from only one book. BOOK_ID is the destination book id, not the id stored in the file. Only the annotations of the format FORMAT are imported, annotations of other formats are skipped. FORMAT must exist in the destination book. Use the same edition of the book so positions match:
calibredb annotations import BOOK_ID FORMAT FILE
Use - for FILE to read from standard input. The entire collection is validated before importing. Annotations are merged with existing ones using the viewer's rules: highlights are matched by UUID and bookmarks by title, and the newer timestamp wins. Repeated imports do not create duplicates. Unrelated annotations and reading positions are preserved.
By default annotations are imported into those of the calibre E-book viewer. Use --user-type web --annotation-user USER to import them into those of a Content server user instead. Exported collections record the user the annotations belong to, and if a collection contains annotations of more than one user, it is rejected. Use the --user-type and --annotation-user options when exporting, to export the annotations of a single user.
Permanently remove the annotations with the specified ids, as shown by list:
calibredb annotations remove ID ...
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --annotation-user
- Only list, search or export the annotations of the specified user. For import, the Content server user to import the annotations for, required with --user-type web. Note that this can be any user, not just the one used to connect to a remote library.
- --format, -f
- The export format, one of: text, markdown, json. For search, text or json. Default is: text
- --no-stemming
- For search, match exact word forms instead of word stems
- --search, -s
- Only list, search or export the annotations of books matching the specified book search query, for example: --search "series:Foundation"
- --type, -t
- Only list, search or export annotations of the specified type, one of: highlight, bookmark
- --user-type
- Only list, search or export the annotations of the specified type of user. For import, the type of user to import the annotations for, the calibre E-book viewer (local) or a Content server user (web). Default for import is local.
TRASH¶
calibredb trash [options] (list|restore|delete|empty) [ids]
Manage the books and formats that have been removed and placed in the trash bin. Entries in the trash bin are permanently deleted automatically after some days. ids is a comma separated list of book ids, as for the remove command, for example: 23,34,57-85 (when specifying a range, the last number in the range is not included).
List the removed books and formats, most recently removed first, with the times they were removed in local time. Removed formats of books that no longer exist are marked as not restorable, they can only be deleted. With --for-machine, the times are in UTC:
calibredb trash list
Restore removed books, or with --formats, the removed formats of books:
calibredb trash restore ids
Permanently delete entries from the trash bin:
calibredb trash delete ids
Permanently delete everything in the trash bin:
calibredb trash empty
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --for-machine
- Generate output for the list action in JSON format, which is more suitable for machine parsing
- --formats
- Act on the removed formats of the specified books, instead of on removed books
DATA_FILES¶
calibredb data_files [options] (list|add|get|rename|remove) BOOK_ID ...
Manage the extra data files associated with a book, in local or remote libraries. Names are relative to the book's data directory. Use / for subdirectories, is also accepted. Files whose names contain a are listed, but cannot otherwise be managed. E-book formats, covers and metadata.opf cannot be accessed with this command. Remote libraries require an account with write access, as for other management commands, and do not support accounts with per-library search restrictions.
List file names, sizes in bytes and modification times (seconds since the Unix epoch). Use --for-machine for JSON output:
calibredb data_files list BOOK_ID
Add a file, using its basename, or --name to specify a name or subdirectory. Existing files are not replaced unless --replace is specified. This is also available through add_format --as-extra-data-file:
calibredb data_files add BOOK_ID FILE
Save one data file to --output on the local machine. Existing output files are not replaced unless --replace is specified:
calibredb data_files get BOOK_ID NAME --output FILE
Rename a file. Existing destinations are not replaced unless --replace is set:
calibredb data_files rename BOOK_ID NAME NEW_NAME
Remove a file to the operating system's recycle bin. With --permanent, delete it permanently instead. For remote libraries this happens on the server:
calibredb data_files remove BOOK_ID NAME
Directories left empty by rename and remove are deleted. With remote libraries, each file is transferred in a single request, so very large files need enough memory on both the client and the server, and uploads are limited by the maximum request size of the server.
每当向具有它们自己空间的calibredb传递参数时,用引号括起这些参数。例如: "/some path/with spaces"
- --for-machine
- Output the list of files as JSON
- --name
- Name to use for the added file, relative to the data directory
- --output
- Local destination for the get action
- --permanent
- Permanently delete the data file instead of using the recycle bin
- --replace
- Allow replacing existing files when adding, getting or renaming
Author¶
Kovid Goyal
Copyright¶
Kovid Goyal
| 11月 06, 2026 | 9.18.0 |