Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Rename jpeg extension to jpg
  • Loading branch information
kthoden committed Sep 25, 2020
1 parent 3507108 commit 776194e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 9 additions & 1 deletion src/imxml2epub.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8; mode: python -*-
# Time-stamp: <2020-09-24 16:27:42 (kthoden)>
# Time-stamp: <2020-09-25 08:08:41 (kthoden)>

""" Convert a customized DocBook XML file into a set of files that
constitute the contents of an EPUB file.
Expand Down Expand Up @@ -776,6 +776,10 @@ def add_css_snippet(css_snippet, css_file):
strImageFileDir = re.sub("/", "", strImageFileDir)
strImageFileName = os.path.basename(strImageFileString)
strImageFileNamewoSuffix, strImageFileName_Suffix = os.path.splitext(strImageFileName)

if strImageFileName_Suffix == ".jpeg":
strImageFileName = strImageFileName.replace(".jpeg", ".jpg")

shutil.copy(
PUBLICATION_DIR / strImageFileString,
OUTPUT_DIR / "OEBPS/images" / (strImageFileDir + strImageFileName)
Expand Down Expand Up @@ -855,6 +859,10 @@ def add_css_snippet(css_snippet, css_file):
strImageFileDir = re.sub("/", "", strImageFileDir)
strImageFileName = os.path.basename(strImageFileString)
strImageFileNamewoSuffix, strImageFileName_Suffix = os.path.splitext(strImageFileName)

if strImageFileName_Suffix == ".jpeg":
strImageFileName = strImageFileName.replace(".jpeg", ".jpg")

shutil.copy(
PUBLICATION_DIR / strImageFileString,
OUTPUT_DIR / "OEBPS/images" / (strImageFileDir + strImageFileName)
Expand Down
6 changes: 2 additions & 4 deletions src/utils/libeoaconvert.py
Expand Up @@ -106,14 +106,12 @@ def sanitizeImage(
strFileFormat = strFileFormat_bytes.decode("utf-8").strip()
logging.debug(f"Image has been recognized as having format {strFileFormat} by {GM_PATH}.")
if strFileFormat == "JPEG":
pass
# print("looking at jpeg file")
# strNewImagepath = os.path.splitext(strImagepath)[0]
strNewImagepath = os.path.splitext(strImagepath)[0]
# strCommand = GM_PATH + " convert " + strImagepath + " " + strNewImagepath + ".jpg"
# listArguments = shlex.split(strCommand)
# subprocess.call(listArguments)
# os.remove(strImagepath)
# strImagepath = strNewImagepath + ".jpg"
strImagepath = strNewImagepath + ".jpg"
elif strFileFormat == "PNG":
pass
# print("looking at png file")
Expand Down

0 comments on commit 776194e

Please sign in to comment.