From 944c6f8cbce8f6be0bc5f2e82d32fdebf1bd2c00 Mon Sep 17 00:00:00 2001 From: Thomas More Date: Sun, 26 Feb 2023 15:17:10 -0500 Subject: [PATCH] [tools] [messages] Add simple CSV converter Closes: #100 --- tools/csv-convert.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 tools/csv-convert.py diff --git a/tools/csv-convert.py b/tools/csv-convert.py new file mode 100755 index 0000000..573a924 --- /dev/null +++ b/tools/csv-convert.py @@ -0,0 +1,26 @@ +#! /usr/bin/python3 + +# SMS Import / Export: a simple Android app for importing and exporting SMS messages from and to JSON files. +# Copyright (c) 2023 Thomas More +# +# This file is part of SMS Import / Export. +# +# SMS Import / Export is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# SMS Import / Export is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with SMS Import / Export. If not, see . + +# Written for https://github.com/tmo1/sms-ie/issues/100 + +import csv +import json + +print(json.dumps(list(csv.DictReader(open(0, newline=''))), indent=2))