Use argument for mime type if available
This commit is contained in:
parent
ad306ad0e9
commit
757eb3c650
|
@ -10,6 +10,9 @@ s = socket.socket(socket.AF_UNIX)
|
|||
s.connect(os.path.join(os.environ["HOME"], ".mailcap.sock"))
|
||||
|
||||
filename = sys.argv[1]
|
||||
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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user