2022-09-15 07:54:28 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Commands;
|
|
|
|
|
|
|
|
|
|
use App\Data\WatchData;
|
2023-03-22 20:39:09 -05:00
|
|
|
use App\Services\Trakt;
|
2022-09-15 07:54:28 -05:00
|
|
|
|
|
|
|
|
class TraktWatchImport extends Command
|
|
|
|
|
{
|
|
|
|
|
protected $signature = 'show:watch:import {files* : JSON files to import}';
|
|
|
|
|
protected $description = 'Once online, sync watches from show:watch:export';
|
|
|
|
|
|
2023-06-22 18:59:19 -05:00
|
|
|
public function handle(Trakt $trakt): int
|
2022-09-15 07:54:28 -05:00
|
|
|
{
|
|
|
|
|
$watched = WatchData::from($this->arguments());
|
2023-06-22 18:59:19 -05:00
|
|
|
$resp = $trakt->syncHistory($watched, $this->output);
|
2022-09-15 07:54:28 -05:00
|
|
|
|
2023-03-22 20:39:09 -05:00
|
|
|
return $resp->ok() ? static::SUCCESS : static::FAILURE;
|
2022-09-15 07:54:28 -05:00
|
|
|
}
|
|
|
|
|
}
|