Remove chapter feature
We don’t have chapters
This commit is contained in:
parent
95c09e3dae
commit
3ded971b88
|
@ -34,13 +34,6 @@ def path_to_episode(name, format):
|
||||||
return f"{base}/{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):
|
def get_episode_info(name, format):
|
||||||
path = path_to_episode(name, format)
|
path = path_to_episode(name, format)
|
||||||
return json.loads(
|
return json.loads(
|
||||||
|
|
|
@ -2,7 +2,7 @@ base_url = "https://schulischer-schabernack.de"
|
||||||
compile_sass = true
|
compile_sass = true
|
||||||
default_language = "de"
|
default_language = "de"
|
||||||
feed_filename = "rss.xml"
|
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"]
|
ignored_content = ["sch???-*.opus", "sch???-*.txt"]
|
||||||
|
|
||||||
title = "Schulischer Schabernack"
|
title = "Schulischer Schabernack"
|
||||||
|
|
|
@ -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
|
|
|
@ -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
|
|
36
encode.py
36
encode.py
|
@ -40,44 +40,16 @@ def encode_episode(podcast, episode, format):
|
||||||
"COMMENT": episode["summary"],
|
"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 = ["ffmpeg", "-y", "-loglevel", "error"]
|
||||||
command.extend(["-i", infile])
|
command.extend(["-i", infile])
|
||||||
if not format in ["oga", "opus"]:
|
if not format in ["oga", "opus"]:
|
||||||
command.extend(["-i", episode["poster"]])
|
command.extend(["-i", episode["poster"]])
|
||||||
command.extend(["-i", "-"])
|
|
||||||
command.extend(["-c:v", "copy"])
|
command.extend(["-c:v", "copy"])
|
||||||
command.extend(["-map_metadata", "1"])
|
|
||||||
command.extend(options)
|
command.extend(options)
|
||||||
for k, v in tags.items():
|
for k, v in tags.items():
|
||||||
command.extend(["-metadata", f"{k}={v}"])
|
command.extend(["-metadata", f"{k}={v}"])
|
||||||
command.append(outfile)
|
command.append(outfile)
|
||||||
run(command, input=ffmpeg_chapters, check=True)
|
run(command, check=True)
|
||||||
|
|
||||||
if format in ["oga", "opus"]:
|
if format in ["oga", "opus"]:
|
||||||
if format == "oga":
|
if format == "oga":
|
||||||
|
@ -99,12 +71,6 @@ def encode_episode(podcast, episode, format):
|
||||||
base64.b64encode(picture.write()).decode("ascii")
|
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()
|
audio.save()
|
||||||
|
|
||||||
print(f" {format}", end="", flush=True)
|
print(f" {format}", end="", flush=True)
|
||||||
|
|
|
@ -33,11 +33,6 @@ class EpisodeHtmlParser(HTMLParser):
|
||||||
self.data = json.loads(data)
|
self.data = json.loads(data)
|
||||||
|
|
||||||
|
|
||||||
def chapter_fix_timestamp(chapter):
|
|
||||||
chapter["start"] = common.sexagesimal(chapter["start"])
|
|
||||||
return chapter
|
|
||||||
|
|
||||||
|
|
||||||
metadata = {}
|
metadata = {}
|
||||||
|
|
||||||
for file in sorted(glob(f"content/{common.ACRONYM}*.md")):
|
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
|
size = 0
|
||||||
metadata[episode]["formats"][format] = {"size": size}
|
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:
|
with open("static/episodes.json", "w") as f:
|
||||||
f.write(json.dumps(metadata))
|
f.write(json.dumps(metadata))
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,6 @@
|
||||||
<li><a href="{{ get_url(path="episodes/" ~ page.slug ~ "." ~ format.ext) | safe }}">{{ format.name }} ({{ episodes[page.slug].formats[format.ext].size | filesizeformat }})</a></li>
|
<li><a href="{{ get_url(path="episodes/" ~ page.slug ~ "." ~ format.ext) | safe }}">{{ format.name }} ({{ episodes[page.slug].formats[format.ext].size | filesizeformat }})</a></li>
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
<h4>Kapitel</h4>
|
|
||||||
<p>
|
|
||||||
{%- for chapter in episodes[page.slug].chapters %}
|
|
||||||
<strong>{{ chapter.start }}:</strong> {{ chapter.title }}<br/>
|
|
||||||
{%- endfor %}
|
|
||||||
</p>
|
|
||||||
<h4>Mitwirkende</h4>
|
<h4>Mitwirkende</h4>
|
||||||
<ul>
|
<ul>
|
||||||
{%- for contributor in page.extra.contributors %}
|
{%- for contributor in page.extra.contributors %}
|
||||||
|
@ -54,8 +48,6 @@
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
],
|
],
|
||||||
|
|
||||||
"chapters": {{ episodes[page.slug].chapters | json_encode | safe }},
|
|
||||||
|
|
||||||
"contributors": [
|
"contributors": [
|
||||||
{%- for contributor in page.extra.contributors %}
|
{%- for contributor in page.extra.contributors %}
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{%- set format = config.extra.formats | filter(attribute="ext", value=term.name | default(value="opus")) | first -%}
|
{%- set format = config.extra.formats | filter(attribute="ext", value=term.name | default(value="opus")) | first -%}
|
||||||
{%- set episodes_meta = load_data(path="static/episodes.json") -%}
|
{%- set episodes_meta = load_data(path="static/episodes.json") -%}
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:psc="http://podlove.org/simple-chapters" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
|
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
|
||||||
<channel>
|
<channel>
|
||||||
<title>{{ config.title }}</title>
|
<title>{{ config.title }}</title>
|
||||||
<link>{{ config.base_url | escape_xml | safe }}</link>
|
<link>{{ config.base_url | escape_xml | safe }}</link>
|
||||||
|
@ -40,11 +40,6 @@
|
||||||
<itunes:episode>{{ page.extra.episode }}</itunes:episode>
|
<itunes:episode>{{ page.extra.episode }}</itunes:episode>
|
||||||
<itunes:summary>{{ page.description }}</itunes:summary>
|
<itunes:summary>{{ page.description }}</itunes:summary>
|
||||||
<content:encoded><![CDATA[<p><strong>{{ page.extra.subtitle }}</strong></p> <p>{{ page.description}}</p> {{ page.content | safe }}]]></content:encoded>
|
<content:encoded><![CDATA[<p><strong>{{ page.extra.subtitle }}</strong></p> <p>{{ page.description}}</p> {{ page.content | safe }}]]></content:encoded>
|
||||||
<psc:chapters xmlns:psc="http://podlove.org/simple-chapters" version="1.2">
|
|
||||||
{%- for chapter in episode_meta.chapters %}
|
|
||||||
<psc:chapter start="{{ chapter.start }}" title="{{ chapter.title }}"/>
|
|
||||||
{%- endfor %}
|
|
||||||
</psc:chapters>
|
|
||||||
{%- for contributor in page.extra.contributors %}
|
{%- for contributor in page.extra.contributors %}
|
||||||
<atom:contributor>
|
<atom:contributor>
|
||||||
<atom:name>{{ contributor }}</atom:name>
|
<atom:name>{{ contributor }}</atom:name>
|
||||||
|
|
Loading…
Reference in a new issue