add scripts for managing sms on pinephone
This commit is contained in:
parent
650dba86b9
commit
5dd15d255b
8
sms/clear_sms
Normal file
8
sms/clear_sms
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
from sms import get_sms
|
||||||
|
from subprocess import call
|
||||||
|
from os.path import basename
|
||||||
|
|
||||||
|
for sms in get_sms():
|
||||||
|
print(sms)
|
||||||
|
call(["mmcli", "-m", "any", "--messaging-delete-sms", sms[0]])
|
10
sms/dump_sms
Normal file
10
sms/dump_sms
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
from sms import get_sms
|
||||||
|
from subprocess import call
|
||||||
|
from os.path import basename
|
||||||
|
|
||||||
|
for sms in get_sms():
|
||||||
|
print(sms)
|
||||||
|
out_file = "{}.{}.sms".format(basename(sms[0]), sms[1])
|
||||||
|
print(">> dump to {}".format(out_file))
|
||||||
|
call(["mmcli", "-m", "any", "--create-file-with-data", out_file, "--sms", sms[0]])
|
4
sms/list_sms
Normal file
4
sms/list_sms
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
from sms import get_sms
|
||||||
|
for sms in get_sms():
|
||||||
|
print(sms)
|
11
sms/sms.py
Normal file
11
sms/sms.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
from subprocess import call, check_output
|
||||||
|
from os.path import basename
|
||||||
|
|
||||||
|
def parse_list_item(item):
|
||||||
|
item = item.strip().split(" ", 2)
|
||||||
|
item[1] = item[1][1:-1]
|
||||||
|
return tuple(item)
|
||||||
|
|
||||||
|
def get_sms():
|
||||||
|
return [parse_list_item(sms) for sms in check_output(["mmcli", "-m", "any", "--messaging-list-sms"]).decode().strip().split("\n")]
|
Loading…
x
Reference in New Issue
Block a user