From b091349c9b8a047cacdaa5632c244393fd9626f7 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 30 Aug 2019 20:01:16 +0100 Subject: [PATCH] Copy file if not image --- media.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/media.py b/media.py index ecc1aefe8..04a1736d7 100644 --- a/media.py +++ b/media.py @@ -95,7 +95,7 @@ def attachMedia(baseDir: str,httpPrefix: str,domain: str,port: int, \ if fileExtension=='jpeg': fileExtension='jpg' - if fileExtension=='mpeg': + if mediaType=='audio' and fileExtension=='mpeg': fileExtension='mp3' if port: @@ -119,9 +119,11 @@ def attachMedia(baseDir: str,httpPrefix: str,domain: str,port: int, \ attachmentJson['blurhash']=getImageHash(imageFilename) postJson['attachment']=[attachmentJson] - if baseDir and mediaType=='image': - removeMetaData(imageFilename,mediaFilename) - #copyfile(imageFilename,mediaFilename) + if baseDir: + if mediaType=='image': + removeMetaData(imageFilename,mediaFilename) + else: + copyfile(imageFilename,mediaFilename) return postJson