Browse Source

update: json format dumps

master
Dnomd343 2 years ago
parent
commit
52a33c9848
  1. 21
      src/release/json_dumps.py
  2. 4
      src/release/release_txt.py
  3. 20
      src/release/to_json.py

21
src/release/json_dumps.py

@ -0,0 +1,21 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import json
from common import loadData
from common import saveFile
jsonFile = 'xxrs.json'
def jsonRelease(metadata: dict, content: dict) -> str:
return json.dumps({
'metadata': metadata,
'content': content,
}, separators = (',', ':'))
if __name__ == '__main__':
data = loadData(sys.argv[1])
saveFile(jsonFile, jsonRelease(data['metadata'], data['content']))

4
src/release/to_txt.py → src/release/release_txt.py

@ -25,6 +25,4 @@ def txtRelease(metadata: dict, content: dict) -> str:
if __name__ == '__main__': if __name__ == '__main__':
data = loadData(sys.argv[1]) data = loadData(sys.argv[1])
saveFile( saveFile(txtFile, txtRelease(data['metadata'], data['content']))
txtFile, txtRelease(data['metadata'], data['content'])
)

20
src/release/to_json.py

@ -1,20 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import json
from common import loadData
def jsonRelease(metadata: dict, content: dict) -> str:
return json.dumps(
{
'metadata': metadata,
'content': content,
}, separators = (',', ':')
)
if __name__ == '__main__':
data = loadData(sys.argv[1])
print(jsonRelease(data['metadata'], data['content']))
Loading…
Cancel
Save