diff options
| author | jvoisin | 2018-04-02 17:36:26 +0200 |
|---|---|---|
| committer | jvoisin | 2018-04-02 17:36:26 +0200 |
| commit | 6868f20065ef2e46f295c34f27c0736d54283535 (patch) | |
| tree | a76ef4cf903d763fe4435e282c402f2ebd0d0a82 /main.py | |
| parent | 6c29e0eae256ddb3d32fd78e9949d0aa81be033e (diff) | |
`parser_factory` now returns the mtype too
Diffstat (limited to 'main.py')
| -rw-r--r-- | main.py | 7 |
1 files changed, 3 insertions, 4 deletions
| @@ -20,9 +20,8 @@ def create_arg_parser(): | |||
| 20 | return parser | 20 | return parser |
| 21 | 21 | ||
| 22 | def show_meta(filename:str): | 22 | def show_meta(filename:str): |
| 23 | p = parser_factory.get_parser(filename) | 23 | p, mtype = parser_factory.get_parser(filename) |
| 24 | if p is None: | 24 | if p is None: |
| 25 | mtype, _ = mimetypes.guess_type(filename) | ||
| 26 | print("[-] %s's format (%s) is not supported" % (filename, mtype)) | 25 | print("[-] %s's format (%s) is not supported" % (filename, mtype)) |
| 27 | return | 26 | return |
| 28 | for k,v in p.get_meta().items(): | 27 | for k,v in p.get_meta().items(): |
| @@ -38,9 +37,9 @@ def main(): | |||
| 38 | return 0 | 37 | return 0 |
| 39 | 38 | ||
| 40 | for f in args.files: | 39 | for f in args.files: |
| 41 | p = parser_factory.get_parser(f) | 40 | p, mtype = parser_factory.get_parser(f) |
| 42 | if p is None: | 41 | if p is None: |
| 43 | print("[-] %s's format (%s) is not supported" % (f, "meh")) | 42 | print("[-] %s's format (%s) is not supported" % (f, mtype)) |
| 44 | continue | 43 | continue |
| 45 | p.remove_all() | 44 | p.remove_all() |
| 46 | 45 | ||
