vid-queue/app/Commands/TraktWatch.php

23 lines
589 B
PHP
Raw Permalink 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';
2023-06-22 18:59:19 -05:00
public function handle(Trakt $trakt): int
2022-10-29 12:33:22 -05:00
{
$file = WatchFile::from($this->argument('file'));
2023-03-22 20:39:09 -05:00
$data = WatchData::from(['rawData' => [$file->toArray()]]);
2023-06-22 18:59:19 -05:00
$resp = $trakt->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
}
}