mirror of https://gitlab.com/bashrc2/epicyon
Support opus audio format
parent
b494eb06b4
commit
8094ca0849
|
@ -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'
|
||||
}
|
||||
|
|
1
media.py
1
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
|
||||
|
|
|
@ -193,6 +193,7 @@ def meta_data_instance(showAccounts: bool,
|
|||
'video/mp4',
|
||||
'video/ogv',
|
||||
'audio/ogg',
|
||||
'audio/opus',
|
||||
'audio/flac',
|
||||
'audio/mpeg'
|
||||
],
|
||||
|
|
|
@ -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"
|
||||
|
|
3
utils.py
3
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'
|
||||
|
|
|
@ -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 '<audio ' in content:
|
||||
|
@ -236,6 +236,8 @@ def _add_embedded_audio(translate: {}, content: str) -> str:
|
|||
extension = '.mp3'
|
||||
if '.ogg' in content:
|
||||
extension = '.ogg'
|
||||
elif '.opus' in content:
|
||||
extension = '.opus'
|
||||
|
||||
words = content.strip('\n').split(' ')
|
||||
for wrd in words:
|
||||
|
|
|
@ -209,6 +209,8 @@ def html_podcast_episode(css_cache: {}, translate: {},
|
|||
if path_is_audio(link_url):
|
||||
if '.mp3' in link_url:
|
||||
audio_extension = 'mpeg'
|
||||
elif '.opus' in link_url:
|
||||
audio_extension = 'opus'
|
||||
else:
|
||||
audio_extension = 'ogg'
|
||||
else:
|
||||
|
|
|
@ -1217,6 +1217,8 @@ def get_post_attachments_as_html(post_json_object: {}, box_name: str,
|
|||
extension = '.mp3'
|
||||
if attach['url'].endswith('.ogg'):
|
||||
extension = '.ogg'
|
||||
elif attach['url'].endswith('.opus'):
|
||||
extension = '.opus'
|
||||
if attach['url'].endswith(extension):
|
||||
if attachment_ctr > 0:
|
||||
attachment_str += '<br>'
|
||||
|
|
Loading…
Reference in New Issue