Skip to content

Commit 06e5a85

Browse files
committed
chore: remove unnecessary property
1 parent 45d4f41 commit 06e5a85

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

Diff for: app/Commands/DownloadCommand.php

+7-10
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@
1111
use Illuminate\Support\Facades\File;
1212
use LaravelZero\Framework\Commands\Command;
1313
use Symfony\Component\Console\Output\OutputInterface;
14-
use function Termwind\render;
1514

1615
class DownloadCommand extends Command
1716
{
1817
/** {@inheritdoc} */
1918
protected $signature = 'download { trakt-user? : Trakt username for the list }
20-
{ --l|list=watchlist : A custom list id or stub }
19+
{ list=watchlist : A custom list id or stub }
2120
{ --o|output=./torrents : The directory to output data to }
2221
{ --quality=1080p : The quality to download (720p, 1080p or 3D) }
2322
{ --y|force : Do not prompt about downloading torrents }';
@@ -28,8 +27,6 @@ class DownloadCommand extends Command
2827
/** @var Collection<Movie> */
2928
private Collection $traktList;
3029

31-
private Quality $quality;
32-
3330
private TraktClient $trakt;
3431

3532
private YTSClient $yts;
@@ -39,13 +36,13 @@ public function handle(TraktClient $traktClient, YTSClient $ytsClient): void
3936
$this->trakt = $traktClient;
4037
$this->yts = $ytsClient;
4138

42-
$this->quality = Quality::tryFrom($this->option('quality')) ?? Quality::Q_1080P;
39+
$quality = Quality::tryFrom($this->option('quality')) ?? Quality::Q_1080P;
4340

4441
try {
4542
$this->retrieveTraktList(
4643
$this->argument('trakt-user') ?? $this->ask('What is the Trakt username'),
47-
$this->option('list') ?? $this->ask('What is the list slug or id'),
48-
)->downloadTorrentsFromYts();
44+
$this->argument('list') ?? $this->ask('What is the list slug or id'),
45+
)->downloadTorrentsFromYts($quality);
4946
} catch (\RuntimeException $exception) {
5047
$this->warn($exception->getMessage());
5148

@@ -83,7 +80,7 @@ private function downloadTorrentsFromYts(): void
8380
continue;
8481
}
8582

86-
if (! $ytsListing = $this->yts->getMovieByImdbId($movie->imdbId, $this->quality)) {
83+
if (! $ytsListing = $this->yts->getMovieByImdbId($movie->imdbId, $quality)) {
8784
$this->components->warn(
8885
"'{$movie->title} ({$movie->year})': Not found on YTS",
8986
OutputInterface::VERBOSITY_VERBOSE
@@ -103,12 +100,12 @@ private function downloadTorrentsFromYts(): void
103100

104101
/** @var Torrent $matchedTorrent */
105102
$matchedTorrent = $ytsListing->torrents
106-
->filter(fn (Torrent $torrent) => $torrent->quality instanceof $this->quality)
103+
->filter(fn (Torrent $torrent) => $torrent->quality === $quality)
107104
->first();
108105

109106
if (! $matchedTorrent) {
110107
$this->components->warn(
111-
" ↳ '{$movie->title} ({$movie->year})': No torrent available in '{$this->quality->value}' quality",
108+
" ↳ '{$movie->title} ({$movie->year})': No torrent available in '{$quality->value}' quality",
112109
OutputInterface::VERBOSITY_VERBOSE
113110
);
114111

Diff for: app/Exceptions/Handler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function renderForConsole($output, Throwable $e): void
1919
}
2020

2121
if ($e instanceof TraktToYTSException) {
22-
render(view('error', ['message' => $e->getMessage()])->render());
22+
render(view('error', ['message' => $e->getMessage()])->render());
2323

2424
return;
2525
}

0 commit comments

Comments
 (0)