Add audio files and audio embeds

This commit is contained in:
sarah committed 2026-10-14 19:40:33 +02:00
1 parent d86e33fd4a
commit 2d5ab15f52
10 files changed
+73 -7

No files matched your search

+14
View File
@@ -19,6 +19,7 @@ DescriptionExcerptLength = 200
DefaultDescriptions = {
"directory": "A directory on SaraView.",
"video": "A video on SaraView.",
"audio": "Audio on SaraView.",
"image": "An image on SaraView.",
"note": "A note on SaraView.",
"file": "A file on SaraView.",
@@ -89,6 +90,19 @@ def BuildOgTags(RootName: str, RelativePath: str, IsDirectoryUrl: bool, BaseUrl:
Tags.append(_MetaTag("og:video:secure_url", MediaUrl))
Tags.append(_MetaTag("og:video:type", GetMimeType(EntryPath)))
Tags.append(_MetaTag("og:description", DefaultDescriptions["video"]))
elif FileType == "audio":
# og:audio is the standard tag, but Discord doesn't play it. Discord
# does play og:video in an HTML5 player, which handles audio-only
# files too, so the audio is offered as both.
Tags.append(_MetaTag("og:type", "video.other"))
Tags.append(_MetaTag("og:audio", MediaUrl))
Tags.append(_MetaTag("og:audio:secure_url", MediaUrl))
Tags.append(_MetaTag("og:audio:type", GetMimeType(EntryPath)))
Tags.append(_MetaTag("og:video", MediaUrl))
Tags.append(_MetaTag("og:video:url", MediaUrl))
Tags.append(_MetaTag("og:video:secure_url", MediaUrl))
Tags.append(_MetaTag("og:video:type", GetMimeType(EntryPath)))
Tags.append(_MetaTag("og:description", DefaultDescriptions["audio"]))
elif FileType == "image":
Tags.append(_MetaTag("og:type", "website"))
Tags.append(_MetaTag("og:image", MediaUrl))