Nothing Special   »   [go: up one dir, main page]

Skip to content

〰️ welut is django plugin to convert the .epub, .mobi or .pdf files as images. Usefull to manage e-library or e-commerce bassed on e-book system.

License

Notifications You must be signed in to change notification settings

agusmakmun/welut

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welut is a ebook converter

Requirements

  • ebook-convert: $ sudo apt install calibre - convert epub & mobi to pdf.
  • pdftocairo: $ sudo apt install -y poppler-utils - convert pdf to images

Installation

Welut is available directly from PyPI:

  1. Installing the package.
$ pip install welut
  1. Don't forget to add 'welut' to your 'INSTALLED_APPS'.
# settings.py
INSTALLED_APPS = [
    ....
    'welut',
]
  1. Doing makemigrations & migrate
./manage.py makemigrations welut
./manage.py migrate welut

Configuration (settings.py)

WELUT_EXTENSIONS = ['.pdf', '.epub', '.mobi']         # support file extensions
WELUT_REMOVED_EXTENSIONS = ['.pdf', '.epub', '.mobi'] # file to remove after uploaded
WELUT_IMAGES_EXTENSION = '.png'                       # format images extension

Usage

You can using ForeignKey or OneToOneField.

from django.db import models
from welut.models import EbookConverter


class EBook(models.Model):
    title = models.CharField(max_length=200)
    ebook_file = models.ForeignKey(EbookConverter, related_name='ebook_file')
    created = models.DateTimeField(auto_now_add=True)
    modified = models.DateTimeField(auto_now=True)

    def __str__(self):
        return self.title

    def get_files(self):
        """ return list images of ebook per-page """
        return self.ebook_file.get_files()

Templates

{% for img_url in object.get_files %}
  <img src="{{ MEDIA_URL }}{{ img_url }}">
{% endfor %}

Usage Preview

https://raw.githubusercontent.com/agusmakmun/welut/master/welut_demo/media/welut-demo.png

About

〰️ welut is django plugin to convert the .epub, .mobi or .pdf files as images. Usefull to manage e-library or e-commerce bassed on e-book system.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published