Skip to content

Commit 6b7090c

Browse files
committed
refactoring parameters
1 parent 6995419 commit 6b7090c

File tree

4 files changed

+10
-28
lines changed

4 files changed

+10
-28
lines changed

DependencyInjection/AxeleroAwsTranscoderExtension.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ public function load(array $configs, ContainerBuilder $container)
2121
{
2222
$configuration = new Configuration();
2323
$config = $this->processConfiguration($configuration, $configs);
24-
$container->setParameter('axelero_aws_transcoder.input_bucket', $config['input_bucket']);
25-
$container->setParameter('axelero_aws_transcoder.output_bucket', $config['output_bucket']);
24+
$container->setParameter('axelero_aws_transcoder.pipeline_id', $config['pipeline_id']);
2625
$container->setParameter('axelero_aws_transcoder.key', $config['key']);
2726
$container->setParameter('axelero_aws_transcoder.region', $config['region']);
2827
$container->setParameter('axelero_aws_transcoder.secret', $config['secret']);

DependencyInjection/Configuration.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function getConfigTreeBuilder()
2222

2323
$rootNode
2424
->children()
25-
->scalarNode('input_bucket')
25+
->scalarNode('pipeline_id')
2626
->isRequired()
2727
->end()
2828
->scalarNode('key')
@@ -34,9 +34,6 @@ public function getConfigTreeBuilder()
3434
->scalarNode('region')
3535
->isRequired()
3636
->end()
37-
->scalarNode('output_bucket')
38-
->isRequired()
39-
->end()
4037
;
4138

4239
// Here you should define the parameters that are allowed to

Resources/config/services.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
</service>
2222

2323
<service id="axelero_aws_transcoder.gummy" class="%axelero_aws_transcoder.class%">
24-
<argument>%axelero_aws_transcoder.input_bucket%</argument>
25-
<argument>%axelero_aws_transcoder.output_bucket%</argument>
24+
<argument>%axelero_aws_transcoder.pipeline_id%</argument>
2625
<argument type="service" id="axelero_aws_transcoder.services.preset_provider"/>
2726
<argument type="service" id="axelero_aws_transcoder.client"/>
2827
</service>

Services/GummyTranscoder.php

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,7 @@ class GummyTranscoder
1515
/**
1616
* @var string
1717
*/
18-
private $baseFolder;
19-
20-
/**
21-
* @var string
22-
*/
23-
private $inputBucket;
24-
25-
/**
26-
* @var string
27-
*/
28-
private $outputBucket;
18+
private $pipelineId;
2919

3020
/**
3121
* @var PresetProvider
@@ -34,29 +24,26 @@ class GummyTranscoder
3424

3525
/**
3626
* GummyTranscoder constructor.
37-
* @param $inputBucket
38-
* @param $outputBucket
27+
* @param string $pipelineId
3928
* @param \Axelero\AwsTranscoderBundle\Services\PresetProvider $presetProvider
4029
* @param ElasticTranscoderClient $client
4130
*/
42-
public function __construct($inputBucket, $outputBucket, PresetProvider $presetProvider, ElasticTranscoderClient $client)
31+
public function __construct($pipelineId, PresetProvider $presetProvider, ElasticTranscoderClient $client)
4332
{
4433
$this->client = $client;
45-
$this->inputBucket = $inputBucket;
46-
$this->outputBucket = $outputBucket;
34+
$this->pipelineId = $pipelineId;
4735
$this->presetProvider = $presetProvider;
4836
}
4937

5038
/**
5139
* @param string $path the file path in the input bucket (the same path will be written used in the output one)
52-
* @param string $pipelineId the pipeline id
5340
* @param array $outputs the Output arrays
5441
* @return \Guzzle\Service\Resource\Model
5542
*/
56-
public function encode($path, $pipelineId, array $outputs)
43+
public function encode($path, array $outputs)
5744
{
5845
$result = $this->client->createJob([
59-
'PipelineId' => $pipelineId,
46+
'PipelineId' => $this->pipelineId,
6047
'Input' => [
6148
'Key' => $this->cleanPath($path),
6249
'FrameRate' => 'auto',
@@ -88,7 +75,7 @@ private function processOutputs($path, array $outputs)
8875
//if used a preset and no Key has been defined for output file
8976
//then the same path is used
9077
if ($detail && !$output['Key']) {
91-
$output['Key'] = $this->cleanPath($info['dirname']) . '/' . $info['filename'] . '.' . $detail;
78+
$output['Key'] = $this->cleanPath($info['dirname'] . '/' . $info['filename'] . '.' . $detail);
9279
}
9380
});
9481

0 commit comments

Comments
 (0)