Files
termux-websms/update.py
Sasha MOREL 87ffd22d35 Code splitting for specific usages
Also add a script to update a file containing SMSdb.
2021-12-14 18:35:02 +01:00

19 lines
490 B
Python

#!/data/data/com.termux/files/usr/bin/python3
from json import loads as json_read, dumps as json_write
from sys import argv
from os.path import isfile
from sms import SMS_Service
output = argv [1]
if isfile (output):
database = json_read (open (output).read ())
s = SMS_Service (sms_list = database)
s.update_database ()
open (output, 'w').write (json_write (s.sorted_list ()))
else:
s = SMS_Service ()
s.build_database ()
open (output, 'w').write (json_write (s.sorted_list ()))