diff --git a/libeoaconvert.py b/libeoaconvert.py index ecec712..fd2aa5b 100644 --- a/libeoaconvert.py +++ b/libeoaconvert.py @@ -31,12 +31,6 @@ logging.basicConfig(level=LOGLEVEL, format='%(asctime)s - %(levelname)s - %(message)s') -if not os.path.exists("tmp_files/tmp_images/"): - os.makedirs(os.path.expanduser("tmp_files/tmp_images/")) - -tmp_image_dir = os.getcwd() + "/tmp_files/tmp_images/" -Datei = open('tmp_files/xelatex-run-images.log', 'w') - # Setup of various dictionaries for localization of various elements # dictLangFootnotes = {"it" : "Note a piè pagina", "fr" : "notes en bas de page", "de" : "Fußnoten", "en" : "Footnotes"} # dict_and = {"en" : "and", "de" : "und", "fr" : "et", "it" : "e"} @@ -85,6 +79,12 @@ def get_bigfoot_data(chapter): def sanitizeImage(strImagepath, GM_PATH, TL_PATH): """Adjust and convert image for epub standard""" + if not os.path.exists("tmp_files/tmp_images/"): + os.makedirs(os.path.expanduser("tmp_files/tmp_images/")) + + tmp_image_dir = os.getcwd() + "/tmp_files/tmp_images/" + xelatex_sanitizeimage_logfile = open('tmp_files/xelatex-run-images.log', 'w') + logging.debug(strImagepath) strCommand = GM_PATH + " identify -format \"%w\" " + strImagepath listArguments = shlex.split(strCommand) @@ -133,7 +133,7 @@ def sanitizeImage(strImagepath, GM_PATH, TL_PATH): logging.debug(Kommando) Argumente = shlex.split(Kommando) - subprocess.call(Argumente, cwd=tmp_image_dir, stdout=Datei) + subprocess.call(Argumente, cwd=tmp_image_dir, stdout=xelatex_sanitizeimage_logfile) strCommand = GM_PATH + " convert -density 400 " + clipped_file + " " + strNewImagepath + ".png" listArguments = shlex.split(strCommand)