-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Oguzhan Uysal
committed
Apr 2, 2017
1 parent
6764051
commit acb535b
Showing
4 changed files
with
97 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: oguzu | ||
* Date: 1-4-2017 | ||
* Time: 16:07 | ||
*/ | ||
|
||
namespace Pbxg33k\MusicInfo\Command; | ||
|
||
|
||
use Pbxg33k\MusicInfo\MusicInfo; | ||
use Symfony\Component\Console\Helper\Table; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class SearchAlbumCommand extends BaseCommand | ||
{ | ||
const COMMAND_NAME = 'search:album'; | ||
|
||
const COMMAND_DESCRIPTION = 'Search an album on one or more services'; | ||
|
||
/** | ||
* @var MusicInfo | ||
*/ | ||
protected $musicInfo; | ||
|
||
protected function configure() | ||
{ | ||
$this | ||
->addArgument('album', InputArgument::REQUIRED, 'Album name') | ||
->addArgument('service', InputArgument::OPTIONAL, 'Service to use, default to all enabled'); | ||
|
||
parent::configure(); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$service = ($input->getArgument('service') != '') ? $input->getArgument('service') : null; | ||
|
||
$searchResult = $this->musicInfo->doSearch($input->getArgument('album'), 'album', $service); | ||
|
||
$resultsTable = $this->generateTableForSearchResult($searchResult, [ | ||
'id' => 'ID', | ||
'name' => 'Name', | ||
'type' => 'Type', | ||
'image' => 'Image', | ||
'dataSource' => 'Source' | ||
], new Table($output)); | ||
|
||
$resultsTable->render(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters