rclconfig.py, rclexecm.py: implement part of mimetype identification for rclexecm test mode
This commit is contained in:
+11
-5
@@ -386,6 +386,7 @@ def main(proto, extract):
|
||||
|
||||
if len(args) != 1:
|
||||
usage()
|
||||
path = args[0]
|
||||
|
||||
def mimetype_with_file(f):
|
||||
cmd = 'file -i "' + f + '"'
|
||||
@@ -402,11 +403,16 @@ def main(proto, extract):
|
||||
def debprint(out, s):
|
||||
if not actAsSingle:
|
||||
proto.breakwrite(out, makebytes(s+'\n'))
|
||||
|
||||
params = {'filename:': makebytes(args[0])}
|
||||
# Some filters (e.g. rclaudio) need/get a MIME type from the indexer
|
||||
mimetype = mimetype_with_file(args[0])
|
||||
params['mimetype:'] = mimetype
|
||||
|
||||
params = {'filename:': makebytes(path)}
|
||||
|
||||
# Some filters (e.g. rclaudio) need/get a MIME type from the indexer.
|
||||
# We make a half-assed attempt to emulate:
|
||||
mimetype = my_config.mimeType(path)
|
||||
if not mimetype and not _mswindows:
|
||||
mimetype = mimetype_with_file(path)
|
||||
if mimetype:
|
||||
params['mimetype:'] = mimetype
|
||||
|
||||
if not extract.openfile(params):
|
||||
print("Open error", file=sys.stderr)
|
||||
|
||||
Reference in New Issue
Block a user