video support
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
# Mirva
|
# Mirva
|
||||||
|
|
||||||
A tool to create a web gallery from a single folder of images.
|
A tool to create a web gallery from a single folder of images.
|
||||||
|
Also .mp4 files are included in the gallery
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
__version__ = "20210826.0"
|
__version__ = "20210831.0"
|
||||||
|
|
||||||
|
|
||||||
def get_version():
|
def get_version():
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ class Mirva:
|
|||||||
self.resource_dir = ".mirva"
|
self.resource_dir = ".mirva"
|
||||||
self.config_file = os.path.join(self.resource_dir, "config.cfg")
|
self.config_file = os.path.join(self.resource_dir, "config.cfg")
|
||||||
self.config_backup = os.path.join(self.resource_dir, "config.cfg.bkp")
|
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()
|
self.get_options()
|
||||||
os.chdir(self.options.folder)
|
os.chdir(self.options.folder)
|
||||||
self.write_resources()
|
self.write_resources()
|
||||||
@@ -92,7 +94,7 @@ class Mirva:
|
|||||||
for f in sorted(os.listdir(".")):
|
for f in sorted(os.listdir(".")):
|
||||||
if f.startswith("."):
|
if f.startswith("."):
|
||||||
continue
|
continue
|
||||||
if not image_match.match(f):
|
if not (self.image_match.match(f) or self.video_match.match(f)):
|
||||||
continue
|
continue
|
||||||
files.append(f)
|
files.append(f)
|
||||||
return files
|
return files
|
||||||
@@ -233,6 +235,22 @@ function create_button(direction, to) {{
|
|||||||
|
|
||||||
def get_post(self, image, title, content):
|
def get_post(self, image, title, content):
|
||||||
|
|
||||||
|
if self.video_match.match(image):
|
||||||
|
return """
|
||||||
|
<div class="post">
|
||||||
|
<div class="navigation"> </div>
|
||||||
|
<div class=center><a href="{image}">
|
||||||
|
<video class=post_image controls >
|
||||||
|
<source src="{image}" type="video/mp4" >
|
||||||
|
</video>
|
||||||
|
</a></div>
|
||||||
|
<div class="meta"><div class="name">{title}</div></div>
|
||||||
|
<div style="clear: both;"> </div>
|
||||||
|
<div class="entry">{content}</div>
|
||||||
|
</div>""".format(
|
||||||
|
image=image, title=title, content=content
|
||||||
|
)
|
||||||
|
|
||||||
return """
|
return """
|
||||||
<div class="post">
|
<div class="post">
|
||||||
<div class="navigation"> </div>
|
<div class="navigation"> </div>
|
||||||
@@ -302,9 +320,11 @@ function create_button(direction, to) {{
|
|||||||
if link:
|
if link:
|
||||||
r = 0
|
r = 0
|
||||||
|
|
||||||
|
res = "{:d}x{:d}>".format(int(r), int(r))
|
||||||
force = self.options.force
|
force = self.options.force
|
||||||
for f in self.file_list:
|
for f in self.file_list:
|
||||||
res = "{:d}x{:d}>".format(int(r), int(r))
|
if self.video_match.match(f):
|
||||||
|
continue
|
||||||
outfile = os.path.join(".med", "{}.jpg".format(f))
|
outfile = os.path.join(".med", "{}.jpg".format(f))
|
||||||
if force:
|
if force:
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -196,11 +196,13 @@ a:hover {
|
|||||||
.post_image {
|
.post_image {
|
||||||
max-height: calc(100vh - 60px);
|
max-height: calc(100vh - 60px);
|
||||||
max-width: calc(100vw - 128px);
|
max-width: calc(100vw - 128px);
|
||||||
|
display: inline;
|
||||||
}
|
}
|
||||||
@media only screen and (max-width: 800px) {
|
@media only screen and (max-width: 800px) {
|
||||||
.post_image {
|
.post_image {
|
||||||
max-height: calc(100vh - 2px);
|
max-height: calc(100vh - 2px);
|
||||||
max-width: calc(100vw - 2px);
|
max-width: calc(100vw - 2px);
|
||||||
|
display: inline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Footer */
|
/* Footer */
|
||||||
|
|||||||
Reference in New Issue
Block a user