vid-queue/app/Commands/TraktWatch.php

23 lines
601 B
PHP
Raw Normal View History

2022-10-29 12:33:22 -05:00
<?php
namespace App\Commands;
use App\Data\WatchFile;
use App\Data\WatchData;
2023-03-22 20:39:09 -05:00
use App\Services\Trakt;
2022-10-29 12:33:22 -05:00
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'));
2023-03-22 20:39:09 -05:00
$data = WatchData::from(['rawData' => [$file->toArray()]]);
$resp = $this->app->make(Trakt::class)->syncHistory($data, $this->output);
2022-10-29 12:33:22 -05:00
2023-03-22 20:39:09 -05:00
return $resp->ok() ? static::SUCCESS : static::FAILURE;
2022-10-29 12:33:22 -05:00
}
}