本文由 简悦 SimpRead 转码, 原文地址 blog.csdn.net

背景:使用 calibre 作为游戏仓库,记录游戏收藏情况

问题:一本一本的加速度太慢了

解决办法:使用 calibre 官方 API 批量添加

完成效果:

步骤:

  1. 查找官方 API ebook-meta — calibre 5.32.0 documentation

  2. 批量创建书籍命令:

1
2
3
4
calibredb set_metadata -f publisher:realwang2 546  --with-library /books


546代表书籍ID
  1. 批量修改书籍命令:
1
2
3
4
5
6
7
8
calibredb remove --with-library /books	 555
calibredb remove --with-library /books 556
calibredb remove --with-library /books 557
calibredb remove --with-library /books 558
calibredb remove --with-library /books 559
calibredb remove --with-library /books 560
calibredb remove --with-library /books 561
calibredb remove --with-library /books 562

可修改参数:

opt/calibre # calibredb set_metadata –list-fields –with-library /books                                          
Title                                    Field name                                                                
                                                                                                                   
Author sort                              author_sort                                                               
Authors                                  authors                                                                   
Comments                                 comments                                                                  
Cover                                    cover                                                                     
Identifiers                              identifiers                                                               
Languages                                languages                                                                 
Published                                pubdate                                                                   
Publisher                                publisher                                                                 
Rating                                   rating                                                                    
Series                                   series                                                                    
Series Index                             series_index                                                              
Size                                     size                                                                      
Title sort                               sort                                                                      
Tags                                     tags                                                                      
Date                                     timestamp                                                                 
Title                                    title                                                                     
Cover                                    cover  

使用 excel 编辑命令,一次贴入或者贴入 bash 脚本执行:

4 批量删除书籍

1
2
3
4
5
6
7
8
calibredb remove --with-library /books	 555
calibredb remove --with-library /books 556
calibredb remove --with-library /books 557
calibredb remove --with-library /books 558
calibredb remove --with-library /books 559
calibredb remove --with-library /books 560
calibredb remove --with-library /books 561
calibredb remove --with-library /books 562