timeout ass to srt
parent
4fbc96b96f
commit
fd7dcafd4e
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"regexp"
|
"regexp"
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Entrypoint(ctx context.Context, p string) error {
|
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) {
|
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"))
|
srt := fmt.Sprintf("%s.srt", strings.TrimSuffix(ass, ".ass"))
|
||||||
if _, err := os.Stat(srt); err == nil {
|
if _, err := os.Stat(srt); err == nil {
|
||||||
return srt, nil
|
return srt, nil
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue