diff --git a/README.md b/README.md index 91157a1..752f093 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Mirva A tool to create a web gallery from a single folder of images. +Also .mp4 files are included in the gallery ## Installation diff --git a/mirva/__init__.py b/mirva/__init__.py index f95b5a7..2c50999 100644 --- a/mirva/__init__.py +++ b/mirva/__init__.py @@ -1,4 +1,4 @@ -__version__ = "20210826.0" +__version__ = "20210831.0" def get_version(): diff --git a/mirva/mirva.py b/mirva/mirva.py index a7d25a1..bd87516 100755 --- a/mirva/mirva.py +++ b/mirva/mirva.py @@ -17,6 +17,8 @@ class Mirva: self.resource_dir = ".mirva" self.config_file = os.path.join(self.resource_dir, "config.cfg") self.config_backup = os.path.join(self.resource_dir, "config.cfg.bkp") + self.image_match = re.compile(".*\.jpg$|.*\.jpeg$|.*\.png$|.*\.gif$|.*\.tif$", re.I) + self.video_match = re.compile(".*\.mp4$", re.I) self.get_options() os.chdir(self.options.folder) self.write_resources() @@ -92,7 +94,7 @@ class Mirva: for f in sorted(os.listdir(".")): if f.startswith("."): continue - if not image_match.match(f): + if not (self.image_match.match(f) or self.video_match.match(f)): continue files.append(f) return files @@ -233,6 +235,22 @@ function create_button(direction, to) {{ def get_post(self, image, title, content): + if self.video_match.match(image): + return """ +
""".format( + image=image, title=title, content=content + ) + return """