diff --git a/src/Deblan/Command/ListCommand.php b/src/Deblan/Command/ListCommand.php index 3289519..6f34355 100644 --- a/src/Deblan/Command/ListCommand.php +++ b/src/Deblan/Command/ListCommand.php @@ -17,7 +17,7 @@ class ListCommand extends Command ->setDescription('List available streams.') ->addOption('language', null, InputOption::VALUE_REQUIRED, '') ->addOption('difficulty', null, InputOption::VALUE_REQUIRED, '') - ->setHelp("The %command.name% lists live streams"); + ->setHelp('The %command.name% lists live streams'); } protected function execute(InputInterface $input, OutputInterface $output) @@ -32,12 +32,40 @@ class ListCommand extends Command if (in_array($language, $languages)) { $language = array_keys($languages, $language)[0]; } elseif (!in_array($language, array_keys($languages))) { + if ($language !== null) { + $output->writeln('language available values:'); + + foreach ($liveCoding->getLanguages() as $key => $value) { + $output->writeln(sprintf( + ' %s or %s', + $key, + $value + )); + } + + $output->writeln(''); + } + $language = null; } if (in_array($difficulty, array_keys($difficulties))) { $difficulty = $difficulties[$difficulty]; } elseif (!in_array($difficulty, $difficulties)) { + if ($difficulty !== null) { + $output->writeln('difficulty available values:'); + + foreach ($liveCoding->getDifficulties() as $key => $value) { + $output->writeln(sprintf( + ' %s or %s', + $key, + $value + )); + } + + $output->writeln(''); + } + $difficulty = null; } diff --git a/src/Deblan/Helper/LiveCoding.php b/src/Deblan/Helper/LiveCoding.php index dbdd437..55e968b 100644 --- a/src/Deblan/Helper/LiveCoding.php +++ b/src/Deblan/Helper/LiveCoding.php @@ -51,7 +51,7 @@ class LiveCoding $content = file_get_contents($this->app->buildUrl(sprintf( 'livestreams/%s%s', $language !== null ? $language.'/' : 'all', - $difficulty !== null ? $difficulty.'/' : null + $difficulty !== null ? '/'.$difficulty.'/' : null ))); preg_match_all( @@ -94,7 +94,7 @@ class LiveCoding $stream = new Stream(); $stream - ->setTitle(trim($titleMatch[1])) + ->setTitle(html_entity_decode(trim($titleMatch[1]))) ->setViews($viewsMatch[1]) ->setCountry($countryMatch[1]) ->setAuthor($authorMatch[1])