vid-queue/app/Commands/TraktWatch.php
2023-03-22 20:39:09 -05:00

22 lines
601 B
PHP

<?php
namespace App\Commands;
use App\Data\WatchFile;
use App\Data\WatchData;
use App\Services\Trakt;
class TraktWatch extends Command
{
protected $signature = 'show:watch {file : File to watch}';
protected $description = 'Mark a show as watched right now on Trakt';
public function handle(): int
{
$file = WatchFile::from($this->argument('file'));
$data = WatchData::from(['rawData' => [$file->toArray()]]);
$resp = $this->app->make(Trakt::class)->syncHistory($data, $this->output);
return $resp->ok() ? static::SUCCESS : static::FAILURE;
}
}