From 14951e8422f5577047ee064ff6a8a8863d7fd2fb Mon Sep 17 00:00:00 2001 From: Luka Date: Mon, 20 Jul 2020 15:52:01 +0200 Subject: [PATCH] Added multi file reading --- README.md | 11 ++++++++++- src/loader.py | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6d00315..58ee3b1 100644 --- a/README.md +++ b/README.md @@ -8,4 +8,13 @@ Potrebne datoteke: Priporocam: pypy3 paket za hitrejse poganjanje. -Primer uporabe: `python3 wani.py ssj500k.xml Kolokacije_strukture.xml izhod.csv` \ No newline at end of file +Primer uporabe: `python3 wani.py ssj500k.xml Kolokacije_strukture.xml izhod.csv` + +## Instructions for running on GF + +Suggested running with saved mysql file in tmpfs. Instructions: + +```bash +sudo mkdir /mnt/tmp +sudo mount -t tmpfs tmpfs /mnt/tmp +``` \ No newline at end of file diff --git a/src/loader.py b/src/loader.py index 2ff41c5..48b25b7 100644 --- a/src/loader.py +++ b/src/loader.py @@ -1,3 +1,4 @@ +import os from xml.etree import ElementTree import logging import re @@ -18,6 +19,9 @@ def load_files(args, database): skip_id_check = args.skip_id_check do_msd_translate = not args.no_msd_translate + if len(filenames) == 1 and os.path.isdir(filenames[0]): + filenames = [os.path.join(filenames[0], file) for file in os.listdir(filenames[0])] + database.init("CREATE TABLE Files ( filename varchar(2048) )") for idx, fname in enumerate(filenames):