vid-queue/app/Commands/TraktWatchExport.php
Dan Jones b7534c01f5 Export watched show based on nfo files
Still a work in progress. But enough to get me going now.
2022-09-13 16:50:10 -05:00

25 lines
660 B
PHP

<?php
namespace App\Commands;
use App\Data\WatchFile;
class TraktWatchExport extends Command
{
protected $signature = 'show:watch:export {file : File to watch}';
protected $description = 'Create a json file to mark watched and import with show:watch:import when online';
public function handle(): int
{
$file = WatchFile::from($this->argument('file'));
$ret = file_put_contents($file->output, $file->toJson());
if ($ret) {
$this->line("Saved to {$file->output}");
} else {
$this->error('Failed to export');
}
return $ret ? static::SUCCESS : static::FAILURE;
}
}