Metadata-Version: 2.1
Name: lspace
Version: 0.4.1
Summary: a ebook manager built around isbnlib
Home-page: https://github.com/puhoy/lspace
Author: jan
Author-email: stuff@kwoh.de
License: UNKNOWN
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: Natural Language :: English
Classifier: Topic :: Utilities
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Description-Content-Type: text/markdown
Requires-Dist: alembic (==1.0.10)
Requires-Dist: aniso8601 (==7.0.0)
Requires-Dist: apispec (==2.0.1)
Requires-Dist: attrs (==19.1.0)
Requires-Dist: blinker (==1.4)
Requires-Dist: certifi (==2019.6.16)
Requires-Dist: chardet (==3.0.4)
Requires-Dist: Click (==7.0)
Requires-Dist: colorama (==0.4.1)
Requires-Dist: EbookLib (==0.17.1)
Requires-Dist: Flask (==1.0.3)
Requires-Dist: Flask-Migrate (==2.5.2)
Requires-Dist: flask-restplus (==0.12.1)
Requires-Dist: Flask-SQLAlchemy (==2.4.0)
Requires-Dist: flask-whooshee (==0.7.0)
Requires-Dist: Flask-WTF (==0.14.2)
Requires-Dist: gunicorn (==19.9.0)
Requires-Dist: html2text (==2018.1.9)
Requires-Dist: idna (==2.8)
Requires-Dist: isbnlib (==3.9.8)
Requires-Dist: itsdangerous (==1.1.0)
Requires-Dist: Jinja2 (==2.10.1)
Requires-Dist: jsonschema (==3.0.2)
Requires-Dist: lxml (==4.3.4)
Requires-Dist: Mako (==1.0.12)
Requires-Dist: MarkupSafe (==1.1.1)
Requires-Dist: marshmallow (==3.0.0rc9)
Requires-Dist: PyPDF2 (==1.26.0)
Requires-Dist: pyrsistent (==0.15.4)
Requires-Dist: python-dateutil (==2.8.0)
Requires-Dist: python-editor (==1.0.4)
Requires-Dist: python-slugify (==3.0.2)
Requires-Dist: pytz (==2019.2)
Requires-Dist: PyYAML (==5.1.1)
Requires-Dist: requests (==2.22.0)
Requires-Dist: six (==1.12.0)
Requires-Dist: SQLAlchemy (==1.3.4)
Requires-Dist: text-unidecode (==1.2)
Requires-Dist: typing (==3.6.6)
Requires-Dist: urllib3 (==1.25.3)
Requires-Dist: Werkzeug (==0.15.4)
Requires-Dist: Whoosh (==2.7.4)
Requires-Dist: WTForms (==2.2.1)
Provides-Extra: dev
Requires-Dist: pytest (==4.5.0) ; extra == 'dev'
Requires-Dist: pytest-cov (==2.7.1) ; extra == 'dev'
Requires-Dist: pytest-cover (==3.0.0) ; extra == 'dev'
Requires-Dist: codecov (==2.0.1) ; extra == 'dev'
Requires-Dist: ipython (==7.5.0) ; extra == 'dev'
Requires-Dist: doit (==0.31.1) ; extra == 'dev'
Provides-Extra: test
Requires-Dist: pytest (==4.5.0) ; extra == 'test'
Requires-Dist: pytest-cov (==2.7.1) ; extra == 'test'
Requires-Dist: pytest-cover (==3.0.0) ; extra == 'test'
Requires-Dist: codecov (==2.0.1) ; extra == 'test'

# L-Space

a cli ebook manager built around [isbnlib](https://github.com/xlcnd/isbnlib)

when importing it tries to find isbns in the files metadata and in the text. 
with the isbn it tries to fetch metadata about the book from google books and openlibrary. 
if no isbn is found, it queries metadata based on the filename.

after this, your properly renamed files will be stored in your library folder.

currently supports epub and pdf.


[![Build Status](https://travis-ci.org/puhoy/lspace.svg?branch=master)](https://travis-ci.org/puhoy/lspace)

[![codecov](https://codecov.io/gh/puhoy/lspace/branch/master/graph/badge.svg)](https://codecov.io/gh/puhoy/lspace)

## requirements

python >=3.5 and pip


## installation

#### from pypi (latest release)

`pip install lspace`

#### from github (probably-not-so-stable-dev-stuff)

`pip install git+https://github.com/puhoy/lspace.git`


## setup 

after installation, you should run

`lspace init`

this will setup a new configuration file, which you can edit to specify the structure of your library, for example.

a default config file would look like this:
```
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
```

#### database path

path to your database. 
the project uses sqlalchemy, so all databases supported by sqlalchemy should be fine.

#### file_format

template string for storing the plain files in the library.

`{SHELF}/{AUTHORS}_{TITLE}` would produce files like `scifi/cixin-liu_three-body-problem.epub`

author and title will be automatically slugified for this.

possible variables to use are: AUTHORS, TITLE, SHELF, YEAR, LANGUAGE, PUBLISHER

#### library path

where the imported files are stored

#### loglevel

the default python loglevels (debug, info, error, exception)

#### default_{shelf, author, language, publisher}

the default field names, in case nothing is specified in import


## usage

### importing

`lspace import path/to/ebook.epub`

`lspace import path/to/folder/*`

#### import from calibre library

`lspace import path/to/calibre_library/metadata.db`

#### import from lspace api

`lspace import http://<some-address>/api/v1/`

the web interface (`lspace web` - scroll down a bit!) generates import strings based on your search! 


### searching your library

`lspace list QUERY [--path]`

for example, 

`lspace list programming --path`

would return something like

    /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

and 

`lspace list dwarf`

would return return

    Peter Tyson - Getting Started With Dwarf Fortress

### removing stuff

`lspace remove QUERY`

this command will ask you before it actually deletes stuff :)

    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]:

### exporting books


`lspace export QUERY ~/some/folder/ --format mobi`

would convert all books matching on QUERY to 'mobi' and export them to ~/some/folder

to actually export to another format, you need "ebook-convert", which is part of [calibre](https://calibre-ebook.com/)!

### browse & share your books via webserver

`lspace web --host 0.0.0.0 --port 5000` 

![L-Space web interface](https://raw.githubusercontent.com/puhoy/lspace/master/lspace_screenshot.png "screenshot of the L-Space web interface")

this also gives you the import command for your current search results!

(or you can just download them manually..)

## setting up a dev env

#### 1. clone this repo 

#### 2. make a virtualenv and activate it

```
virtualenv  env --python=python

source env/bin/activate  # for bash

# or
#. env/bin/activate.fish  # for fish
```

#### 3. install requirements

```
    pip install  -e .[dev]
```

#### 4. set up a separate config to not mess up your regular installation

```
# 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
``` 

after this, just set LSPACE_CONFIG to your new config file before you start to try new stuff

```
export LSPACE_CONFIG=~/.config/lspace_dev/config.yml  # bash
set -gx LSPACE_CONFIG ~/.config/lspace_dev/config.yml  # fish 
```

## why "L-space"?

its named after discworlds [library-space](https://en.wikipedia.org/wiki/List_of_dimensions_of_the_Discworld#L-space) dimension :)

