围绕isbnlib构建的电子书管理器
lspace的Python项目详细描述
L-空间
围绕isbnlib构建的cli电子书管理器
当导入时,它试图在文件元数据和文本中找到isbn。 通过isbn,它试图从google books和openlibrary中获取关于这本书的元数据。 如果找不到ISBN,它将根据文件名查询元数据。
在此之后,正确重命名的文件将存储在库文件夹中。
目前支持epub和pdf。
要求
python>;=3.5和pip
安装
来自PYPI(最新版本)
pip install lspace
来自github(可能不是那么稳定的开发工具)
pip install git+https://github.com/puhoy/lspace.git
设置
安装后,应运行
lspace init
这将设置一个新的配置文件,例如,您可以编辑该文件以指定库的结构。
默认配置文件如下:
database_path: sqlite:////home/USER/.config/lspace/lspace.db
file_format: '{SHELF}/{AUTHORS}_{TITLE}'
library_path: ~/library
loglevel: error
default_shelf: misc
default_author: no author
default_language: no language
default_publisher: no publisher
数据库路径
数据库的路径。 该项目使用sqlalchemy,因此sqlalchemy支持的所有数据库都应该是好的。
文件格式
用于在库中存储普通文件的模板字符串。
{SHELF}/{AUTHORS}_{TITLE}
将生成类似scifi/cixin-liu_three-body-problem.epub
作者和标题将为此自动删除。
可能使用的变量有:作者、标题、书架、年份、语言、出版商
库路径
导入文件的存储位置
日志级别
默认的python日志级别(debug、info、error、exception)
默认{shelf,author,language,publisher}
默认字段名,以防在导入中未指定任何内容
用法
导入
lspace import path/to/ebook.epub
lspace import path/to/folder/*
从Calibre库导入
lspace import path/to/calibre_library/metadata.db
从lspace api导入
lspace import http://<some-address>/api/v1/
Web界面(lspace web
-向下滚动一点!)根据您的搜索生成导入字符串!
搜索库
lspace list QUERY [--path]
例如,
lspace list programming --path
会返回类似
/home/USER/library/donald-e-knuth/art-of-computer-programming-volume-2.pdf
/home/USER/library/donald-e-knuth/the-art-of-computer-programming-volume-1-fascicle-1.pdf
以及
lspace list dwarf
将返回return
Peter Tyson - Getting Started With Dwarf Fortress
移除材料
lspace remove QUERY
此命令将在实际删除内容之前询问您:)
Peter Tyson - Getting Started With Dwarf Fortress
/home/USER/library/peter-tyson/getting-started-with-dwarf-fortress.epub
delete this book from library? [y/N]:
导出书籍
lspace export QUERY ~/some/folder/ --format mobi
将查询时匹配的所有书籍转换为“mobi”,并将它们导出到~/some/folder
要真正导出到另一种格式,您需要“ebook convert”,它是calibre的一部分!
通过webserver浏览和共享您的书籍
lspace web --host 0.0.0.0 --port 5000
这还为您提供了当前搜索结果的导入命令!
(或者您可以手动下载..)
设置dev env
1.复制此回购协议
2.制作一个virtualenv并激活它
virtualenv env --python=python
source env/bin/activate # for bash
# or
#. env/bin/activate.fish # for fish
3.安装要求
pip install -e .[dev]
4.设置一个单独的配置以避免扰乱常规安装
# initialize a new config file at a separate path
LSPACE_CONFIG=~/.config/lspace_dev/config.yml lspace init
# change the database and library path! (otherwise it would still use the regular db)
sed -i 's/lspace\/lspace.db/lspace_dev\/lspace.db/g' ~/.config/lspace_dev/config.yml
sed -i 's/~\/library/~\/library_dev/g' ~/.config/lspace_dev/config.yml
# also, if you want, set the loglevel to something else
在此之后,在开始尝试新内容之前,只需将lspace_config设置为新的配置文件即可
export LSPACE_CONFIG=~/.config/lspace_dev/config.yml # bash
set -gx LSPACE_CONFIG ~/.config/lspace_dev/config.yml # fish
为什么是“L空间”?
它以圆盘世界命名{a5}维度:)