mirror of
https://github.com/ToxicCrack/PrintABrick.git
synced 2025-05-28 01:30:11 -07:00
Fix service config
This commit is contained in:
parent
649121f1dc
commit
436624f751
@ -7,12 +7,15 @@ imports:
|
||||
# http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
|
||||
parameters:
|
||||
locale: en
|
||||
# rebrickable csv files root URL
|
||||
rebrickable_url: 'http://rebrickable.com/media/downloads/'
|
||||
ldraw_url: 'http://www.ldraw.org/library/updates/completeCA.zip'
|
||||
# LDraw library zip file URL
|
||||
ldraw_url: 'http://www.ldraw.org/library/updates/complete.zip'
|
||||
|
||||
framework:
|
||||
#esi: ~
|
||||
#translator: { fallbacks: ["%locale%"] }
|
||||
translator:
|
||||
fallbacks: ["%locale%"]
|
||||
secret: "%secret%"
|
||||
router:
|
||||
resource: "%kernel.root_dir%/config/routing.yml"
|
||||
|
@ -1,14 +1,14 @@
|
||||
services:
|
||||
client.brickset:
|
||||
api.client.brickset:
|
||||
class: AppBundle\Api\Client\Brickset\Brickset
|
||||
arguments: ['%brickset_apikey%']
|
||||
client.rebrickable:
|
||||
api.client.rebrickable:
|
||||
class: AppBundle\Api\Client\Rebrickable\Rebrickable_v3
|
||||
arguments: ['%rebrickable_apikey%']
|
||||
|
||||
manager.brickset:
|
||||
api.manager.brickset:
|
||||
class: AppBundle\Api\Manager\BricksetManager
|
||||
arguments: ['@client.brickset']
|
||||
manager.rebrickable:
|
||||
arguments: ['@api.client.brickset']
|
||||
api.manager.rebrickable:
|
||||
class: AppBundle\Api\Manager\RebrickableManager
|
||||
arguments: ['@client.rebrickable']
|
||||
arguments: ['@api.client.rebrickable']
|
@ -11,9 +11,10 @@ services:
|
||||
|
||||
app.form.filter_set:
|
||||
class: AppBundle\Form\FilterSetType
|
||||
arguments: ['@manager.brickset']
|
||||
arguments: ['@api.manager.brickset']
|
||||
tags:
|
||||
- { name: form.type } app.relation.mapper:
|
||||
- { name: form.type }
|
||||
|
||||
app.relation.mapper:
|
||||
class: AppBundle\Utils\RelationMapper
|
||||
arguments:
|
||||
|
@ -20,7 +20,7 @@ class LoadLDRawLibraryCommand extends ContainerAwareCommand
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$ldrawLoader = $this->getContainer()->get('loader.ldraw');
|
||||
$ldrawLoader = $this->getContainer()->get('service.loader.ldraw');
|
||||
$ldrawLoader->setOutput($output);
|
||||
|
||||
//TODO log errors
|
||||
|
@ -18,7 +18,7 @@ class LoadRebrickableDataCommand extends ContainerAwareCommand
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$rebrickableLoader = $this->getContainer()->get('loader.rebrickable');
|
||||
$rebrickableLoader = $this->getContainer()->get('service.loader.rebrickable');
|
||||
$rebrickableLoader->setOutput($output);
|
||||
|
||||
//TODO log errors
|
||||
|
@ -43,7 +43,7 @@ class Color
|
||||
/**
|
||||
* @var Collection
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Rebrickable\Inventory_part", mappedBy="color")
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Rebrickable\Inventory_Part", mappedBy="color")
|
||||
*/
|
||||
protected $inventoryParts;
|
||||
|
||||
|
@ -16,10 +16,15 @@ class LDViewService
|
||||
private $ldview;
|
||||
|
||||
/**
|
||||
* @var \League\Flysystem\Filesystem
|
||||
* @var Filesystem
|
||||
*/
|
||||
private $mediaFilesystem;
|
||||
|
||||
/**
|
||||
* @var Filesystem
|
||||
*/
|
||||
private $ldrawFilesystem;
|
||||
|
||||
/**
|
||||
* LDViewService constructor.
|
||||
*
|
||||
@ -32,6 +37,14 @@ class LDViewService
|
||||
$this->mediaFilesystem = $mediaFilesystem;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Filesystem $ldrawFilesystem
|
||||
*/
|
||||
public function setLdrawFilesystem($ldrawFilesystem)
|
||||
{
|
||||
$this->ldrawFilesystem = $ldrawFilesystem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert LDraw model from .dat format to .stl by using LDView
|
||||
* stores created file to $stlStorage filesystem.
|
||||
@ -40,18 +53,18 @@ class LDViewService
|
||||
*
|
||||
* @return File
|
||||
*/
|
||||
public function datToStl($file, $LDrawDir)
|
||||
public function datToStl($file, $LDrawDir = null)
|
||||
{
|
||||
if(!$this->mediaFilesystem->has('ldraw'.DIRECTORY_SEPARATOR.'models')) {
|
||||
$this->mediaFilesystem->createDir('ldraw' . DIRECTORY_SEPARATOR . 'models');
|
||||
if (!$this->mediaFilesystem->has('ldraw'.DIRECTORY_SEPARATOR.'models')) {
|
||||
$this->mediaFilesystem->createDir('ldraw'.DIRECTORY_SEPARATOR.'models');
|
||||
}
|
||||
|
||||
$newFile = 'ldraw'.DIRECTORY_SEPARATOR.'models'.DIRECTORY_SEPARATOR.$file['filename'].'.stl';
|
||||
|
||||
if (!$this->mediaFilesystem->has($newFile)) {
|
||||
$this->runLDView([
|
||||
$LDrawDir->getAdapter()->getPathPrefix().$file['path'],
|
||||
'-LDrawDir='.$LDrawDir->getAdapter()->getPathPrefix(),
|
||||
$this->ldrawFilesystem->getAdapter()->getPathPrefix().$file['path'],
|
||||
'-LDrawDir='.$this->ldrawFilesystem->getAdapter()->getPathPrefix(),
|
||||
'-ExportFiles=1',
|
||||
'-ExportSuffix=.stl',
|
||||
'-ExportsDir='.$this->mediaFilesystem->getAdapter()->getPathPrefix().'ldraw'.DIRECTORY_SEPARATOR.'models',
|
||||
@ -74,18 +87,18 @@ class LDViewService
|
||||
*
|
||||
* @return File
|
||||
*/
|
||||
public function datToPng($file, $LDrawDir)
|
||||
public function datToPng($file, $LDrawDir = null)
|
||||
{
|
||||
if(!$this->mediaFilesystem->has('ldraw'.DIRECTORY_SEPARATOR.'images')) {
|
||||
$this->mediaFilesystem->createDir('ldraw' . DIRECTORY_SEPARATOR . 'images');
|
||||
if (!$this->mediaFilesystem->has('ldraw'.DIRECTORY_SEPARATOR.'images')) {
|
||||
$this->mediaFilesystem->createDir('ldraw'.DIRECTORY_SEPARATOR.'images');
|
||||
}
|
||||
|
||||
$newFile = 'ldraw'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.$file['filename'].'.png';
|
||||
|
||||
if (!$this->mediaFilesystem->has($newFile)) {
|
||||
$this->runLDView([
|
||||
$LDrawDir->getAdapter()->getPathPrefix().$file['path'],
|
||||
'-LDrawDir='.$LDrawDir->getAdapter()->getPathPrefix(),
|
||||
$this->ldrawFilesystem->getAdapter()->getPathPrefix().$file['path'],
|
||||
'-LDrawDir='.$this->ldrawFilesystem->getAdapter()->getPathPrefix(),
|
||||
'-AutoCrop=1',
|
||||
'-SaveAlpha=0',
|
||||
'-SnapshotSuffix=.png',
|
||||
|
Loading…
x
Reference in New Issue
Block a user