Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Lehmann authored and Martin Lehmann committed May 21, 2024
1 parent 5eff8a6 commit c4980dc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM tobix/pywine
MAINTAINER Martin Lehmann (https://github.com/MM-Lehmann)
LABEL author="Martin Lehmann (https://github.com/MM-Lehmann)"

RUN wine pip install pip-tools --no-warn-script-location --no-cache

Expand Down
13 changes: 7 additions & 6 deletions pptx2h5p.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

VERSION = "1.3.1"
YEAR = "2024"
AUTHOR = "Martin Lehmann"
target_ratio = 2 # target aspect ratio for slides in h5p


Expand Down Expand Up @@ -96,8 +97,8 @@ def add_to_json(newfile, image_folder, images, title):
try:
# Manifest
print("Powerpoint to h5p Converter.")
print(f"Version: {VERSION}")
print(f"Martin Lehmann, {YEAR}")
print(f"Author: {AUTHOR}")
print(f"Version: {VERSION}, {YEAR}")
print("Licence: BSD-2-Clause")
print("Source code: https://github.com/MM-Lehmann/pptx2h5p")
if len(sys.argv) != 2:
Expand All @@ -106,15 +107,15 @@ def add_to_json(newfile, image_folder, images, title):

# extract metadata
filepath = os.path.abspath(sys.argv[1])
print(f"extracting images from:\n\t {filepath}")
if not os.path.exists(filepath):
print(f"No such file: {filepath}", file=sys.stderr)
sys.exit(-1)
folder = os.path.dirname(filepath)
filename = os.path.basename(filepath)
title = os.path.splitext(filename)[0]
if not os.path.exists(filepath):
print("No such file!", file=sys.stderr)
sys.exit(-1)

# extract images
print(f"extracting images from:\n\t {filepath}")
ppt2image(filepath)
image_folder = os.path.join(folder, title)
images = natsorted(os.listdir(image_folder))
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile
Expand Down

0 comments on commit c4980dc

Please sign in to comment.