A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
fix: Subtitle first time load breaks libass Fixes #234
aminnausina45c16809eec
diff --git a/app/Services/Subtitles/SubtitleFormatter.php b/app/Services/Subtitles/SubtitleFormatter.phpindex f5e37c1d..100d24bb 100644--- a/app/Services/Subtitles/SubtitleFormatter.php+++ b/app/Services/Subtitles/SubtitleFormatter.php@@ -3,6 +3,7 @@namespace App\Services\Subtitles;use App\Services\Subtitles\Formats\VttStrategy;+use Illuminate\Support\Facades\Log;use Illuminate\Support\Facades\Storage;class SubtitleFormatter {@@ -15,19 +16,33 @@ class SubtitleFormatter {* @return string Converted file path*/public function convert(string $input, string $output, string $outputFormat): string {- if (! Storage::disk('local')->exists($input)) {- throw new \RuntimeException("Input file not found: {$input}");+ try {+ if (! Storage::disk('local')->exists($input)) {+ throw new \RuntimeException("Input file not found: {$input}");+ }++ if ($input === $output) {+ return Storage::disk('local')->path($input);+ }++ $strategy = $this->matchStrategy($outputFormat);++ $strategy->convert($input, $output);++ if (! Storage::disk('local')->exists($output)) {+ throw new \RuntimeException("Conversion failed: {$output} not created");+ }++ return Storage::disk('local')->path($output);+ } catch (\Throwable $th) {+ Log::error('Subtitle conversion failed.', [+ 'input' => $input,+ 'output' => $output,+ 'outputFormat' => $outputFormat,+ 'error' => $th->getMessage(),+ ]);+ throw $th;}-- $strategy = $this->matchStrategy($outputFormat);-- $strategy->convert($input, $output);-- if (! Storage::disk('local')->exists($output)) {- throw new \RuntimeException("Conversion failed: {$output} not created");- }-- return Storage::disk('local')->path($output);}/**