✨ Export watched show based on nfo files
Still a work in progress. But enough to get me going now.
This commit is contained in:
parent
a4aab55616
commit
b7534c01f5
8 changed files with 183 additions and 1 deletions
30
app/Data/DataPipes/ParseWatchFile.php
Normal file
30
app/Data/DataPipes/ParseWatchFile.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace App\Data\DataPipes;
|
||||
|
||||
use App\Data\FileData;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Collection;
|
||||
use Spatie\LaravelData\DataPipes\DataPipe;
|
||||
use Spatie\LaravelData\Lazy;
|
||||
use Spatie\LaravelData\Optional;
|
||||
use Spatie\LaravelData\Support\DataClass;
|
||||
use Spatie\LaravelData\Support\DataConfig;
|
||||
use Spatie\LaravelData\Support\DataProperty;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ParseWatchFile implements DataPipe
|
||||
{
|
||||
public function handle(mixed $payload, DataClass $class, Collection $properties): Collection
|
||||
{
|
||||
$properties['watched'] = Carbon::now();
|
||||
$properties['output'] = sprintf(
|
||||
'%s-%dx%02d.json',
|
||||
Str::slug($properties['showTitle']),
|
||||
$properties['season'],
|
||||
$properties['episode']
|
||||
);
|
||||
|
||||
return $properties;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue