mp3 mime type

master
Bob Mottram 2019-08-30 19:44:26 +01:00
parent f7d2537085
commit f04ef819d7
3 changed files with 8 additions and 2 deletions

View File

@ -1836,7 +1836,7 @@ class PubServer(BaseHTTPRequestHandler):
elif extension=='ogv': elif extension=='ogv':
searchStr=b'Content-Type: video/ogv' searchStr=b'Content-Type: video/ogv'
elif extension=='mp3': elif extension=='mp3':
searchStr=b'Content-Type: audio/mp3' searchStr=b'Content-Type: audio/mpeg'
elif extension=='ogg': elif extension=='ogg':
searchStr=b'Content-Type: audio/ogg' searchStr=b'Content-Type: audio/ogg'
imageLocation=postBytes.find(searchStr) imageLocation=postBytes.find(searchStr)
@ -1844,6 +1844,8 @@ class PubServer(BaseHTTPRequestHandler):
if imageLocation>-1: if imageLocation>-1:
if extension=='jpeg': if extension=='jpeg':
extension='jpg' extension='jpg'
if extension=='mpeg':
extension='mp3'
filename=filenameBase+'.'+extension filename=filenameBase+'.'+extension
attachmentMediaType=searchStr.decode().split('/')[0].replace('Content-Type: ','') attachmentMediaType=searchStr.decode().split('/')[0].replace('Content-Type: ','')
break break

View File

@ -85,6 +85,8 @@ def attachMedia(baseDir: str,httpPrefix: str,domain: str,port: int, \
if imageFilename.endswith('.'+mType): if imageFilename.endswith('.'+mType):
if mType=='jpg': if mType=='jpg':
mType='jpeg' mType='jpeg'
if mType=='mp3':
mType='mpeg'
fileExtension=mType fileExtension=mType
if not fileExtension: if not fileExtension:
return postJson return postJson
@ -93,6 +95,8 @@ def attachMedia(baseDir: str,httpPrefix: str,domain: str,port: int, \
if fileExtension=='jpeg': if fileExtension=='jpeg':
fileExtension='jpg' fileExtension='jpg'
if fileExtension=='mpeg':
fileExtension='mp3'
if port: if port:
if port!=80 and port!=443: if port!=80 and port!=443:

View File

@ -1465,7 +1465,7 @@ def individualPostAsHtml(baseDir: str, \
'Your browser does not support the video tag.' \ 'Your browser does not support the video tag.' \
'</video></center>' '</video></center>'
attachmentCtr+=1 attachmentCtr+=1
elif mediaType=='audio/mp3' or \ elif mediaType=='audio/mpeg' or \
mediaType=='audio/ogg': mediaType=='audio/ogg':
extension='.mp3' extension='.mp3'
if attach['url'].endswith('.ogg'): if attach['url'].endswith('.ogg'):