Skip to content

Commit 7b6a5ab

Browse files
committed
fix: ensure Trakt user is provided
1 parent f968b04 commit 7b6a5ab

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

Diff for: app/Commands/DownloadCommand.php

+10-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class DownloadCommand extends Command
1616
{
1717
/** {@inheritdoc} */
1818
protected $signature = 'download { trakt-user? : Trakt username for the list }
19-
{ list=watchlist : A custom list id or stub }
19+
{ list? : A custom list id or stub }
2020
{ --o|output=./torrents : The directory to output data to }
2121
{ --quality=1080p : The quality to download (720p, 1080p or 3D) }
2222
{ --y|force : Do not prompt about downloading torrents }';
@@ -37,12 +37,17 @@ public function handle(TraktClient $traktClient, YTSClient $ytsClient): void
3737
$this->yts = $ytsClient;
3838

3939
$quality = Quality::tryFrom($this->option('quality')) ?? Quality::Q_1080P;
40+
$username = $this->argument('trakt-user') ?? $this->ask('What is the Trakt username?');
41+
$list = $this->argument('list') ?? $this->ask('What is the list slug or id?', 'watchlist');
42+
43+
if ($username === null) {
44+
$this->components->warn('A Trakt user must be specified');
45+
46+
return;
47+
}
4048

4149
try {
42-
$this->retrieveTraktList(
43-
$this->argument('trakt-user') ?? $this->ask('What is the Trakt username'),
44-
$this->argument('list') ?? $this->ask('What is the list slug or id'),
45-
)->downloadTorrentsFromYts($quality);
50+
$this->retrieveTraktList($username, $list)->downloadTorrentsFromYts($quality);
4651
} catch (\RuntimeException $exception) {
4752
$this->warn($exception->getMessage());
4853

0 commit comments

Comments
 (0)