private static MediaType processNewer(JsonNode result, Metadata metadata, boolean returnMime) {
        metadata.set(MAGIKA_STATUS, "ok");
        //TODO -- should we get values in "dl" instead or in addition?
        addString(result, "status", MAGIKA_STATUS, metadata);

        if (! result.has("value")) {
            return MediaType.OCTET_STREAM;
        }
        JsonNode mValue = result.get("value");

        if (! mValue.has("output")) {
            //do something else
            return MediaType.OCTET_STREAM;
        }

        if (mValue.has("score")) {
            double score = mValue.get("score").asDouble(-1.0);
            metadata.set(MAGIKA_SCORE, score);
        }

        JsonNode mOutput = mValue.get("output");
        if (mOutput.has("score")) {
            double score = mOutput.get("score").asDouble(-1.0);
            metadata.set(MAGIKA_SCORE, score);
        }
        addString(mOutput, "description", MAGIKA_DESCRIPTION, metadata);
        addString(mOutput, "group", MAGIKA_GROUP, metadata);
        addString(mOutput, "label", MAGIKA_LABEL, metadata);
        addString(mOutput, "mime_type", MAGIKA_MIME, metadata);
        setBoolean(mOutput, "is_text", MAGIKA_IS_TEXT, metadata);
        metadata.set(MAGIKA_VERSION, MAGIKA_VERSION_STRING);
        if (returnMime && ! StringUtils.isBlank(metadata.get(MAGIKA_MIME))) {
            return MediaType.parse(metadata.get(MAGIKA_MIME));
        }

        return MediaType.OCTET_STREAM;

    }
As default behavior, Tika runs magika to add its detection
to the metadata, but NOT to use detection in determining parsers
etc.  If this is set to <code>true</code>, this detector
will return the first mime detected by magika and that
mime will be used by the AutoDetectParser to select the appropriate
parser.

@param useMime
tika-detectors/tika-detector-magika/src/main/java/org/apache/tika/detect/magika/MagikaDetector.java