This repository has been archived on 2023-11-13. You can view files and clone it, but cannot push or open issues or pull requests.
blog/_posts/2022-09-20-calibre_web.md
2023-06-03 15:58:09 +08:00

84 lines
4.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
layout : post
title : "在线网页书库Calibre Web"
subtitle : "I don't use docker :("
date : 2022-09-20 11:16:58
author : "Manford Fan"
catalog : false
header-img : "img/post-bg-universe.jpg"
tags :
- Book
- Calibre
- Server
---
搭建[wiki](https://wiki.rustle.cc)这个站点的时候,就预留了书籍这个条目,由于能力有限,只能上传书的封面,再就是写上书名,并不能实际的翻阅。所以最近遇到[calibre web](https://github.com/janeczku/calibre-web)这个应用的时候我就知道就是它了。Calibre Web是一个可以在线搜索阅读和下载电子书的网页应用支持各种格式的书籍上传但是只支持`epub`格式的电子书在线阅读不过也够用了大不了使用Windows下的Calibre转换一下也是非常的方便的。
## 一、安装部署
像其他应用一样Calibre Web也提供多种安装部署方式我搜索了Internet上的绝大部分信息都是在讲怎么配合NAS使用怎么用Docker部署可我真的不想用Docker所以我选择了最简单的方法那就是直接下载源码然后用`python3`来执行源文件:
```bash
$ git clone git@github.com:janeczku/calibre-web.git
$ cd calibre-web/
$ python3 cps.py
```
然后就可以访问localhost的8083端口进行访问了如果端口冲突可以有两种选择
1. 修改其他用用的端口
2. 先停用其他应用的端口然后8083登录Calire Web之后修改Calibre端口再将之前应用的端口启用
当然Calibre Web也支持Docker部署以及`pip(3)`命令安装,具体可以参考[Installation Guide](https://github.com/janeczku/calibre-web#installation)。
## 二、Nginx反向代理
Nothing to say......
```nginx
server {
server_name calibre.rustle.cc;
listen [::]:80;
listen 80;
listen [::]:443 ssl http2;
listen 443 ssl http2;
charset utf-8;
access_log logs/calibre.access.log main;
if ($scheme = http) {
return 302 https://$host$request_uri;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header Cache-Control no-cache;
proxy_pass http://localhost:8083;
# modify max file uploads
client_max_body_size 40000M;
}
}
```
## 三、支持豆瓣刮削
原生的代码支持Google和Amazon刮削信息由于懂得都懂的原因这两个自带的刮削器不可用搜索了好一阵都在讲Docker下面有个镜像集成了豆瓣API在逛Github的时候发现源码也支持挂载豆瓣API——[Calibre Web Douban API](https://github.com/fugary/calibre-web-douban-api)。用法也很简单,复制`src/NewDouban.py``calibre-web/cps/metadata_provider/`目录下重启项目即可记得把之前的GoogleAmazon以及豆瓣源文件全都删掉不然还是会在搜集信息的时候浪费时间还会卡住。
## 四、注意事项 & 使用体验
用的是[Alist](https://alist.nn.ci/zh/)挂载天翼云盘并生成WebDAV地址通过[rClone](https://rclone.org/)映射到服务器上的。单独建了一个Kindle文件夹下面放了数据库初始化文件`meatadata.db`。需要注意要把该文件夹的owner设置为`www-data`不然会有不可写入的报错。还有就是如果服务重启或者长时间没有登陆再次登录calibre web之后可能需要重新连接数据库在设置中操作即可。
速度还是有点慢,[Koel](https://blog.rustle.cc/2022/10/16/koel/)中的音乐文件也是用这种方式挂载的。也是有点慢我严重怀疑是家里的网络问题找个时间换个网络试试。另外豆瓣API虽然可以刮削了但是封面有时候下载不下来估计是豆瓣的限制总体上还不错除了有些鸡肋。
![calibre_web](/img/posts/calibre_web.png 'calibre_web')
## 五、参考文档
- [Calibre Web Github](https://github.com/janeczku/calibre-web)
- [Calibre Web Douban Github](https://github.com/fugary/calibre-web-douban-api)