add command event:fire + fetch imdb when torrent created

This commit is contained in:
xiaomlove
2024-02-23 02:38:42 +08:00
parent 5c6a2b13f9
commit 9efa5b2ae5
12 changed files with 227 additions and 24 deletions
+40
View File
@@ -0,0 +1,40 @@
<?php
namespace App\Console\Commands;
use App\Events\TorrentCreated;
use Illuminate\Console\Command;
class TorrentFetchImdb extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'torrent:fetch_imdb {torrent_id}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Fetch torrent imdb info';
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$torrentId = $this->argument("torrent_id");
$this->info("torrentId: $torrentId");
if (!$torrentId) {
$this->error("require argument torrent_id");
return Command::FAILURE;
}
TorrentCreated::dispatch($torrentId);
return Command::SUCCESS;
}
}