Leite Vorschaubilder und Filmstufen geschuetzt ab
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
d6ff881e4e
commit
c997eb500c
32 files changed
+979
-68
No files matched your search
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Media;
|
||||
|
||||
class HlsPlaylist
|
||||
{
|
||||
public function rewrite(string $playlist, string $playlistPath, callable $sign): string
|
||||
{
|
||||
$directory = str_replace('\\', '/', dirname($playlistPath));
|
||||
$lines = preg_split("/\r\n|\n|\r/", $playlist) ?: [];
|
||||
$rewritten = [];
|
||||
|
||||
foreach ($lines as $line) {
|
||||
$value = trim($line);
|
||||
|
||||
if ($value === '' || str_starts_with($value, '#')) {
|
||||
$rewritten[] = $line;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$target = str_starts_with($value, 'ableitungen/')
|
||||
? $value
|
||||
: ($directory === '.' ? $value : $directory.'/'.$value);
|
||||
$rewritten[] = $sign($target);
|
||||
}
|
||||
|
||||
return implode("\n", $rewritten)."\n";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user