Merge branch 'main' of gitlab.com:bashrc2/epicyon

main
Bob Mottram 2022-10-31 11:13:19 +00:00
commit aa447ddf9f
12 changed files with 35 additions and 5 deletions

View File

@ -1441,6 +1441,10 @@ def save_media_in_form_post(media_bytes, debug: bool,
'ogv': 'video/ogv', 'ogv': 'video/ogv',
'mp3': 'audio/mpeg', 'mp3': 'audio/mpeg',
'ogg': 'audio/ogg', 'ogg': 'audio/ogg',
'wav': 'audio/vnd.wave',
'wav2': 'audio/wav',
'wav3': 'audio/x-wav',
'wav4': 'audio/x-pn-wave',
'opus': 'audio/opus', 'opus': 'audio/opus',
'spx': 'audio/speex', 'spx': 'audio/speex',
'flac': 'audio/flac', 'flac': 'audio/flac',
@ -1460,6 +1464,12 @@ def save_media_in_form_post(media_bytes, debug: bool,
extension = 'mp3' extension = 'mp3'
elif extension == 'csv2': elif extension == 'csv2':
extension = 'csv' extension = 'csv'
elif extension == 'wav2':
extension = 'wav'
elif extension == 'wav3':
extension = 'wav'
elif extension == 'wav4':
extension = 'wav'
if filename_base: if filename_base:
filename = filename_base + '.' + extension filename = filename_base + '.' + extension
search_lst = search_str.decode().split('/', maxsplit=1) search_lst = search_str.decode().split('/', maxsplit=1)

View File

@ -1222,7 +1222,7 @@ def _command_options() -> None:
# comma separated list of preferred audio formats. eg. "opus", "mp3", "spx" # comma separated list of preferred audio formats. eg. "opus", "mp3", "spx"
# in order of preference # in order of preference
preferred_podcast_formats = ['ogg', 'mpeg', 'opus', 'spx'] preferred_podcast_formats = ['ogg', 'mpeg', 'opus', 'spx', 'wav']
if argb.podcast_formats: if argb.podcast_formats:
podcast_formats_str = argb.podcast_formats podcast_formats_str = argb.podcast_formats
else: else:

Binary file not shown.

View File

@ -503,7 +503,7 @@ the administrator.</p>
<p>Attachments can use a variety of formats.</p> <p>Attachments can use a variety of formats.</p>
<ul> <ul>
<li>Images: <em>jpg, jpeg, gif, webp, avif, svg, ico, jxl, png</em></li> <li>Images: <em>jpg, jpeg, gif, webp, avif, svg, ico, jxl, png</em></li>
<li>Audio: <em>mp3, ogg, flac, opus, speex</em></li> <li>Audio: <em>mp3, ogg, flac, opus, speex, wav</em></li>
<li>Video: <em>mp4, webm, ogv</em></li> <li>Video: <em>mp4, webm, ogv</em></li>
</ul> </ul>
<figure> <figure>

View File

@ -391,7 +391,7 @@ A *wanted item* is a physical object or service which you want. These posts will
Attachments can use a variety of formats. Attachments can use a variety of formats.
* Images: *jpg, jpeg, gif, webp, avif, svg, ico, jxl, png* * Images: *jpg, jpeg, gif, webp, avif, svg, ico, jxl, png*
* Audio: *mp3, ogg, flac, opus, speex* * Audio: *mp3, ogg, flac, opus, speex, wav*
* Video: *mp4, webm, ogv* * Video: *mp4, webm, ogv*
![New post attachments](manual-attachments.png) ![New post attachments](manual-attachments.png)

View File

@ -670,6 +670,7 @@ def path_is_audio(path: str) -> bool:
path.endswith('.opus') or \ path.endswith('.opus') or \
path.endswith('.spx') or \ path.endswith('.spx') or \
path.endswith('.flac') or \ path.endswith('.flac') or \
path.endswith('.wav') or \
path.endswith('.mp3'): path.endswith('.mp3'):
return True return True
return False return False

View File

@ -193,6 +193,10 @@ def meta_data_instance(show_accounts: bool,
'video/mp4', 'video/mp4',
'video/ogv', 'video/ogv',
'audio/ogg', 'audio/ogg',
'audio/wav',
'audio/x-wav',
'audio/x-pn-wave',
'audio/vnd.wave',
'audio/opus', 'audio/opus',
'audio/speex', 'audio/speex',
'audio/x-speex', 'audio/x-speex',

View File

@ -353,6 +353,10 @@ def post_message_to_outbox(session, translate: {},
"avif": "avif", "avif": "avif",
"audio/mpeg": "mp3", "audio/mpeg": "mp3",
"ogg": "ogg", "ogg": "ogg",
"audio/wav": "wav",
"audio/x-wav": "wav",
"audio/x-pn-wave": "wav",
"audio/vnd.wave": "wav",
"flac": "flac", "flac": "flac",
"opus": "opus", "opus": "opus",
"audio/speex": "spx", "audio/speex": "spx",

View File

@ -490,7 +490,7 @@ def get_video_extensions() -> []:
def get_audio_extensions() -> []: def get_audio_extensions() -> []:
"""Returns a list of the possible audio file 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() -> []: def get_image_extensions() -> []:
@ -2897,6 +2897,10 @@ def media_file_mime_type(filename: str) -> str:
'ico': 'image/x-icon', 'ico': 'image/x-icon',
'mp3': 'audio/mpeg', 'mp3': 'audio/mpeg',
'ogg': 'audio/ogg', 'ogg': 'audio/ogg',
'audio/wav': 'wav',
'audio/x-wav': 'wav',
'audio/x-pn-wave': 'wav',
'wav': 'audio/vnd.wave',
'opus': 'audio/opus', 'opus': 'audio/opus',
'spx': 'audio/speex', 'spx': 'audio/speex',
'flac': 'audio/flac', 'flac': 'audio/flac',

View File

@ -275,10 +275,11 @@ def _add_embedded_video_from_sites(translate: {}, content: str,
def _add_embedded_audio(translate: {}, content: str) -> 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 if not ('.mp3' in content or
'.ogg' in content or '.ogg' in content or
'.wav' in content or
'.opus' in content or '.opus' in content or
'.spx' in content or '.spx' in content or
'.flac' in content): '.flac' in content):
@ -290,6 +291,8 @@ def _add_embedded_audio(translate: {}, content: str) -> str:
extension = '.mp3' extension = '.mp3'
if '.ogg' in content: if '.ogg' in content:
extension = '.ogg' extension = '.ogg'
elif '.wav' in content:
extension = '.wav'
elif '.opus' in content: elif '.opus' in content:
extension = '.opus' extension = '.opus'
elif '.spx' in content: elif '.spx' in content:

View File

@ -358,6 +358,8 @@ def html_podcast_episode(translate: {},
audio_extension = 'spx' audio_extension = 'spx'
elif '.flac' in link_url: elif '.flac' in link_url:
audio_extension = 'flac' audio_extension = 'flac'
elif '.wav' in link_url:
audio_extension = 'wav'
else: else:
audio_extension = 'ogg' audio_extension = 'ogg'
else: else:

View File

@ -1372,6 +1372,8 @@ def get_post_attachments_as_html(base_dir: str,
extension = '.mp3' extension = '.mp3'
if attach['url'].endswith('.ogg'): if attach['url'].endswith('.ogg'):
extension = '.ogg' extension = '.ogg'
elif attach['url'].endswith('.wav'):
extension = '.wav'
elif attach['url'].endswith('.opus'): elif attach['url'].endswith('.opus'):
extension = '.opus' extension = '.opus'
elif attach['url'].endswith('.spx'): elif attach['url'].endswith('.spx'):