From 3ded971b88602af09652297d1e1bcd10e6111ff9 Mon Sep 17 00:00:00 2001
From: Simon Bruder
Date: Tue, 30 Nov 2021 19:39:46 +0100
Subject: [PATCH] Remove chapter feature
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We don’t have chapters
---
common.py | 7 -----
config.toml | 2 +-
content/sch001-aller-anfang-ist-schwer.txt | 8 -----
content/sch002-noch-mehr-boilerplate.txt | 11 -------
encode.py | 36 +---------------------
metadata.py | 9 ------
templates/podlove-player.html | 8 -----
templates/rss.xml | 7 +----
8 files changed, 3 insertions(+), 85 deletions(-)
delete mode 100644 content/sch001-aller-anfang-ist-schwer.txt
delete mode 100644 content/sch002-noch-mehr-boilerplate.txt
diff --git a/common.py b/common.py
index dce768c..b20f6e4 100644
--- a/common.py
+++ b/common.py
@@ -34,13 +34,6 @@ def path_to_episode(name, format):
return f"{base}/{name}.{format}"
-def get_chapters(episode):
- with open(path_to_episode(episode, "txt")) as f:
- chapter_reader = csv.reader(f, delimiter="\t")
- for chapter in chapter_reader:
- yield {"start": float(chapter[0]), "title": chapter[2]}
-
-
def get_episode_info(name, format):
path = path_to_episode(name, format)
return json.loads(
diff --git a/config.toml b/config.toml
index 10e3b4d..5ca286b 100644
--- a/config.toml
+++ b/config.toml
@@ -2,7 +2,7 @@ base_url = "https://schulischer-schabernack.de"
compile_sass = true
default_language = "de"
feed_filename = "rss.xml"
-# source opus files and chapter data are not published
+# source opus files are not published
ignored_content = ["sch???-*.opus", "sch???-*.txt"]
title = "Schulischer Schabernack"
diff --git a/content/sch001-aller-anfang-ist-schwer.txt b/content/sch001-aller-anfang-ist-schwer.txt
deleted file mode 100644
index 82e6223..0000000
--- a/content/sch001-aller-anfang-ist-schwer.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-0.000000 0.000000 Intro
-19.343339 19.343339 Übersicht
-49.177982 49.177982 Das Leib-Seele-Problem
-251.672047 251.672047 Dualistische Antworten auf das Leib-Seele Problem
-666.674603 666.674603 noch mehr
-1030.055181 1030.055181 kapitel
-1250.372539 1250.372539 aber
-1542.221506 1542.221506 kein bock
diff --git a/content/sch002-noch-mehr-boilerplate.txt b/content/sch002-noch-mehr-boilerplate.txt
deleted file mode 100644
index dfb76a7..0000000
--- a/content/sch002-noch-mehr-boilerplate.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-0.000000 0.000000 auch
-84.910579 84.910579 für
-156.622622 156.622622 diesen
-222.175348 222.175348 test
-294.767294 294.767294 will
-343.601876 343.601876 ich
-402.995286 402.995286 nicht
-468.108061 468.108061 so
-512.983082 512.983082 viel
-597.013758 597.013758 Zeit
-674.885118 674.885118 verschwenden
diff --git a/encode.py b/encode.py
index bf9ae86..b7e10bc 100755
--- a/encode.py
+++ b/encode.py
@@ -40,44 +40,16 @@ def encode_episode(podcast, episode, format):
"COMMENT": episode["summary"],
}
- chapters = list(common.get_chapters(episode["file_base"]))
-
- duration = float(
- common.get_episode_info(episode["file_base"], "original")["duration"]
- )
-
- ffmpeg_chapters = b";FFMETADATA1\n\n"
- for idx, chapter in enumerate(chapters):
- ffmpeg_chapters += b"[CHAPTER]\nTIMEBASE=1/1000\n"
- ffmpeg_chapters += f"START={int(chapter['start'] * 1000)}\n".encode("utf-8")
- try:
- ffmpeg_chapters += f"END={int(chapters[idx+1]['start'] * 1000)}\n".encode(
- "utf-8"
- )
- except:
- ffmpeg_chapters += f"END={int(duration * 1000)}\n".encode("utf-8")
- escaped_title = (
- chapter["title"]
- .replace("=", "\=")
- .replace(";", "\;")
- .replace("#", "\#")
- .replace("\\", "\\\\")
- .replace("\n", "\\\n")
- )
- ffmpeg_chapters += f"title={escaped_title}\n\n".encode("utf-8")
-
command = ["ffmpeg", "-y", "-loglevel", "error"]
command.extend(["-i", infile])
if not format in ["oga", "opus"]:
command.extend(["-i", episode["poster"]])
- command.extend(["-i", "-"])
command.extend(["-c:v", "copy"])
- command.extend(["-map_metadata", "1"])
command.extend(options)
for k, v in tags.items():
command.extend(["-metadata", f"{k}={v}"])
command.append(outfile)
- run(command, input=ffmpeg_chapters, check=True)
+ run(command, check=True)
if format in ["oga", "opus"]:
if format == "oga":
@@ -99,12 +71,6 @@ def encode_episode(podcast, episode, format):
base64.b64encode(picture.write()).decode("ascii")
]
- # chapters for vorbis
- if format == "oga":
- for idx, chapter in enumerate(chapters):
- audio[f"CHAPTER{idx:03}"] = common.sexagesimal(chapter["start"])
- audio[f"CHAPTER{idx:03}NAME"] = chapter["title"]
-
audio.save()
print(f" {format}", end="", flush=True)
diff --git a/metadata.py b/metadata.py
index dd81eff..884cf49 100755
--- a/metadata.py
+++ b/metadata.py
@@ -33,11 +33,6 @@ class EpisodeHtmlParser(HTMLParser):
self.data = json.loads(data)
-def chapter_fix_timestamp(chapter):
- chapter["start"] = common.sexagesimal(chapter["start"])
- return chapter
-
-
metadata = {}
for file in sorted(glob(f"content/{common.ACRONYM}*.md")):
@@ -57,10 +52,6 @@ for file in sorted(glob(f"content/{common.ACRONYM}*.md")):
size = 0
metadata[episode]["formats"][format] = {"size": size}
- metadata[episode]["chapters"] = list(
- map(chapter_fix_timestamp, common.get_chapters(episode))
- )
-
with open("static/episodes.json", "w") as f:
f.write(json.dumps(metadata))
diff --git a/templates/podlove-player.html b/templates/podlove-player.html
index ede09db..758e7f0 100644
--- a/templates/podlove-player.html
+++ b/templates/podlove-player.html
@@ -12,12 +12,6 @@
{{ format.name }} ({{ episodes[page.slug].formats[format.ext].size | filesizeformat }})
{%- endfor %}
- Kapitel
-
- {%- for chapter in episodes[page.slug].chapters %}
- {{ chapter.start }}: {{ chapter.title }}
- {%- endfor %}
-
Mitwirkende
{%- for contributor in page.extra.contributors %}
@@ -54,8 +48,6 @@
{%- endfor %}
],
- "chapters": {{ episodes[page.slug].chapters | json_encode | safe }},
-
"contributors": [
{%- for contributor in page.extra.contributors %}
{
diff --git a/templates/rss.xml b/templates/rss.xml
index 1d87793..ddd3252 100644
--- a/templates/rss.xml
+++ b/templates/rss.xml
@@ -2,7 +2,7 @@
{%- set format = config.extra.formats | filter(attribute="ext", value=term.name | default(value="opus")) | first -%}
{%- set episodes_meta = load_data(path="static/episodes.json") -%}
-
+
{{ config.title }}
{{ config.base_url | escape_xml | safe }}
@@ -40,11 +40,6 @@
{{ page.extra.episode }}
{{ page.description }}
{{ page.extra.subtitle }}
{{ page.description}}
{{ page.content | safe }}]]>
-
- {%- for chapter in episode_meta.chapters %}
-
- {%- endfor %}
-
{%- for contributor in page.extra.contributors %}
{{ contributor }}