mirror of https://github.com/ralsina/tapita.git
Refactored into a library
This commit is contained in:
parent
3ead11f863
commit
cb62835945
|
@ -4,7 +4,6 @@ import urllib.parse
|
|||
import urllib.request
|
||||
from io import BytesIO
|
||||
|
||||
import click
|
||||
from PIL import Image, ImageColor, ImageDraw, ImageFont
|
||||
|
||||
|
||||
|
@ -129,19 +128,3 @@ class Cover:
|
|||
|
||||
self.background = ImageColor.getrgb("#fff")
|
||||
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()
|
|
@ -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…
Reference in New Issue