audio player added
This commit is contained in:
@@ -24,6 +24,11 @@ class ContentItem:
|
|||||||
logger.debug(f"Copying {self.image_file} to {image_targetfile}")
|
logger.debug(f"Copying {self.image_file} to {image_targetfile}")
|
||||||
shutil.copyfile(self.image_file, image_targetfile)
|
shutil.copyfile(self.image_file, image_targetfile)
|
||||||
self.image_file = f"{self.image_file.stem}.jpg"
|
self.image_file = f"{self.image_file.stem}.jpg"
|
||||||
|
if self.audio_file and self.audio_file.exists():
|
||||||
|
audio_targetfile = Path(f"{config.output_dir}/{config.static_dir}/audio/{self.audio_file.name}")
|
||||||
|
logger.debug(f"Copying {self.audio_file} to {audio_targetfile}")
|
||||||
|
shutil.copyfile(self.audio_file, audio_targetfile)
|
||||||
|
self.audio_file = f"{self.audio_file.stem}.mp3"
|
||||||
if self.css_file and self.css_file.exists():
|
if self.css_file and self.css_file.exists():
|
||||||
css_targetfile = Path(f"{config.output_dir}/{config.static_dir}/css/{self.css_file.name}")
|
css_targetfile = Path(f"{config.output_dir}/{config.static_dir}/css/{self.css_file.name}")
|
||||||
logger.debug(f"Copying {self.css_file} to {css_targetfile}")
|
logger.debug(f"Copying {self.css_file} to {css_targetfile}")
|
||||||
@@ -55,6 +60,8 @@ class ContentItem:
|
|||||||
self.html = markdown.markdown(self.data.content)
|
self.html = markdown.markdown(self.data.content)
|
||||||
cover_image_path = Path(f"{self.source_file.parent}/{self.source_file.stem}.jpg")
|
cover_image_path = Path(f"{self.source_file.parent}/{self.source_file.stem}.jpg")
|
||||||
self.image_file = cover_image_path if cover_image_path.exists() else ""
|
self.image_file = cover_image_path if cover_image_path.exists() else ""
|
||||||
|
audio_filepath = Path(f"{self.source_file.parent}/{self.source_file.stem}.mp3")
|
||||||
|
self.audio_file = audio_filepath if audio_filepath.exists() else ""
|
||||||
css_filepath = Path(f"{self.source_file.parent}/{self.source_file.stem}.css")
|
css_filepath = Path(f"{self.source_file.parent}/{self.source_file.stem}.css")
|
||||||
self.css_file = css_filepath if css_filepath.exists() else ""
|
self.css_file = css_filepath if css_filepath.exists() else ""
|
||||||
js_filepath = Path(f"{self.source_file.parent}/{self.source_file.stem}.js")
|
js_filepath = Path(f"{self.source_file.parent}/{self.source_file.stem}.js")
|
||||||
|
|||||||
@@ -15,7 +15,18 @@
|
|||||||
{% if not content_item.omit_second_title %}
|
{% if not content_item.omit_second_title %}
|
||||||
<h1>{{ content_item.title }}</h1>
|
<h1>{{ content_item.title }}</h1>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<article>{{ content_item.html | safe }}</article>
|
<article>{{ content_item.html | safe }}</article>
|
||||||
|
|
||||||
|
{% if content_item.audio_file %}
|
||||||
|
<div id="audio" class="mb-4 mt-4">
|
||||||
|
<audio controls>
|
||||||
|
<source src="{{ parent_path }}static/audio/{{ content_item.audio_file }}" type="audio/mpeg">
|
||||||
|
Your browser does not support the audio element.
|
||||||
|
</audio>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div id="categories">
|
<div id="categories">
|
||||||
{% for category in content_item.categories %}
|
{% for category in content_item.categories %}
|
||||||
<a href="{{ parent_path }}categories/{{ category }}.html" class="mx-1 text-decoration-none small text-muted">{{ category }} </a>
|
<a href="{{ parent_path }}categories/{{ category }}.html" class="mx-1 text-decoration-none small text-muted">{{ category }} </a>
|
||||||
|
|||||||
Reference in New Issue
Block a user