add markdown descriptions
All checks were successful
ci/woodpecker/push/build Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
This commit is contained in:
parent
dc88dc49e8
commit
2d424d0be6
5 changed files with 23 additions and 5 deletions
|
@ -9,6 +9,7 @@ dependencies = [
|
|||
"fastapi[standard]>=0.115.6",
|
||||
"ffmpeg-normalize>=1.31.0",
|
||||
"ffmpeg-python>=0.2.0",
|
||||
"markdown>=3.7",
|
||||
"nanoid>=2.0.0",
|
||||
"pillow>=11.1.0",
|
||||
"podgen>=1.1.0",
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import urllib.parse
|
||||
import uuid
|
||||
from contextlib import asynccontextmanager
|
||||
from datetime import timedelta
|
||||
from datetime import timedelta, timezone
|
||||
from pathlib import Path
|
||||
from typing import Annotated, Any, Generator, Optional
|
||||
|
||||
import markdown
|
||||
import podgen
|
||||
import structlog
|
||||
from fastapi import Depends, FastAPI, Form, HTTPException, Request, Response, UploadFile
|
||||
|
@ -532,7 +533,7 @@ def get_podcast_feed(session: SessionDep, request: Request, podcast_id: str):
|
|||
podgen.Episode(
|
||||
id=episode.id,
|
||||
title=episode.name,
|
||||
publication_date=episode.publish_date,
|
||||
publication_date=episode.publish_date.astimezone(tz=timezone.utc),
|
||||
media=podgen.Media(
|
||||
urllib.parse.urljoin(
|
||||
str(request.base_url), f"{podcast.id}/{episode.id}.m4a"
|
||||
|
@ -542,7 +543,9 @@ def get_podcast_feed(session: SessionDep, request: Request, podcast_id: str):
|
|||
if episode.duration is not None
|
||||
else None,
|
||||
),
|
||||
long_summary=episode.description,
|
||||
long_summary=markdown.markdown(episode.description)
|
||||
if episode.description is not None
|
||||
else None,
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ class PodcastEpisode(SQLModel, table=True):
|
|||
id: str = Field(primary_key=True, default_factory=lambda: nanoid.generate())
|
||||
name: str
|
||||
duration: Optional[float] = Field(default=None)
|
||||
description: Optional[float] = Field(default=None)
|
||||
description: Optional[str] = Field(default=None)
|
||||
file_hash: str
|
||||
file_size: int
|
||||
publish_date: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
|
||||
|
|
|
@ -10,7 +10,10 @@
|
|||
</label>
|
||||
<label>
|
||||
Description
|
||||
<textarea name="description">{% if episode.description %}{{ episode.description }}{% endif %}</textarea>
|
||||
<textarea name="description"
|
||||
aria-describedby="description-help">{% if episode.description %}{{ episode.description }}{% endif %}</textarea>
|
||||
<small id="description-help"><a href="https://www.markdownguide.org/cheat-sheet/">Markdown</a> is supported
|
||||
for any content in here.</small>
|
||||
</label>
|
||||
</fieldset>
|
||||
|
||||
|
|
11
uv.lock
11
uv.lock
|
@ -341,6 +341,15 @@ wheels = [
|
|||
{ url = "https://files.pythonhosted.org/packages/7d/db/214290d58ad68c587bd5d6af3d34e56830438733d0d0856c0275fde43652/lxml-5.3.0-cp313-cp313-win_amd64.whl", hash = "sha256:406246b96d552e0503e17a1006fd27edac678b3fcc9f1be71a2f94b4ff61528d", size = 3814417 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "markdown"
|
||||
version = "3.7"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/54/28/3af612670f82f4c056911fbbbb42760255801b3068c48de792d354ff4472/markdown-3.7.tar.gz", hash = "sha256:2ae2471477cfd02dbbf038d5d9bc226d40def84b4fe2986e49b59b6b472bbed2", size = 357086 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/3f/08/83871f3c50fc983b88547c196d11cf8c3340e37c32d2e9d6152abe2c61f7/Markdown-3.7-py3-none-any.whl", hash = "sha256:7eb6df5690b81a1d7942992c97fad2938e956e79df20cbc6186e9c3a77b1c803", size = 106349 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "markdown-it-py"
|
||||
version = "3.0.0"
|
||||
|
@ -435,6 +444,7 @@ dependencies = [
|
|||
{ name = "fastapi", extra = ["standard"] },
|
||||
{ name = "ffmpeg-normalize" },
|
||||
{ name = "ffmpeg-python" },
|
||||
{ name = "markdown" },
|
||||
{ name = "nanoid" },
|
||||
{ name = "pillow" },
|
||||
{ name = "podgen" },
|
||||
|
@ -451,6 +461,7 @@ requires-dist = [
|
|||
{ name = "fastapi", extras = ["standard"], specifier = ">=0.115.6" },
|
||||
{ name = "ffmpeg-normalize", specifier = ">=1.31.0" },
|
||||
{ name = "ffmpeg-python", specifier = ">=0.2.0" },
|
||||
{ name = "markdown", specifier = ">=3.7" },
|
||||
{ name = "nanoid", specifier = ">=2.0.0" },
|
||||
{ name = "pillow", specifier = ">=11.1.0" },
|
||||
{ name = "podgen", specifier = ">=1.1.0" },
|
||||
|
|
Loading…
Reference in a new issue