Parser "for Open Book File Format"
Project description
obff [python]
Open Book File Format Handler for python See specs for more informations.
Example
structure
example_book
├── example.py
├── hello_world.obff
├── book_content
│ ├── cover.png
│ ├── page_1.png
│ ├── page_2.png
│ └── page_3.png
└── exported_book
Snippet Write
import obff
import os # NOT REQUIRED TO IMPORT
myBook = obff.Book()
myBook.title = "Hello World Book"
myBook.description = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."
myBook.cover = obff.Cover(open("./book_content/cover.png", "rb").read())
pages = natsorted(os.listdir("./book_content"))
for page in pages:
if page.startswith("cover"):
continue
path = os.path.join("./book_content", page)
myBook.addPage(obff.Page(open(path, "rb").read()))
obff.write("./hello_world.obff", myBook)
Snippet Read
import obff
myBook = obff.read("./hello_world.obff")
print("Title: {0}".format(myBook.title))
print("Description: {0}".format(myBook.description))
myBook.cover.saveImage("./exported_book/cover.jpg")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
obff-1.0.1.tar.gz
(17.2 kB
view details)
Built Distribution
obff-1.0.1-py3-none-any.whl
(19.0 kB
view details)
File details
Details for the file obff-1.0.1.tar.gz
.
File metadata
- Download URL: obff-1.0.1.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c707d4d117ea468aa928ecbbe5c3a75da285ecb18dd64a541496bf745b7e56c |
|
MD5 | 0c85a056f109a9c6f95102df53a0467d |
|
BLAKE2b-256 | 7c5d847ca2ed552816b111233bb4adc504f3fbc211f766cdc436a9a642365fbf |
File details
Details for the file obff-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: obff-1.0.1-py3-none-any.whl
- Upload date:
- Size: 19.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22633c5a7ce91b647e858e11609adf0ac929b063670693c996437f7eb41b98f1 |
|
MD5 | 94297c64dd565414a22ffbd0d5717be5 |
|
BLAKE2b-256 | 6ec1a12d90d5fde3eba76423a859ec0c8472c3cb85926510f8c069e90b8ba979 |