capybre-Calibre命令行工具的Python接口-Nolan Hawkins Simple Usages Getting Started

capybre-Calibre命令行工具的Python接口-Nolan Hawkins

发布:2020-12-23 10:47:25.502835

做者:Nolan Hawkins

### 做者邮箱:nolanhhawkins@gmail.com

### 首页:http://github.com/digitaltembo/capybre

### 文档:None

### 下载连接 

# Capybre

Tests Documentation Status PyPI version

Thin python wrapper over (some of) the Calibre CLI. Can be used for ebook conversion, metadata-extraction, and metadata-lookup:python

Simple Usages

# convert between formats; creates 'PrideAndPrejudice.mobi'

from capybre import convert

convert('PrideAndPrejudice.epub', as_ext='mobi')


# extract metadata 
from capybre import extract_metada

metadata = extract_metadata('PrideAndPrejudice.epub')

# prints "Pride and Prejudice"
print(metadata.title)


# extract cover from metadata; saves as cover.jpg
from capybre import extract_cover

extract_cover('PrideAndPrejudice.epub', output_file='cover.jpg')


# fetch metadata from internet sources
from capybre import fetch_metadata

metadata = fetch_metadata(title='Pride and Prejudice')

# prints Jane Austen
print(metadata.author)


# download cover from internet sources; saves as cover.jpg
from capybre import fetch_cover

fetch_cover(title='Pride and Prejudice')

Getting Started

First, you need to download Calibre's command line tools.git

You can follow instructions on Calibre's site to download, or download through package managers: github

# on Ubuntu
sudo apt-get install calibre

# on MacOS
brew install calibre

On MacOS, the command line tools may not be added to your path. To access them, add /Applications/calibre.app/Contents/MacOS/ to your PATH variable, for instance in ~/.bashrc adding bash

export PATH=$PATH:/Applications/calibre.app/Contents/MacOS/

Then, just install Capybre with pip!app

pip install capybre

See the full documentation at https://capybre.readthedocs.io/ide

Copy from pypi.org

查询时间:6.742ms
渲染时间:6.868ms

本文同步分享在 博客“zhenruyan”(other)。
若有侵权,请联系 support@oschina.cn 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一块儿分享。工具

相关文章
相关标签/搜索