aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2022-11-06 14:35:28 +0100
committerThomas Lange <code@nerdmind.de>2022-11-06 14:35:28 +0100
commitf8b04aaf563fe1a7617714d7f5e56df14fee870f (patch)
treeddc8e9d3c664550d799602af26eea409b0d93d5a /package
parent053ecd3296df4b297a5c3bb7a00e5f3eb58ff7d7 (diff)
downloadandroid-sms-extractor-f8b04aaf563fe1a7617714d7f5e56df14fee870f.tar.gz
android-sms-extractor-f8b04aaf563fe1a7617714d7f5e56df14fee870f.tar.xz
android-sms-extractor-f8b04aaf563fe1a7617714d7f5e56df14fee870f.zip
Add "--datetime-format" option
Diffstat (limited to 'package')
-rwxr-xr-xpackage/bin/android-sms-extractor14
1 files changed, 6 insertions, 8 deletions
diff --git a/package/bin/android-sms-extractor b/package/bin/android-sms-extractor
index 601ff8c..f8872ed 100755
--- a/package/bin/android-sms-extractor
+++ b/package/bin/android-sms-extractor
@@ -32,22 +32,20 @@ parser = ArgumentParser(prog="android-sms-extractor",
description="Android SMS Extractor")
#===============================================================================
-# Define positional arguments
+# Define arguments
#===============================================================================
parser.add_argument('db_file', action='store',
help="Path to the SQLite database file")
+parser.add_argument('--datetime-format', action='store', dest='dt_format',
+ help="Set datetime (strftime) format for text output (default: %(default)s)",
+ default="%Y-%m-%d %H:%M:%S")
+
#===============================================================================
# Parse arguments
#===============================================================================
args = parser.parse_args()
-# Default
-date_format_string = "%Y-%m-%d %H:%M:%S"
-
-# German version
-# date_format_string = "am %d.%m.%Y um %H:%M:%S"
-
if not os.path.isfile(args.db_file):
exit("Could not open file »{}«".format(args.db_file))
@@ -80,7 +78,7 @@ for conversation in c.fetchall():
# Remove the last 3 digits (milliseconds) from timestamp
msg_time = int(str(msg_time)[:-3])
- msg_time_formatted = datetime.fromtimestamp(msg_time).strftime(date_format_string)
+ msg_time_formatted = datetime.fromtimestamp(msg_time).strftime(args.dt_format)
sim_slot_id = result[3]