✨ Add current tiem to output filename
This commit is contained in:
parent
d0c3002bf1
commit
5fd2fd103e
1 changed files with 6 additions and 3 deletions
|
|
@ -20,18 +20,21 @@ class ParseWatchFile implements DataPipe
|
|||
{
|
||||
public function handle(mixed $payload, DataClass $class, Collection $properties): Collection
|
||||
{
|
||||
$n = now()->format('U');
|
||||
$properties['watched'] = Carbon::now();
|
||||
$properties['output'] = match ($properties['type']) {
|
||||
Type::Movie => sprintf(
|
||||
'%s-%d.json',
|
||||
'%s-%d-%s.json',
|
||||
Str::slug($properties['showTitle'] ?? uniqid()),
|
||||
$properties['movieYear'],
|
||||
$n,
|
||||
),
|
||||
default => sprintf(
|
||||
'%s-%dx%02d.json',
|
||||
'%s-%dx%02d-%s.json',
|
||||
Str::slug($properties['showTitle'] ?? uniqid()),
|
||||
$properties['season'],
|
||||
$properties['episode']
|
||||
$properties['episode'],
|
||||
$n,
|
||||
),
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue