Fix deletion of files in panopticon
This commit is contained in:
parent
0861215794
commit
f4eb5afb46
2 changed files with 14 additions and 4 deletions
|
@ -196,3 +196,12 @@ 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
|
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.
|
|
@ -152,7 +152,7 @@ def getUploadHandler(central_command):
|
||||||
self.finish()
|
self.finish()
|
||||||
|
|
||||||
def post(self):
|
def post(self):
|
||||||
print('upload')
|
logger.info('upload')
|
||||||
langCode = self.get_argument("language")
|
langCode = self.get_argument("language")
|
||||||
langFile = os.path.join(central_command.config['web']['files_dir'] , central_command.languageFiles[langCode])
|
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):
|
for i, data in enumerate(storyData):
|
||||||
if data['@id'] != msgId:
|
if data['@id'] != msgId:
|
||||||
continue
|
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']})")
|
logger.info(f"Remove previous file {storyData[i]['audio']['file']} ({storyData[i]['audio']['original_name']})")
|
||||||
os.unlink(storyData[i]['audio']['file'])
|
os.unlink(storyData[i]['audio']['file'])
|
||||||
|
|
||||||
|
@ -184,7 +184,8 @@ def getUploadHandler(central_command):
|
||||||
fp.write(audioFile['body'])
|
fp.write(audioFile['body'])
|
||||||
break
|
break
|
||||||
|
|
||||||
print(os.path.abspath(langFile))
|
# logger.info(os.path.abspath(langFile))
|
||||||
|
langFile = os.path.abspath(langFile)
|
||||||
with open(langFile, 'w') as json_fp:
|
with open(langFile, 'w') as json_fp:
|
||||||
logger.info(f'Save story to {langFile} {json_fp}')
|
logger.info(f'Save story to {langFile} {json_fp}')
|
||||||
json.dump(storyData, json_fp, indent=2)
|
json.dump(storyData, json_fp, indent=2)
|
||||||
|
|
Loading…
Reference in a new issue