+
+ # This is where we apply filtering
+ if extractor.filtercmd:
+ cmd = '%s %s' % (shellquote(extractor.filtercmd),
+ shellquote(json.dumps(metadata.__dict__)))
+ data = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read()
+ try:
+ metadata.__dict__.update(json.loads(data))
+ except ValueError:
+ sys.stderr.write("irkerhook.py: could not decode JSON: %s\n" % data)
+ raise SystemExit, 1
+
+ # Rewrite the file list if too long. The objective here is only
+ # to be easier on the eyes.
+ if extractor.cialike \
+ and extractor.cialike.lower() != "none" \
+ and len(metadata.files) > int(extractor.cialike):
+ files = metadata.files.split()
+ dirs = set([d.rpartition('/')[0] for d in files])
+ if len(dirs) == 1:
+ metadata.files = "(%s files)" % (len(files),)
+ else:
+ metadata.files = "(%s files in %s dirs)" % (len(files), len(dirs))