1
0
Fork 0
mirror of https://gitlab.com/oloturia/fumcaso.git synced 2024-11-01 01:38:16 +01:00

added x-y and panel dimensions to config file

This commit is contained in:
oloturia 2020-12-17 02:48:30 +01:00
parent 657ea7106d
commit ae8a04176b
3 changed files with 13 additions and 4 deletions

View file

@ -36,6 +36,9 @@ Configuration file is a JSON with this tree:
filename: the default filename used by function createStrip, if not specified (not used in any of the scripts, at the moment) filename: the default filename used by function createStrip, if not specified (not used in any of the scripts, at the moment)
imagesLocation: the folder where the different panels are stored imagesLocation: the folder where the different panels are stored
csvLocation: the folder where the csv are stored csvLocation: the folder where the csv are stored
xSize: width of the final image
ySize: height of the final image
panelLength: length of the single panel (roughly panelLength * number-of-panels should be = xSize)
font: the font used font: the font used
"application":{ special instruction for applications, like "twitter", "mastodon", "telegram" "application":{ special instruction for applications, like "twitter", "mastodon", "telegram"
"token" token location "token" token location

View file

@ -7,6 +7,9 @@
"imagesLocation": "./oloturia", "imagesLocation": "./oloturia",
"csvLocation": "./oloturia", "csvLocation": "./oloturia",
"font": "./ubuntu.ttf", "font": "./ubuntu.ttf",
"xSize":2400,
"ySize":500,
"panelLength":600,
"twitter": { "twitter": {
"token": "./twitter_token", "token": "./twitter_token",
"filename": "/twitter.png" "filename": "/twitter.png"

View file

@ -112,11 +112,11 @@ def writeStrip(story,fontSize,config):
strip.append(vign) strip.append(vign)
except FileNotFoundError: except FileNotFoundError:
pass pass
image = Image.new('RGBA',(2400,500)) image = Image.new('RGBA',(config["xSize"],config["ySize"]))
xshift=0 xshift=0
for vign in strip: for vign in strip:
image.paste(vign,(xshift,0)) image.paste(vign,(xshift,0))
xshift += 600 xshift += config["panelLength"]
return image return image
def createStrip(config,specialPlatform="",fontSize=22): def createStrip(config,specialPlatform="",fontSize=22):
@ -154,12 +154,15 @@ def readConfig(profile=False,platform=False):
imagesLocation = checkLocal(config[profile]["imagesLocation"]) imagesLocation = checkLocal(config[profile]["imagesLocation"])
csvLocation = checkLocal(config[profile]["csvLocation"]) csvLocation = checkLocal(config[profile]["csvLocation"])
font = checkLocal(config[profile]["font"]) font = checkLocal(config[profile]["font"])
xSize = config[profile]["xSize"]
ySize = config[profile]["ySize"]
panelLength = config[profile]["panelLength"]
if platform: if platform:
token = checkLocal(config[profile][platform]["token"]) token = checkLocal(config[profile][platform]["token"])
filename = checkLocal(config[profile][platform]["filename"]) filename = checkLocal(config[profile][platform]["filename"])
return {"saveLocation":saveLocation,"imagesLocation":imagesLocation,"csvLocation":csvLocation,"font":font,"token":token,"filename":filename} return {"saveLocation":saveLocation,"imagesLocation":imagesLocation,"csvLocation":csvLocation,"font":font,"token":token,"filename":filename,"xSize":xSize,"ySize":ySize,"panelLength":panelLength}
filename = config[profile]["filename"] filename = config[profile]["filename"]
return {"saveLocation":saveLocation,"imagesLocation":imagesLocation,"csvLocation":csvLocation,"font":font,"filename":filename} return {"saveLocation":saveLocation,"imagesLocation":imagesLocation,"csvLocation":csvLocation,"font":font,"filename":filename,"xSize":xSize,"ySize":ySize,"panelLength":panelLength}
def checkLocal(directory): def checkLocal(directory):
"""Checks if it's a relative or absolute path""" """Checks if it's a relative or absolute path"""