From f04ef819d72c735dbd8b274c8ac67e4c444cb253 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 30 Aug 2019 19:44:26 +0100 Subject: [PATCH] mp3 mime type --- daemon.py | 4 +++- media.py | 4 ++++ webinterface.py | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/daemon.py b/daemon.py index f79bb5bd7..47f44920f 100644 --- a/daemon.py +++ b/daemon.py @@ -1836,7 +1836,7 @@ class PubServer(BaseHTTPRequestHandler): elif extension=='ogv': searchStr=b'Content-Type: video/ogv' elif extension=='mp3': - searchStr=b'Content-Type: audio/mp3' + searchStr=b'Content-Type: audio/mpeg' elif extension=='ogg': searchStr=b'Content-Type: audio/ogg' imageLocation=postBytes.find(searchStr) @@ -1844,6 +1844,8 @@ class PubServer(BaseHTTPRequestHandler): if imageLocation>-1: if extension=='jpeg': extension='jpg' + if extension=='mpeg': + extension='mp3' filename=filenameBase+'.'+extension attachmentMediaType=searchStr.decode().split('/')[0].replace('Content-Type: ','') break diff --git a/media.py b/media.py index ff31f3a9d..61441bee4 100644 --- a/media.py +++ b/media.py @@ -85,6 +85,8 @@ def attachMedia(baseDir: str,httpPrefix: str,domain: str,port: int, \ if imageFilename.endswith('.'+mType): if mType=='jpg': mType='jpeg' + if mType=='mp3': + mType='mpeg' fileExtension=mType if not fileExtension: return postJson @@ -93,6 +95,8 @@ def attachMedia(baseDir: str,httpPrefix: str,domain: str,port: int, \ if fileExtension=='jpeg': fileExtension='jpg' + if fileExtension=='mpeg': + fileExtension='mp3' if port: if port!=80 and port!=443: diff --git a/webinterface.py b/webinterface.py index cd1d05498..2a5249070 100644 --- a/webinterface.py +++ b/webinterface.py @@ -1465,7 +1465,7 @@ def individualPostAsHtml(baseDir: str, \ 'Your browser does not support the video tag.' \ '' attachmentCtr+=1 - elif mediaType=='audio/mp3' or \ + elif mediaType=='audio/mpeg' or \ mediaType=='audio/ogg': extension='.mp3' if attach['url'].endswith('.ogg'):