namespace App\Jobs;
+use Cubist\Util\CommandLine;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
-class ProcessFluidbook implements ShouldQueue
+class ProcessFluidbook implements ShouldQueue, ShouldBeUnique
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
+ protected $in;
+ protected $out;
+
+ protected $pages;
+ protected $width;
+ protected $height;
+
/**
* Create a new job instance.
*
*/
public function __construct()
{
- //
+ $this->in = storage_path('fluidbook/in/');
+ $this->out = storage_path('fluidbook/out/');
}
/**
*/
public function handle()
{
- //
+ $this->resetOutput();
+ $this->getInfos();
+ $this->pdfToImages();
+ $this->getTexts();
+ $this->getLinks();
+ $this->writeConfig();
+ }
+
+ protected function resetOutput()
+ {
+ $stub = resource_path('fluidbook/');
+ $cmd = "rm -rfv $this->out;cp -rv $stub $this->out";
+ `$cmd`;
+ }
+
+ public function getInfos()
+ {
+ $fwstk = new CommandLine(base_path('tools/fwstk.sh'));
+ $fwstk->setArg('--input ' . $this->in . 'in.pdf');
+ $fwstk->setArg('--infos');
+ $fwstk->execute();
+
+ $infos = $fwstk->getOutput();
+
+ if (preg_match('/Pages:\s*(\d+)/', $infos, $matches)) {
+ $this->pages = (int)$matches[1];
+ }
+ if (preg_match('/Page 1 size:\s*([0-9.]+)[ptsx\s]+([0-9.]+)/', $infos, $matches)) {
+ $this->width = (float)$matches[1];
+ $this->height = (float)$matches[2];
+ }
+
+ file_put_contents($this->in . '/infos.txt', $infos);
+ }
+
+ public function pdfToImages()
+ {
+
+ }
+
+ public function getTexts()
+ {
+
+ }
+
+ public function getLinks()
+ {
+
}
+
+ public function writeConfig()
+ {
+
+ }
+
}
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
- "fruitcake/laravel-cors": "^2.0",
- "guzzlehttp/guzzle": "^7.0.1",
- "laravel/framework": "^8.58",
- "laravel/sanctum": "^2.11",
- "laravel/tinker": "^2.5",
"ext-json": "*",
"ext-simplexml": "*",
"ext-tidy": "*",
"ext-zip": "*",
+ "ext-redis": "*",
"cubist/cms-back": "dev-master",
+ "fruitcake/laravel-cors": "^2.0",
+ "guzzlehttp/guzzle": "^7.3",
+ "laravel/framework": "^8.58",
+ "laravel/sanctum": "^2.11",
+ "laravel/tinker": "^2.6",
+ "mxl/laravel-job": "^1.2",
"predis/predis": "^1.1"
},
"require-dev": {
- "facade/ignition": "^2.5",
- "fakerphp/faker": "^1.9.1",
- "laravel/sail": "^1.0.1",
+ "facade/ignition": "^2.12",
+ "fakerphp/faker": "^1.15",
+ "laravel/sail": "^1.10",
"mockery/mockery": "^1.4.2",
- "nunomaduro/collision": "^5.0",
- "phpunit/phpunit": "^9.3.3",
- "ext-json": "*",
- "ext-simplexml": "*",
- "ext-tidy": "*",
- "ext-zip": "*",
- "cubist/cms-back": "dev-master",
- "predis/predis": "^1.1"
+ "nunomaduro/collision": "^5.9",
+ "phpunit/phpunit": "^9.5"
},
"autoload": {
"psr-4": {
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "e8ee131ea1f792b178463f11763287e2",
+ "content-hash": "90fd3102e33006c8e1bfaef9432159d3",
"packages": [
{
"name": "asm89/stack-cors",
"source": {
"type": "git",
"url": "git://git.cubedesigners.com/cubist_cms-back.git",
- "reference": "e171e566d742696ca4a1b9f48faf602bb1ca72e9"
+ "reference": "2a39df6e8b6e6da4c70cafbd359a7e7900bb54df"
},
"dist": {
"type": "tar",
- "url": "https://composer.cubedesigners.com/dist/cubist/cms-back/cubist-cms-back-dev-master-a520cd.tar",
- "reference": "e171e566d742696ca4a1b9f48faf602bb1ca72e9",
- "shasum": "57074a4c19045c56760c0166101007ebc21ff495"
+ "url": "https://composer.cubedesigners.com/dist/cubist/cms-back/cubist-cms-back-dev-master-78721e.tar",
+ "reference": "2a39df6e8b6e6da4c70cafbd359a7e7900bb54df",
+ "shasum": "8268c601330917a9c23ab1dcf5ee5dbf70779f08"
},
"require": {
"backpack/backupmanager": "^3.0",
- "backpack/crud": "^4.1",
+ "backpack/crud": "^4.1.51",
"backpack/logmanager": "^4.0",
"backpack/permissionmanager": "^6.0",
"backpack/revise-operation": "^1.0",
"ext-libxml": "*",
"fideloper/proxy": "^4.4",
"genealabs/laravel-model-caching": "^0.11",
- "graham-campbell/markdown": "^v13.1.0",
+ "graham-campbell/markdown": "^v13.1",
"laravel/framework": "^v8.58",
"lavary/laravel-menu": "^v1.8",
"league/commonmark": "^1.6",
"predis/predis": "^v1.1",
"spatie/laravel-honeypot": "^4.0",
"spatie/laravel-translatable": "^5.0",
- "swayok/alternative-laravel-cache": "^5.4",
+ "swayok/alternative-laravel-cache": "^6.1",
"venturecraft/revisionable": "^1.38"
},
"require-dev": {
}
],
"description": "Cubist Backpack extension",
- "time": "2021-09-02T10:05:06+00:00"
+ "time": "2021-09-03T14:57:36+00:00"
},
{
"name": "cubist/cms-front",
],
"time": "2021-07-23T07:42:52+00:00"
},
+ {
+ "name": "mxl/laravel-job",
+ "version": "v1.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/mxl/laravel-job.git",
+ "reference": "826e472f5282d3c630dca3fccf99784fa379ce5c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/mxl/laravel-job/zipball/826e472f5282d3c630dca3fccf99784fa379ce5c",
+ "reference": "826e472f5282d3c630dca3fccf99784fa379ce5c",
+ "shasum": ""
+ },
+ "require": {
+ "laravel/framework": "5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0",
+ "php": ">=7.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^9.2"
+ },
+ "type": "library",
+ "extra": {
+ "laravel": {
+ "providers": [
+ "MichaelLedin\\LaravelJob\\LaravelJobServiceProvider"
+ ]
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "MichaelLedin\\LaravelJob\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Ledin",
+ "email": "mledin89@gmail.com"
+ }
+ ],
+ "description": "Laravel job tools",
+ "homepage": "https://github.com/mxl/laravel-job",
+ "keywords": [
+ "command",
+ "dispatch",
+ "job",
+ "laravel",
+ "tools"
+ ],
+ "support": {
+ "issues": "https://github.com/mxl/laravel-job/issues",
+ "source": "https://github.com/mxl/laravel-job"
+ },
+ "time": "2020-09-11T06:40:19+00:00"
+ },
{
"name": "myclabs/php-enum",
"version": "1.8.3",
},
{
"name": "swayok/alternative-laravel-cache",
- "version": "5.4.13",
+ "version": "6.1.2",
"source": {
"type": "git",
"url": "https://github.com/swayok/alternative-laravel-cache.git",
- "reference": "3fee1f4eeb1c88d29ff3869a36d970f9f254f5f9"
+ "reference": "31f1a5c4de90ce257ccb40fef4d38874ddb1b275"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/swayok/alternative-laravel-cache/zipball/3fee1f4eeb1c88d29ff3869a36d970f9f254f5f9",
- "reference": "3fee1f4eeb1c88d29ff3869a36d970f9f254f5f9",
+ "url": "https://api.github.com/repos/swayok/alternative-laravel-cache/zipball/31f1a5c4de90ce257ccb40fef4d38874ddb1b275",
+ "reference": "31f1a5c4de90ce257ccb40fef4d38874ddb1b275",
"shasum": ""
},
"require": {
"cache/adapter-common": "^1.0.0",
"cache/hierarchical-cache": "^1.0.0",
- "laravel/framework": ">=5.4|>=6.0|>=7.0|>=8.0",
- "php": "^5.6 || ^7.0",
+ "laravel/framework": ">=6.0|>=7.0|>=8.0",
+ "php": "^7.2.5|^8.0",
"psr/cache": "^1.0.0",
"psr/simple-cache": "^1.0.0"
},
+ "require-dev": {
+ "cache/filesystem-adapter": "^1.0",
+ "cache/memcached-adapter": "^1.0",
+ "cache/predis-adapter": "^1.0",
+ "cache/redis-adapter": "^1.0",
+ "phpunit/phpunit": "^8.5"
+ },
"suggest": {
"cache/filesystem-adapter": "Required to use file-based cache",
+ "cache/memcached-adapter": "Required to use Memcache-based cache",
"cache/predis-adapter": "Required to use Redis-based cache through predis/predis package",
"cache/redis-adapter": "Required to use Redis-based cache through php-redis extension (recommended - faster and more stable then predis)"
},
}
},
"autoload": {
- "psr-0": {
- "AlternativeLaravelCache": "/src"
+ "psr-4": {
+ "AlternativeLaravelCache\\": "AlternativeLaravelCache/"
}
},
"notification-url": "https://packagist.org/downloads/",
],
"support": {
"issues": "https://github.com/swayok/alternative-laravel-cache/issues",
- "source": "https://github.com/swayok/alternative-laravel-cache/tree/5.4.13"
+ "source": "https://github.com/swayok/alternative-laravel-cache/tree/6.1.2"
},
- "time": "2020-09-08T17:10:42+00:00"
+ "time": "2021-05-18T20:39:07+00:00"
},
{
"name": "swiftmailer/swiftmailer",
"type": "github"
}
],
+ "abandoned": true,
"time": "2020-09-28T06:45:17+00:00"
},
{
"ext-tidy": "*",
"ext-zip": "*"
},
- "platform-dev": {
- "ext-json": "*",
- "ext-simplexml": "*",
- "ext-tidy": "*",
- "ext-zip": "*"
- },
+ "platform-dev": [],
"plugin-api-version": "2.1.0"
}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="EclipseModuleManager">
+ <varelement var="file://$MODULE_DIR$/../../../../Java/resources" kind="linksrc:" value="resources" />
+ <varelement var="file://$MODULE_DIR$/../../../../Java" kind="linksrc:" value="Java" />
+ <src_description expected_position="0">
+ <src_folder value="file://$MODULE_DIR$/src" expected_position="0" />
+ <src_folder value="file://$MODULE_DIR$/project_resources" expected_position="1" />
+ <src_folder value="file://$MODULE_DIR$/../../../../Java/resources" expected_position="2" />
+ <src_folder value="file://$MODULE_DIR$/../../../../Java" expected_position="3" />
+ </src_description>
+ </component>
+ <component name="NewModuleRootManager">
+ <output url="file://$MODULE_DIR$/bin" />
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/project_resources" isTestSource="false" />
+ </content>
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="library" exported="" name="avalon-framework-4.1.4" level="project" />
+ <orderEntry type="library" name="fontbox-1.8.16" level="project" />
+ <orderEntry type="library" name="jempbox-1.8.16" level="project" />
+ <orderEntry type="library" name="pdfbox-1.8.16" level="project" />
+ <orderEntry type="library" name="commons-io-2.6" level="project" />
+ <orderEntry type="library" name="commons-logging-1.2" level="project" />
+ <orderEntry type="library" name="commons-lang3-3.10" level="project" />
+ <orderEntry type="library" name="commons-text-1.8" level="project" />
+ </component>
+</module>
\ No newline at end of file