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':
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

View File

@ -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:

View File

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