more templates + db improvements
@@ -5,21 +5,27 @@ from meme_otron import img_factory as imgf
|
||||
from meme_otron import meme_db
|
||||
from meme_otron import utils
|
||||
|
||||
logging.basicConfig(format="[%(asctime)s][%(levelname)s][%(module)s] %(message)s", level=logging.DEBUG)
|
||||
logging.basicConfig(format="[%(asctime)s][%(levelname)s][%(module)s] %(message)s", level=logging.WARNING)
|
||||
|
||||
imgf.load_fonts()
|
||||
meme_db.load_memes()
|
||||
|
||||
dst_dir = utils.relative_path(__file__, "templates")
|
||||
|
||||
templates_dir = utils.relative_path(__file__, "..", "templates")
|
||||
|
||||
for f in os.listdir(dst_dir):
|
||||
if path.isfile(path.join(dst_dir, f)):
|
||||
os.unlink(path.join(dst_dir, f))
|
||||
|
||||
count = 0
|
||||
|
||||
for meme_id in meme_db.DATA:
|
||||
meme = meme_db.get_meme(meme_id)
|
||||
if meme is not None:
|
||||
img = imgf.make(meme.template, meme.texts, debug=True)
|
||||
if img is not None:
|
||||
img.save(path.join(dst_dir, meme.template))
|
||||
print(meme_id)
|
||||
count += 1
|
||||
|
||||
print(f"{count} registered templates / {len(os.listdir(templates_dir))} files")
|
||||
|
Before Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 43 KiB |
|
Before Width: | Height: | Size: 79 KiB |
|
Before Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 89 KiB |
|
Before Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 97 KiB |
|
Before Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 40 KiB |