1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the XabbuhPandaBundle package. |
5
|
|
|
* |
6
|
|
|
* (c) Christian Flothmann <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Xabbuh\PandaBundle\Command; |
13
|
|
|
|
14
|
|
|
use Symfony\Component\Console\Helper\Table; |
15
|
|
|
use Symfony\Component\Console\Input\InputArgument; |
16
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
17
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Fetch an encoding's data. |
21
|
|
|
* |
22
|
|
|
* @author Christian Flothmann <[email protected]> |
23
|
|
|
*/ |
24
|
|
|
final class EncodingInfoCommand extends CloudCommand |
25
|
|
|
{ |
26
|
|
|
protected static $defaultName = 'panda:encoding:info'; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* {@inheritDoc} |
30
|
|
|
*/ |
31
|
5 |
|
protected function configure() |
32
|
|
|
{ |
33
|
5 |
|
$this->setDescription('Fetch information for an encoding'); |
34
|
5 |
|
$this->addArgument( |
35
|
5 |
|
'encoding-id', |
36
|
5 |
|
InputArgument::REQUIRED, |
37
|
5 |
|
'The id of the encoding being fetched' |
38
|
|
|
); |
39
|
|
|
|
40
|
5 |
|
parent::configure(); |
41
|
5 |
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* {@inheritDoc} |
45
|
|
|
*/ |
46
|
3 |
|
protected function doExecuteCommand(InputInterface $input, OutputInterface $output) |
47
|
|
|
{ |
48
|
3 |
|
$cloud = $this->getCloud($input); |
49
|
3 |
|
$encoding = $cloud->getEncoding($input->getArgument('encoding-id')); |
|
|
|
|
50
|
2 |
|
$table = new Table($output); |
51
|
2 |
|
$table->addRows(array( |
52
|
2 |
|
array('id', $encoding->getId()), |
53
|
2 |
|
array('video id', $encoding->getVideoId()), |
54
|
2 |
|
array('file extension', $encoding->getExtname()), |
55
|
2 |
|
array('profile id', $encoding->getProfileId()), |
56
|
2 |
|
array('profile name', $encoding->getProfileName()), |
57
|
2 |
|
array('path', $encoding->getPath()), |
58
|
2 |
|
array('width', $encoding->getWidth()), |
59
|
2 |
|
array('height', $encoding->getHeight()), |
60
|
2 |
|
array('audio bit rate', $encoding->getAudioBitrate()), |
61
|
2 |
|
array('video bit rate', $encoding->getVideoBitrate()), |
62
|
2 |
|
array('status', $encoding->getStatus()), |
63
|
|
|
)); |
64
|
|
|
|
65
|
2 |
|
if ('fail' === $encoding->getStatus()) { |
66
|
1 |
|
$table->addRow(array('error message', $encoding->getErrorMessage())); |
67
|
|
|
} |
68
|
|
|
|
69
|
2 |
|
$table->addRows(array( |
70
|
2 |
|
array('encoding progress', $encoding->getEncodingProgress()), |
71
|
2 |
|
array('encoding started', $encoding->getStartedEncodingAt()), |
72
|
2 |
|
array('encoding time', $encoding->getEncodingTime()), |
73
|
2 |
|
array('created at', $encoding->getCreatedAt()), |
74
|
2 |
|
array('updated at', $encoding->getUpdatedAt()), |
75
|
|
|
)); |
76
|
2 |
|
$table->render($output); |
|
|
|
|
77
|
2 |
|
} |
78
|
|
|
} |
79
|
|
|
|
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.