mirror of
https://github.com/ralsina/tapita.git
synced 2025-06-07 12:10:24 -03:00
Refactored into a library
This commit is contained in:
parent
3ead11f863
commit
cb62835945
@ -4,7 +4,6 @@ import urllib.parse
|
|||||||
import urllib.request
|
import urllib.request
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
import click
|
|
||||||
from PIL import Image, ImageColor, ImageDraw, ImageFont
|
from PIL import Image, ImageColor, ImageDraw, ImageFont
|
||||||
|
|
||||||
|
|
||||||
@ -129,19 +128,3 @@ class Cover:
|
|||||||
|
|
||||||
self.background = ImageColor.getrgb("#fff")
|
self.background = ImageColor.getrgb("#fff")
|
||||||
self.foreground = ImageColor.getrgb("rgb(50, 50, 50)")
|
self.foreground = ImageColor.getrgb("rgb(50, 50, 50)")
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
|
||||||
@click.option("-t", "--title", metavar="<title>", help="Book title")
|
|
||||||
@click.option(
|
|
||||||
"-s", "--subtitle", metavar="<subtitle>", help="Book subtitle", default=None
|
|
||||||
)
|
|
||||||
@click.option("-a", "--author", metavar="<author>", help="Book author", default=None)
|
|
||||||
@click.option("-o", "--output", metavar="<filename>", help="Output file (- for stdout)")
|
|
||||||
def cover(title, author, output, subtitle):
|
|
||||||
cover = Cover(title, subtitle, author)
|
|
||||||
cover.cover_image.save(output)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
cover()
|
|
18
tapita/__main__.py
Normal file
18
tapita/__main__.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import click
|
||||||
|
from tapita import Cover
|
||||||
|
|
||||||
|
|
||||||
|
@click.command()
|
||||||
|
@click.option("-t", "--title", metavar="<title>", help="Book title")
|
||||||
|
@click.option(
|
||||||
|
"-s", "--subtitle", metavar="<subtitle>", help="Book subtitle", default=None
|
||||||
|
)
|
||||||
|
@click.option("-a", "--author", metavar="<author>", help="Book author", default=None)
|
||||||
|
@click.option("-o", "--output", metavar="<filename>", help="Output file (- for stdout)")
|
||||||
|
def cover(title, author, output, subtitle):
|
||||||
|
cover = Cover(title, subtitle, author)
|
||||||
|
cover.cover_image.save(output)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
cover()
|
Loading…
x
Reference in New Issue
Block a user