From d57b5573c976e591382bfc54072818045eb65921 Mon Sep 17 00:00:00 2001 From: Howland Owl Date: Fri, 10 Apr 2020 02:58:05 +0300 Subject: [PATCH] Some... strangeness seemed to occur in Amiga ascii with these values - however this may just be a local thing? I don't know, it seems to be fine when loaded over the net. --- editor.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/editor.py b/editor.py index 5a0412a..3ca9705 100644 --- a/editor.py +++ b/editor.py @@ -77,7 +77,14 @@ def getansidata(filename): def getamigadata(filename): """try to get some form of info from file (:""" - return 'todo.txt' + with open(filename, encoding='latin1') as f: + ascii = f.readlines() + width = 0 + for i in ascii: + if len(i) > width: + width = len(i) + return {'height': len(ascii), + 'width': width} def main(args): @@ -126,6 +133,12 @@ def main(args): elif suf in ['TXT', 'ASC', 'txt', 'asc', 'NFO', 'nfo', 'diz', 'DIZ']: stuff = getamigadata(dirfile) + entry = mysahli.blank_amiga_ascii() + entry['name'] = i +# entry['title'] = i +# entry['height'] = stuff['height'] + entry['file'] = i + newdata.append(entry) else: print("dunno what type of file this is...") mysahli.sahli['filedata'] = newdata