From 757eb3c650fd98510f22fde86f206932ee175e75 Mon Sep 17 00:00:00 2001 From: Valentin Ochs Date: Fri, 10 May 2019 23:44:04 +0200 Subject: [PATCH] Use argument for mime type if available --- mailcap-client.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mailcap-client.py b/mailcap-client.py index 3d6af95..68be397 100644 --- a/mailcap-client.py +++ b/mailcap-client.py @@ -10,7 +10,10 @@ s = socket.socket(socket.AF_UNIX) s.connect(os.path.join(os.environ["HOME"], ".mailcap.sock")) filename = sys.argv[1] -mime = subprocess.run(["file", "-i", "-b", filename], check=True, stdout=subprocess.PIPE).stdout.decode('utf-8') +if len(sys.argv) > 2: + mime = sys.argv[2] +else: + mime = subprocess.run(["file", "-i", "-b", filename], check=True, stdout=subprocess.PIPE).stdout.decode('utf-8') data = open(filename, "rb").read() def strtr(x, c="B"):