Fixed PSR-2
This commit is contained in:
parent
42b5da2e39
commit
f61ff02693
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
namespace Sikofitt\Hathor\Command;
|
namespace Sikofitt\Hathor\Command;
|
||||||
|
|
||||||
|
|
||||||
use Symfony\Component\Finder\Finder;
|
use Symfony\Component\Finder\Finder;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
|
@ -15,7 +14,8 @@ use Symfony\Component\Console\Helper\ProgressBar;
|
||||||
use Symfony\Component\Console\Command\Command as BaseCommand;
|
use Symfony\Component\Console\Command\Command as BaseCommand;
|
||||||
use Sikofitt\Hathor\Common\Music\ID3;
|
use Sikofitt\Hathor\Common\Music\ID3;
|
||||||
|
|
||||||
class ScannerCommand extends BaseCommand {
|
class ScannerCommand extends BaseCommand
|
||||||
|
{
|
||||||
|
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
|
@ -54,5 +54,4 @@ class ScannerCommand extends BaseCommand {
|
||||||
//$getID3->setFile($input->getArgument('file'))->getFileData()->dumpAll();
|
//$getID3->setFile($input->getArgument('file'))->getFileData()->dumpAll();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
namespace Sikofitt\Hathor\Common\Music;
|
namespace Sikofitt\Hathor\Common\Music;
|
||||||
|
|
||||||
|
|
||||||
use Symfony\Component\VarDumper\VarDumper;
|
use Symfony\Component\VarDumper\VarDumper;
|
||||||
|
|
||||||
class ID3 extends \getID3
|
class ID3 extends \getID3
|
||||||
|
@ -19,15 +18,16 @@ class ID3 extends \getID3
|
||||||
const IS_VORBIS = 3;
|
const IS_VORBIS = 3;
|
||||||
const IS_UNKNOWN = 4;
|
const IS_UNKNOWN = 4;
|
||||||
|
|
||||||
public function __construct($file = null) {
|
public function __construct($file = null)
|
||||||
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
if(!is_null($file))
|
if (!is_null($file)) {
|
||||||
{
|
|
||||||
$this->file = $file;
|
$this->file = $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public function setFile($file) {
|
public function setFile($file)
|
||||||
|
{
|
||||||
$this->file = $file;
|
$this->file = $file;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -35,36 +35,42 @@ class ID3 extends \getID3
|
||||||
/**
|
/**
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
public function getFile() {
|
public function getFile()
|
||||||
|
{
|
||||||
return $this->file ?: $this->file;
|
return $this->file ?: $this->file;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFileData() {
|
public function getFileData()
|
||||||
|
{
|
||||||
|
|
||||||
$this->fileData = $this->analyze($this->getFile());
|
$this->fileData = $this->analyze($this->getFile());
|
||||||
|
|
||||||
if(isset($this->fileData['error']))
|
if (isset($this->fileData['error'])) {
|
||||||
{
|
|
||||||
throw new \RuntimeException(implode(' ', $this->fileData['error']));
|
throw new \RuntimeException(implode(' ', $this->fileData['error']));
|
||||||
} else {
|
} else {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public function extractV2() {
|
public function extractV2()
|
||||||
|
{
|
||||||
return [
|
return [
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
public function extractV1() {
|
public function extractV1()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
public function extractAsf() {
|
public function extractAsf()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
public function extractVorbis() {
|
public function extractVorbis()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
public function extractDefaultData() {
|
public function extractDefaultData()
|
||||||
|
{
|
||||||
switch ($this->typeOfTag()) {
|
switch ($this->typeOfTag()) {
|
||||||
case $this::IS_ID3V2:
|
case $this::IS_ID3V2:
|
||||||
break;
|
break;
|
||||||
|
@ -80,7 +86,8 @@ class ID3 extends \getID3
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public function typeOfTag() {
|
public function typeOfTag()
|
||||||
|
{
|
||||||
|
|
||||||
if ($this->hasId3v2()) {
|
if ($this->hasId3v2()) {
|
||||||
return $this::IS_ID3V2;
|
return $this::IS_ID3V2;
|
||||||
|
@ -96,28 +103,32 @@ class ID3 extends \getID3
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function hasId3v2() {
|
public function hasId3v2()
|
||||||
|
{
|
||||||
return isset($this->fileData['id3v2']);
|
return isset($this->fileData['id3v2']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function hasId3v1() {
|
public function hasId3v1()
|
||||||
|
{
|
||||||
return isset($this->fileData['id3v1']);
|
return isset($this->fileData['id3v1']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isAsf() {
|
public function isAsf()
|
||||||
|
{
|
||||||
return isset($this->fileData['asf']);
|
return isset($this->fileData['asf']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
public function dumpAll() {
|
public function dumpAll()
|
||||||
|
{
|
||||||
if (isset($this->fileData)) {
|
if (isset($this->fileData)) {
|
||||||
unset($this->fileData['tags']);
|
unset($this->fileData['tags']);
|
||||||
unset($this->fileData['asf']);
|
unset($this->fileData['asf']);
|
||||||
|
|
Loading…
Reference in New Issue