From f4eb5afb46df2d1a6be6505945e89028d18a6fa7 Mon Sep 17 00:00:00 2001 From: Ruben van de Ven Date: Mon, 6 May 2019 08:13:13 +0200 Subject: [PATCH] Fix deletion of files in panopticon --- README.md | 11 ++++++++++- hugvey/panopticon.py | 7 ++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 947f964..9c5154c 100644 --- a/README.md +++ b/README.md @@ -195,4 +195,13 @@ Types of conditions: TODO -times occured/only on n-th instance: determines the order of diversions of the same type (for Timeout and no_response). Starting at 1, as a diversion with value of 0 can occur always \ No newline at end of file +times occured/only on n-th instance: determines the order of diversions of the same type (for Timeout and no_response). Starting at 1, as a diversion with value of 0 can occur always + + + +# Network + +## 4G Modem + +Visit 192.168.5.1 +The password is at the bottom of the device. \ No newline at end of file diff --git a/hugvey/panopticon.py b/hugvey/panopticon.py index b4bb489..9eed054 100644 --- a/hugvey/panopticon.py +++ b/hugvey/panopticon.py @@ -152,7 +152,7 @@ def getUploadHandler(central_command): self.finish() def post(self): - print('upload') + logger.info('upload') langCode = self.get_argument("language") langFile = os.path.join(central_command.config['web']['files_dir'] , central_command.languageFiles[langCode]) @@ -171,7 +171,7 @@ def getUploadHandler(central_command): for i, data in enumerate(storyData): if data['@id'] != msgId: continue - if 'audio' in storyData[i] and os.path.exists(storyData[i]['audio']['file']): + if 'audio' in storyData[i] and storyData[i]['audio'] is not None and os.path.exists(storyData[i]['audio']['file']): logger.info(f"Remove previous file {storyData[i]['audio']['file']} ({storyData[i]['audio']['original_name']})") os.unlink(storyData[i]['audio']['file']) @@ -184,7 +184,8 @@ def getUploadHandler(central_command): fp.write(audioFile['body']) break - print(os.path.abspath(langFile)) +# logger.info(os.path.abspath(langFile)) + langFile = os.path.abspath(langFile) with open(langFile, 'w') as json_fp: logger.info(f'Save story to {langFile} {json_fp}') json.dump(storyData, json_fp, indent=2)