Skip to content

Commit

Permalink
fix sorting. delete temporary image folder.
Browse files Browse the repository at this point in the history
  • Loading branch information
MM-Lehmann authored May 2, 2020
1 parent 16f0dda commit 22ba9e2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pptx2h5p.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
from zipfile import ZipFile
from copy import deepcopy
import uuid
from natsort import natsorted

VERSION = '1.0'
VERSION = '1.1'


def ppt2png(f):
Expand Down Expand Up @@ -77,11 +78,14 @@ def add_to_json(newfile, image_folder, images, title):

ppt2png(filepath)
image_folder = os.path.join(folder, title)
images = os.listdir(image_folder)
images.sort()
images = natsorted(os.listdir(image_folder))
print("building new .h5p file")
add_to_json(os.path.splitext(filepath)[0] + '.h5p', image_folder, images, title)
print("Converting successfully finished.")
input("Press Enter to delete temporary image (export) folder and close this window.")
for image in images:
os.remove(os.path.join(image_folder, image))
os.rmdir(image_folder)
except Exception as e:
print(e)
input("Press Enter to close this window.")
input("An error has occured. Press Enter to close this window.")

0 comments on commit 22ba9e2

Please sign in to comment.