mirror of https://gitlab.com/bashrc2/epicyon
Support wave file attachments
parent
9e5da85553
commit
ac89c7e20d
10
content.py
10
content.py
|
@ -1441,6 +1441,10 @@ def save_media_in_form_post(media_bytes, debug: bool,
|
|||
'ogv': 'video/ogv',
|
||||
'mp3': 'audio/mpeg',
|
||||
'ogg': 'audio/ogg',
|
||||
'wav': 'audio/vnd.wave',
|
||||
'wav2': 'audio/wav',
|
||||
'wav3': 'audio/x-wav',
|
||||
'wav4': 'audio/x-pn-wave',
|
||||
'opus': 'audio/opus',
|
||||
'spx': 'audio/speex',
|
||||
'flac': 'audio/flac',
|
||||
|
@ -1460,6 +1464,12 @@ def save_media_in_form_post(media_bytes, debug: bool,
|
|||
extension = 'mp3'
|
||||
elif extension == 'csv2':
|
||||
extension = 'csv'
|
||||
elif extension == 'wav2':
|
||||
extension = 'wav'
|
||||
elif extension == 'wav3':
|
||||
extension = 'wav'
|
||||
elif extension == 'wav4':
|
||||
extension = 'wav'
|
||||
if filename_base:
|
||||
filename = filename_base + '.' + extension
|
||||
search_lst = search_str.decode().split('/', maxsplit=1)
|
||||
|
|
|
@ -1222,7 +1222,7 @@ def _command_options() -> None:
|
|||
|
||||
# comma separated list of preferred audio formats. eg. "opus", "mp3", "spx"
|
||||
# in order of preference
|
||||
preferred_podcast_formats = ['ogg', 'mpeg', 'opus', 'spx']
|
||||
preferred_podcast_formats = ['ogg', 'mpeg', 'opus', 'spx', 'wav']
|
||||
if argb.podcast_formats:
|
||||
podcast_formats_str = argb.podcast_formats
|
||||
else:
|
||||
|
|
1
media.py
1
media.py
|
@ -670,6 +670,7 @@ def path_is_audio(path: str) -> bool:
|
|||
path.endswith('.opus') or \
|
||||
path.endswith('.spx') or \
|
||||
path.endswith('.flac') or \
|
||||
path.endswith('.wav') or \
|
||||
path.endswith('.mp3'):
|
||||
return True
|
||||
return False
|
||||
|
|
|
@ -193,6 +193,10 @@ def meta_data_instance(show_accounts: bool,
|
|||
'video/mp4',
|
||||
'video/ogv',
|
||||
'audio/ogg',
|
||||
'audio/wav',
|
||||
'audio/x-wav',
|
||||
'audio/x-pn-wave',
|
||||
'audio/vnd.wave',
|
||||
'audio/opus',
|
||||
'audio/speex',
|
||||
'audio/x-speex',
|
||||
|
|
|
@ -353,6 +353,10 @@ def post_message_to_outbox(session, translate: {},
|
|||
"avif": "avif",
|
||||
"audio/mpeg": "mp3",
|
||||
"ogg": "ogg",
|
||||
"audio/wav": "wav",
|
||||
"audio/x-wav": "wav",
|
||||
"audio/x-pn-wave": "wav",
|
||||
"audio/vnd.wave": "wav",
|
||||
"flac": "flac",
|
||||
"opus": "opus",
|
||||
"audio/speex": "spx",
|
||||
|
|
6
utils.py
6
utils.py
|
@ -490,7 +490,7 @@ def get_video_extensions() -> []:
|
|||
def get_audio_extensions() -> []:
|
||||
"""Returns a list of the possible audio file extensions
|
||||
"""
|
||||
return ('mp3', 'ogg', 'flac', 'opus', 'spx')
|
||||
return ('mp3', 'ogg', 'flac', 'opus', 'spx', 'wav')
|
||||
|
||||
|
||||
def get_image_extensions() -> []:
|
||||
|
@ -2897,6 +2897,10 @@ def media_file_mime_type(filename: str) -> str:
|
|||
'ico': 'image/x-icon',
|
||||
'mp3': 'audio/mpeg',
|
||||
'ogg': 'audio/ogg',
|
||||
'audio/wav': 'wav',
|
||||
'audio/x-wav': 'wav',
|
||||
'audio/x-pn-wave': 'wav',
|
||||
'wav': 'audio/vnd.wave',
|
||||
'opus': 'audio/opus',
|
||||
'spx': 'audio/speex',
|
||||
'flac': 'audio/flac',
|
||||
|
|
|
@ -275,10 +275,11 @@ def _add_embedded_video_from_sites(translate: {}, content: str,
|
|||
|
||||
|
||||
def _add_embedded_audio(translate: {}, content: str) -> str:
|
||||
"""Adds embedded audio for mp3/ogg/opus
|
||||
"""Adds embedded audio for mp3/ogg/opus/wav
|
||||
"""
|
||||
if not ('.mp3' in content or
|
||||
'.ogg' in content or
|
||||
'.wav' in content or
|
||||
'.opus' in content or
|
||||
'.spx' in content or
|
||||
'.flac' in content):
|
||||
|
@ -290,6 +291,8 @@ def _add_embedded_audio(translate: {}, content: str) -> str:
|
|||
extension = '.mp3'
|
||||
if '.ogg' in content:
|
||||
extension = '.ogg'
|
||||
elif '.wav' in content:
|
||||
extension = '.wav'
|
||||
elif '.opus' in content:
|
||||
extension = '.opus'
|
||||
elif '.spx' in content:
|
||||
|
|
|
@ -358,6 +358,8 @@ def html_podcast_episode(translate: {},
|
|||
audio_extension = 'spx'
|
||||
elif '.flac' in link_url:
|
||||
audio_extension = 'flac'
|
||||
elif '.wav' in link_url:
|
||||
audio_extension = 'wav'
|
||||
else:
|
||||
audio_extension = 'ogg'
|
||||
else:
|
||||
|
|
|
@ -1372,6 +1372,8 @@ def get_post_attachments_as_html(base_dir: str,
|
|||
extension = '.mp3'
|
||||
if attach['url'].endswith('.ogg'):
|
||||
extension = '.ogg'
|
||||
elif attach['url'].endswith('.wav'):
|
||||
extension = '.wav'
|
||||
elif attach['url'].endswith('.opus'):
|
||||
extension = '.opus'
|
||||
elif attach['url'].endswith('.spx'):
|
||||
|
|
Loading…
Reference in New Issue