<commit_before><?php

namespace OCA\RawPreview;

use OCP\Preview\IProvider;

class RawOffice implements IProvider {
    private $cmd;
    private $gs;
    /**
     * {@inheritDoc}
     */
    public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
        $this->initCmd();
        if (is_null($this->cmd)) {
            return false;
        }
        $absPath = $fileview->toTmpFile($path);
        $tmpDir = \OC::$server->getTempManager()->getTempBaseDir();

//        $defaultParameters = ' -env:UserInstallation=file://' . escapeshellarg($tmpDir . '/owncloud-' . \OC_Util::getInstanceId() . '/') . ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to pdf --outdir ';
//        $clParameters = \OC::$server->getConfig()->getSystemValue('preview_office_cl_parameters', $defaultParameters);

        $clParameters =
            ' -env:UserInstallation=file://' . escapeshellarg($tmpDir . '/owncloud-' .
            \OC_Util::getInstanceId() . '/') .
            ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to pdf --outdir ';

        $exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath);
        shell_exec($exec);

        //create imagick object from pdf
        $pdfPreview = null;

        list($dirname, , , $filename) = array_values(pathinfo($absPath));
        $pdfPreview = $dirname . '/' . $filename . '.pdf';

        $exec = $this->gs . " -dNOPAUSE -sDEVICE=jpeg -r200 -dJPEGQ=60  -dFirstPage=1 -dLastPage=1 -sOutputFile=$pdfPreview.jpg $pdfPreview -dBATCH";
        shell_exec($exec);
<commit_msg>Added config for ffmpeg & libreoffice<commit_after><?php

namespace OCA\RawPreview;

use OCP\Preview\IProvider;

class RawOffice implements IProvider {
    private $cmd;
    private $gs;
    /**
     * {@inheritDoc}
     */
    public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
        $this->initCmd();
        if (is_null($this->cmd)) {
            return false;
        }
        $absPath = $fileview->toTmpFile($path);
        $tmpDir = \OC::$server->getTempManager()->getTempBaseDir();

//        $defaultParameters = ' -env:UserInstallation=file://' . escapeshellarg($tmpDir . '/owncloud-' . \OC_Util::getInstanceId() . '/') . ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to pdf --outdir ';
//        $clParameters = \OC::$server->getConfig()->getSystemValue('preview_office_cl_parameters', $defaultParameters);

        $clParameters =
            ' -env:UserInstallation=file://' . escapeshellarg($tmpDir . '/owncloud-' .
            \OC_Util::getInstanceId() . '/') .
            ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to pdf --outdir ';

        $exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath);
        shell_exec($exec);

        //create imagick object from pdf
        $pdfPreview = null;

        list($dirname, , , $filename) = array_values(pathinfo($absPath));
        $pdfPreview = $tmpDir . '/' . $filename . '.pdf';

        $exec = $this->gs . " -dNOPAUSE -sDEVICE=jpeg -r200 -dJPEGQ=60  -dFirstPage=1 -dLastPage=1 -sOutputFile=$pdfPreview.jpg $pdfPreview -dBATCH";
        shell_exec($exec);

{'fraction_non_alphanumeric': 0.17077625570776256, 'fraction_numerical': 0.00426179604261796, 'mean_word_length': 2.651111111111111, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7511690', 'n_tokens_mistral': 1069, 'n_tokens_neox': 1034, 'n_words': 186}