forked from deblan/t411-console
bugs fixes
This commit is contained in:
parent
715ee64138
commit
20578b8296
|
@ -112,8 +112,8 @@ class Client
|
||||||
return new ClientResponse($this->client->{$method}($uri, $options));
|
return new ClientResponse($this->client->{$method}($uri, $options));
|
||||||
} catch (RequestException $e) {
|
} catch (RequestException $e) {
|
||||||
throw new ClientException(sprintf('Request exception (%s): %s', strtoupper($method), $e->getMessage()));
|
throw new ClientException(sprintf('Request exception (%s): %s', strtoupper($method), $e->getMessage()));
|
||||||
} catch (HttpConnectException $e) {
|
} catch (\Exception $e) {
|
||||||
throw new ClientException(sprintf('HTTP Connection exception: %s', $e->getMessage()));
|
throw new ClientException(sprintf('Exception: %s', $e->getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Api\ConfigLoader;
|
use Api\ConfigLoader;
|
||||||
use Api\Client;
|
use Api\Client;
|
||||||
|
use Api\ClientException;
|
||||||
|
|
||||||
class AuthLoginCommand extends Command
|
class AuthLoginCommand extends Command
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,6 +7,7 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Api\Client;
|
use Api\Client;
|
||||||
use Api\ConfigLoader;
|
use Api\ConfigLoader;
|
||||||
|
use Api\ClientException;
|
||||||
|
|
||||||
class CategoriesTreeCommand extends Command
|
class CategoriesTreeCommand extends Command
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,7 @@ use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Api\Client;
|
use Api\Client;
|
||||||
use Api\ConfigLoader;
|
use Api\ConfigLoader;
|
||||||
|
use Api\ClientException;
|
||||||
|
|
||||||
class TorrentsDetailsCommand extends Command
|
class TorrentsDetailsCommand extends Command
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,6 +10,7 @@ use Api\Client;
|
||||||
use Api\ConfigLoader;
|
use Api\ConfigLoader;
|
||||||
use GuzzleHttp\Exception\ParseException;
|
use GuzzleHttp\Exception\ParseException;
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
|
use Api\ClientException;
|
||||||
|
|
||||||
class TorrentsDownloadCommand extends Command
|
class TorrentsDownloadCommand extends Command
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,6 +10,7 @@ use Symfony\Component\Console\Command\Command;
|
||||||
use Api\Client;
|
use Api\Client;
|
||||||
use Api\ConfigLoader;
|
use Api\ConfigLoader;
|
||||||
use Api\ClientResponse;
|
use Api\ClientResponse;
|
||||||
|
use Api\ClientException;
|
||||||
|
|
||||||
class TorrentsSearchCommand extends Command
|
class TorrentsSearchCommand extends Command
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,6 +9,7 @@ use Symfony\Component\Console\Command\Command;
|
||||||
use Api\Client;
|
use Api\Client;
|
||||||
use Api\ConfigLoader;
|
use Api\ConfigLoader;
|
||||||
use Api\ClientResponse;
|
use Api\ClientResponse;
|
||||||
|
use Api\ClientException;
|
||||||
|
|
||||||
class TorrentsTopCommand extends Command
|
class TorrentsTopCommand extends Command
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,7 @@ use Symfony\Component\Console\Command\Command;
|
||||||
use Api\Client;
|
use Api\Client;
|
||||||
use Api\ConfigLoader;
|
use Api\ConfigLoader;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
|
use Api\ClientException;
|
||||||
|
|
||||||
class TypesTreeCommand extends Command
|
class TypesTreeCommand extends Command
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,7 @@ use Symfony\Component\Console\Command\Command;
|
||||||
use Api\Client;
|
use Api\Client;
|
||||||
use Api\ConfigLoader;
|
use Api\ConfigLoader;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
|
use Api\ClientException;
|
||||||
|
|
||||||
class UsersProfileCommand extends Command
|
class UsersProfileCommand extends Command
|
||||||
{
|
{
|
||||||
|
@ -91,6 +92,6 @@ Usage: <comment>users:profile</comment> [OPTIONS]");
|
||||||
$sizes = 'BKMGTP';
|
$sizes = 'BKMGTP';
|
||||||
$factor = floor((strlen($bytes) - 1) / 3);
|
$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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,6 @@ namespace Transmission\Command;
|
||||||
|
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
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 Symfony\Component\Console\Command\Command;
|
||||||
use Api\ConfigLoader;
|
use Api\ConfigLoader;
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ Usage: <comment>transmission:download</comment> <info>TORRENT_ID</info>");
|
||||||
|
|
||||||
$options = [];
|
$options = [];
|
||||||
|
|
||||||
if (!empty($config['username']) and !empty($config['password'])) {
|
if (!empty($config['username']) && !empty($config['password'])) {
|
||||||
$options = array(
|
$options = array(
|
||||||
'request.options' => array(
|
'request.options' => array(
|
||||||
'auth' => array($config['username'], $config['password'])
|
'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));
|
$content = base64_encode(file_get_contents($outputFile));
|
||||||
|
|
||||||
$torrent = $transmission->add($content, true);
|
$transmission->add($content, true);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
unlink($outputFile);
|
unlink($outputFile);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue