diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..d2c483e
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..a2e120d
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..94fb310
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/pycbzhelper.iml b/.idea/pycbzhelper.iml
new file mode 100644
index 0000000..3f370ba
--- /dev/null
+++ b/.idea/pycbzhelper.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..9187d4f
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1675842063151
+
+
+ 1675842063151
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pycbzhelper/exceptions.py b/pycbzhelper/exceptions.py
index 8e47152..86db50e 100644
--- a/pycbzhelper/exceptions.py
+++ b/pycbzhelper/exceptions.py
@@ -12,3 +12,7 @@ class MissingPageFile(PyCBZHelperException):
class InvalidFilePermission(PyCBZHelperException):
"""Unable to delete existing file."""
+
+
+class FileNotFound(PyCBZHelperException):
+ """The specified source file was not found."""
diff --git a/pycbzhelper/helper.py b/pycbzhelper/helper.py
index d958843..2836834 100644
--- a/pycbzhelper/helper.py
+++ b/pycbzhelper/helper.py
@@ -3,12 +3,13 @@ import pathlib
import shutil
import zipfile
+import requests
from json2xml import json2xml
from langcodes import Language
from PIL import Image
from pycbzhelper.comicinfo import KEYS_STRING, KEYS_INT, KEYS_SPECIAL, KEYS_AGE, KEYS_FORMAT, KEYS_PAGE_TYPE
-from pycbzhelper.exceptions import InvalidKeyValue, MissingPageFile, InvalidFilePermission
+from pycbzhelper.exceptions import InvalidKeyValue, MissingPageFile, InvalidFilePermission, FileNotFound
from pycbzhelper.utils import get_key_value, delete_none, slugify
@@ -60,6 +61,16 @@ class Helper:
kwargs['PageCount'] = len(kwargs.get('Pages'))
for i in range(kwargs.get('PageCount')):
page = kwargs.get('Pages')[i]
+ if isinstance(page['File'], bytes) or (isinstance(page['File'], str) and page['File'].startswith('https://')):
+ file = os.path.join("tmp", f"page-{i:03d}.jpg")
+ with open(file, mode="wb") as f:
+ f.write(page['File'] if isinstance(page['File'], bytes) else requests.get(url=page['File']).content)
+ f.close()
+ page['File'] = file
+
+ if not os.path.exists(page['File']):
+ raise FileNotFound(f"ERROR: Source file is invalid: {page['File']}")
+
properties = Image.open(page['File'])
self._files.append(page['File'])
if not page.get('Type'):