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

+2 -1
View File
@@ -18,7 +18,8 @@ from Viewer import FileView
DoubleClickWindow = 0.4 # seconds
TypeLabels = {"markdown": "Markdown", "text": "Text", "config": "Config", "html": "HTML", "image": "Image", "video": "Video"}
TypeLabels = {"markdown": "Markdown", "text": "Text", "config": "Config", "html": "HTML", "image": "Image", "video": "Video",
"audio": "Audio"}
class Browser(ft.Column):
+1
View File
@@ -85,6 +85,7 @@ FileIcons = {
"html": ft.Icons.CODE,
"image": ft.Icons.IMAGE_OUTLINED,
"video": ft.Icons.MOVIE_OUTLINED,
"audio": ft.Icons.MUSIC_NOTE_OUTLINED,
}
_ThemeRoleMap = {
+1
View File
@@ -27,6 +27,7 @@ FileTypeMap = {
".html": "html", ".htm": "html",
".png": "image", ".jpg": "image", ".jpeg": "image", ".gif": "image", ".webp": "image", ".svg": "image",
".mp4": "video", ".webm": "video", ".mov": "video", ".mkv": "video",
".flac": "audio", ".ogg": "audio", ".mp3": "audio", ".wav": "audio",
}
TextFileTypes = {"markdown", "text", "config", "html"}
+4 -3
View File
@@ -193,9 +193,10 @@ class FileView(ft.Container):
return ft.Column(Views or [View], scroll=ft.ScrollMode.AUTO, expand=True)
def _InfoView(self) -> ft.Control:
Icon = ft.Icons.MOVIE_OUTLINED if self.FileType == "video" else ft.Icons.INSERT_DRIVE_FILE_OUTLINED
Note = ("Videos play in your system's video player: use Open Externally."
if self.FileType == "video" else "SaraView can't show this type of file. Use Open Externally.")
Icon, Note = {
"video": (ft.Icons.MOVIE_OUTLINED, "Videos play in your system's video player: use Open Externally."),
"audio": (ft.Icons.MUSIC_NOTE_OUTLINED, "Audio plays in your system's music player: use Open Externally."),
}.get(self.FileType, (ft.Icons.INSERT_DRIVE_FILE_OUTLINED, "SaraView can't show this type of file. Use Open Externally."))
return ft.Column(
[
ft.Icon(Icon, size=64, color=Palette.Mauve),