timeout ass to srt

main
bel 2025-06-01 10:28:43 -06:00
parent 4fbc96b96f
commit fd7dcafd4e
1 changed files with 4 additions and 0 deletions

View File

@ -12,6 +12,7 @@ import (
"regexp"
"slices"
"strings"
"time"
)
func Entrypoint(ctx context.Context, p string) error {
@ -171,6 +172,9 @@ func BestAssToSRT(ctx context.Context, p string) error {
}
func assToSRT(ctx context.Context, ass string) (string, error) {
ctx, can := context.WithTimeout(ctx, 30*time.Second)
defer can()
srt := fmt.Sprintf("%s.srt", strings.TrimSuffix(ass, ".ass"))
if _, err := os.Stat(srt); err == nil {
return srt, nil