bugs fixes

This commit is contained in:
Simon Vieille 2015-03-05 15:04:08 +01:00
parent 715ee64138
commit 20578b8296
11 changed files with 13 additions and 7 deletions

View file

@ -112,8 +112,8 @@ class Client
return new ClientResponse($this->client->{$method}($uri, $options));
} catch (RequestException $e) {
throw new ClientException(sprintf('Request exception (%s): %s', strtoupper($method), $e->getMessage()));
} catch (HttpConnectException $e) {
throw new ClientException(sprintf('HTTP Connection exception: %s', $e->getMessage()));
} catch (\Exception $e) {
throw new ClientException(sprintf('Exception: %s', $e->getMessage()));
}
}
}

View file

@ -7,6 +7,7 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use Api\ConfigLoader;
use Api\Client;
use Api\ClientException;
class AuthLoginCommand extends Command
{

View file

@ -7,6 +7,7 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use Api\Client;
use Api\ConfigLoader;
use Api\ClientException;
class CategoriesTreeCommand extends Command
{

View file

@ -8,6 +8,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Command\Command;
use Api\Client;
use Api\ConfigLoader;
use Api\ClientException;
class TorrentsDetailsCommand extends Command
{

View file

@ -10,6 +10,7 @@ use Api\Client;
use Api\ConfigLoader;
use GuzzleHttp\Exception\ParseException;
use Symfony\Component\Filesystem\Filesystem;
use Api\ClientException;
class TorrentsDownloadCommand extends Command
{

View file

@ -10,6 +10,7 @@ use Symfony\Component\Console\Command\Command;
use Api\Client;
use Api\ConfigLoader;
use Api\ClientResponse;
use Api\ClientException;
class TorrentsSearchCommand extends Command
{

View file

@ -9,6 +9,7 @@ use Symfony\Component\Console\Command\Command;
use Api\Client;
use Api\ConfigLoader;
use Api\ClientResponse;
use Api\ClientException;
class TorrentsTopCommand extends Command
{

View file

@ -8,6 +8,7 @@ use Symfony\Component\Console\Command\Command;
use Api\Client;
use Api\ConfigLoader;
use Symfony\Component\Console\Input\InputOption;
use Api\ClientException;
class TypesTreeCommand extends Command
{

View file

@ -8,6 +8,7 @@ use Symfony\Component\Console\Command\Command;
use Api\Client;
use Api\ConfigLoader;
use Symfony\Component\Console\Input\InputOption;
use Api\ClientException;
class UsersProfileCommand extends Command
{
@ -91,6 +92,6 @@ Usage: <comment>users:profile</comment> [OPTIONS]");
$sizes = 'BKMGTP';
$factor = floor((strlen($bytes) - 1) / 3);
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sizes[$factor];
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)).$sizes[$factor];
}
}

View file

@ -4,8 +4,6 @@ namespace Transmission\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Command\Command;
use Api\ConfigLoader;

View file

@ -49,7 +49,7 @@ Usage: <comment>transmission:download</comment> <info>TORRENT_ID</info>");
$options = [];
if (!empty($config['username']) and !empty($config['password'])) {
if (!empty($config['username']) && !empty($config['password'])) {
$options = array(
'request.options' => array(
'auth' => array($config['username'], $config['password'])
@ -66,7 +66,7 @@ Usage: <comment>transmission:download</comment> <info>TORRENT_ID</info>");
$content = base64_encode(file_get_contents($outputFile));
$torrent = $transmission->add($content, true);
$transmission->add($content, true);
} catch (\Exception $e) {
unlink($outputFile);