本文为摘录(或转载),侵删,原文为: https://mp.weixin.qq.com/s?__biz=MzA5MTgxNzM0Nw==&mid=2653286264&idx=1&sn=78ffdd914a3863f0b3927485e669bd98&chksm=8ba7db94bcd05282c10916297526edefb001f4b88ef18434c85e20d44a784893a1b91b80df37&mpshare=1&scene=1&srcid=0410rJQbgLUkbG2wSAoTpbln&sharer_shareinfo=6d065c71e8d859f972c14e5e0361382b&sharer_shareinfo_first=6d065c71e8d859f972c14e5e0361382b#rd
1 解决 calibre 导入书籍和传输书籍不是中文名称问题
去官网下载最新版本软件,安装
下载源码
1
| git clone https://github.com/kovidgoyal/calibre.git
|
check out 相应安装版本,根据需求修改源代码。
1
| gco v5.43.0(gco = git checkout)
|

创建快捷方式
1
| vim /usr/local/bin/calibre-develop
|
写入内容
1
2
3
| #!/bin/sh
export CALIBRE_DEVELOP_FROM="/Users/kovid/work/calibre/src"
calibre-debug -g
|
授予权限
1
| chmod +x /usr/local/bin/calibre-develop
|
配置环境变量
1
2
3
| #calibre
export CALIBRE=/Applications/calibre.app/Contents/MacOS
export PATH=$PATH:$CALIBRE
|
启动程序
2 我的解决方法
按照上面的方法搞了一遍,发现没起作用,没再去研究为什么,就直接修改了系统的 calibre 。。。
为了后续更新方便,把修改过程写在了 emacs 里面:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
| (defun yc/fix-calibre ()
"Fix calibre."
(interactive)
(let ((file (pcase system-type
('gnu/linux "/usr/lib64/calibre/calibre/utils/filenames.py")
(_ (error "Platform %s not support" system-type)))))
(if (yc/file-exists-p file)
(with-current-buffer (yc/find-file-as-root file nil t)
(goto-char (point-min))
(unless (re-search-forward "# 替换为下划线" nil t)
(goto-char (point-min))
(search-forward "def ascii_filename(")
(replace-match "
import re
def ascii_filename(")
(goto-char (pos-eol))
(insert "
return re.sub(r'[\/\\\:\*\?\"\<\>\|]', substitute, orig) # 替换为下划线
")
(save-buffer))
(kill-buffer (current-buffer)))
(error "Can't open file: %s" file))))
|
2.1 追加
gentoo 里面提供的 binpkg 使用 解决 calibre 导入书籍和传输书籍不是中文名称问题 里提到的方法不起作用,但是如果 calibre 是从官网下载的二进制版本,则可以。。。