Now handles image preparsing

This commit is contained in:
Howland Owl 2020-04-10 02:18:54 +03:00
parent e51bec4909
commit ba66b98200

View file

@ -10,6 +10,7 @@ import json
import argparse import argparse
import os import os
from sauce import SAUCE from sauce import SAUCE
from PIL import Image
from sahliEditorPython import sahlifile as SF from sahliEditorPython import sahlifile as SF
@ -37,7 +38,12 @@ def getdata(filedata, name):
def getpicdata(filename): def getpicdata(filename):
"""extract picture data from filename""" """extract picture data from filename"""
return 'todo.txt' imagedata = Image.open(filename)
picdata = {
'width': imagedata.width,
'height': imagedata.height
}
return picdata
def getansidata(filename): def getansidata(filename):
@ -98,7 +104,12 @@ def main(args):
if suf in ['png', 'jpg', 'jpeg', 'gif', if suf in ['png', 'jpg', 'jpeg', 'gif',
'PNG', 'JPG', 'JPEG', 'GIF']: 'PNG', 'JPG', 'JPEG', 'GIF']:
stuff = getpicdata(dirfile) stuff = getpicdata(dirfile)
a = 5 entry = mysahli.blank_picture()
entry['width'] = stuff['width']
entry['height'] = stuff['height']
entry['file'] = i
entry['name'] = i
newdata.append(entry)
elif suf in ['ans', 'ANS', 'BIN', 'bin', 'XB', 'xb']: elif suf in ['ans', 'ANS', 'BIN', 'bin', 'XB', 'xb']:
stuff = getansidata(dirfile) stuff = getansidata(dirfile)
entry = mysahli.blank_ansi() entry = mysahli.blank_ansi()