diff options
author | hut <hut@lavabit.com> | 2009-12-03 20:05:48 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2009-12-03 20:05:48 +0100 |
commit | 4cb54d3819d8a58d0bd07b8da0c4a978807c44ec (patch) | |
tree | 89b6dcee7f4c72deb0c0b4746740dbb983106e58 /data/generate.py | |
parent | e6dfc442a984bc50a70be5017f4ab9a0e6efadef (diff) | |
download | ranger-4cb54d3819d8a58d0bd07b8da0c4a978807c44ec.tar.gz |
translated mime type db generator into python
Diffstat (limited to 'data/generate.py')
-rwxr-xr-x | data/generate.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/data/generate.py b/data/generate.py new file mode 100755 index 00000000..61309259 --- /dev/null +++ b/data/generate.py @@ -0,0 +1,16 @@ +#!/usr/bin/python3 +# coding=utf-8 + +protocol = 0 + +import sys, pickle + +table = {} +for line in open(len(sys.argv) > 1 and sys.argv[1] or "mime.types"): + if len(line) > 3 and line[0] != '#' and '\t' in line: + name, *extensions = line.split() + for ext in extensions: + table[ext] = name + +pickle.dump(table, open('mime.dat', 'wb'), protocol) + |