mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-11 03:49:16 +00:00
mime type for file -b
This commit is contained in:
@@ -149,9 +149,13 @@ class Templategen:
|
|||||||
try:
|
try:
|
||||||
import magic
|
import magic
|
||||||
filetype = magic.from_file(src, mime=True)
|
filetype = magic.from_file(src, mime=True)
|
||||||
|
if self.debug:
|
||||||
|
self.log.dbg('using \"magic\" for filetype identification')
|
||||||
except ImportError:
|
except ImportError:
|
||||||
_, filetype = utils.run(['file', '-b', src],
|
_, filetype = utils.run(['file', '-b', '--mime-type', src],
|
||||||
raw=False, debug=self.debug)
|
raw=False, debug=self.debug)
|
||||||
|
if self.debug:
|
||||||
|
self.log.dbg('using \"file\" for filetype identification')
|
||||||
filetype = filetype.strip()
|
filetype = filetype.strip()
|
||||||
istext = self._is_text(filetype)
|
istext = self._is_text(filetype)
|
||||||
if self.debug:
|
if self.debug:
|
||||||
@@ -167,8 +171,6 @@ class Templategen:
|
|||||||
out = fileoutput.lower()
|
out = fileoutput.lower()
|
||||||
if out.startswith('text'):
|
if out.startswith('text'):
|
||||||
return True
|
return True
|
||||||
if 'text' in out:
|
|
||||||
return True
|
|
||||||
if 'empty' in out:
|
if 'empty' in out:
|
||||||
return True
|
return True
|
||||||
if 'json' in out:
|
if 'json' in out:
|
||||||
|
|||||||
Reference in New Issue
Block a user