diff --git a/content.py b/content.py index 2adf09956..08363ec1a 100644 --- a/content.py +++ b/content.py @@ -1105,6 +1105,7 @@ def save_media_in_form_post(media_bytes, debug: bool, 'ogv': 'video/ogv', 'mp3': 'audio/mpeg', 'ogg': 'audio/ogg', + 'opus': 'audio/opus', 'flac': 'audio/flac', 'zip': 'application/zip' } diff --git a/media.py b/media.py index e3e51813a..962192824 100644 --- a/media.py +++ b/media.py @@ -415,6 +415,7 @@ def path_is_audio(path: str) -> bool: """Is the given path an audio file? """ if path.endswith('.ogg') or \ + path.endswith('.opus') or \ path.endswith('.mp3'): return True return False diff --git a/metadata.py b/metadata.py index 6dbb88ff6..40c9fb088 100644 --- a/metadata.py +++ b/metadata.py @@ -193,6 +193,7 @@ def meta_data_instance(showAccounts: bool, 'video/mp4', 'video/ogv', 'audio/ogg', + 'audio/opus', 'audio/flac', 'audio/mpeg' ], diff --git a/outbox.py b/outbox.py index 4e751734d..03b7d74b6 100644 --- a/outbox.py +++ b/outbox.py @@ -313,6 +313,7 @@ def post_message_to_outbox(session, translate: {}, "avif": "avif", "audio/mpeg": "mp3", "ogg": "ogg", + "opus": "opus", "mp4": "mp4", "webm": "webm", "ogv": "ogv" diff --git a/utils.py b/utils.py index 3ef8dd340..fba926fb6 100644 --- a/utils.py +++ b/utils.py @@ -372,7 +372,7 @@ def get_video_extensions() -> []: def get_audio_extensions() -> []: """Returns a list of the possible audio file extensions """ - return ('mp3', 'ogg', 'flac') + return ('mp3', 'ogg', 'flac', 'opus') def get_image_extensions() -> []: @@ -2646,6 +2646,7 @@ def media_file_mime_type(filename: str) -> str: 'ico': 'image/x-icon', 'mp3': 'audio/mpeg', 'ogg': 'audio/ogg', + 'opus': 'audio/opus', 'flac': 'audio/flac', 'mp4': 'video/mp4', 'ogv': 'video/ogv' diff --git a/webapp_media.py b/webapp_media.py index 860db676b..082dc53c4 100644 --- a/webapp_media.py +++ b/webapp_media.py @@ -225,9 +225,9 @@ def _add_embedded_video_from_sites(translate: {}, content: str, def _add_embedded_audio(translate: {}, content: str) -> str: - """Adds embedded audio for mp3/ogg + """Adds embedded audio for mp3/ogg/opus """ - if not ('.mp3' in content or '.ogg' in content): + if not ('.mp3' in content or '.ogg' in content or '.opus' in content): return content if '