Copy file if not image

master
Bob Mottram 2019-08-30 20:01:16 +01:00
parent f5097eafbd
commit b091349c9b
1 changed files with 6 additions and 4 deletions

View File

@ -95,7 +95,7 @@ def attachMedia(baseDir: str,httpPrefix: str,domain: str,port: int, \
if fileExtension=='jpeg': if fileExtension=='jpeg':
fileExtension='jpg' fileExtension='jpg'
if fileExtension=='mpeg': if mediaType=='audio' and fileExtension=='mpeg':
fileExtension='mp3' fileExtension='mp3'
if port: if port:
@ -119,9 +119,11 @@ def attachMedia(baseDir: str,httpPrefix: str,domain: str,port: int, \
attachmentJson['blurhash']=getImageHash(imageFilename) attachmentJson['blurhash']=getImageHash(imageFilename)
postJson['attachment']=[attachmentJson] postJson['attachment']=[attachmentJson]
if baseDir and mediaType=='image': if baseDir:
removeMetaData(imageFilename,mediaFilename) if mediaType=='image':
#copyfile(imageFilename,mediaFilename) removeMetaData(imageFilename,mediaFilename)
else:
copyfile(imageFilename,mediaFilename)
return postJson return postJson