mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-11-21 05:53:11 -05:00
Transcoder misc fixes (#1144)
Co-authored-by: Fred Heinecke <fred.heinecke@yahoo.com>
This commit is contained in:
parent
84fcbbbb42
commit
b1723c2f2c
@ -88,17 +88,13 @@ func (s *MetadataService) extractSubs(ctx context.Context, info *MediaInfo) (err
|
|||||||
}
|
}
|
||||||
|
|
||||||
workdir := filepath.Join(os.TempDir(), info.Sha)
|
workdir := filepath.Join(os.TempDir(), info.Sha)
|
||||||
if err := os.MkdirAll(workdir, 0660); err != nil {
|
|
||||||
return fmt.Errorf("failed to create temporary directory: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
attDir := filepath.Join(workdir, "att")
|
attDir := filepath.Join(workdir, "att")
|
||||||
if err := os.MkdirAll(attDir, 0660); err != nil {
|
if err := os.MkdirAll(attDir, 0770); err != nil {
|
||||||
return fmt.Errorf("failed to create attachment directory: %w", err)
|
return fmt.Errorf("failed to create attachment directory: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
subDir := filepath.Join(workdir, "sub")
|
subDir := filepath.Join(workdir, "sub")
|
||||||
if err := os.MkdirAll(subDir, 0660); err != nil {
|
if err := os.MkdirAll(subDir, 0770); err != nil {
|
||||||
return fmt.Errorf("failed to create subtitles directory: %w", err)
|
return fmt.Errorf("failed to create subtitles directory: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,10 @@ func (r *RunLock[K, V]) Start(key K) (func() (V, error), func(val V, err error)
|
|||||||
task, ok := r.running[key]
|
task, ok := r.running[key]
|
||||||
|
|
||||||
if ok {
|
if ok {
|
||||||
ret := make(chan Result[V])
|
// Important: Buffer this so that listener notifications are not blocked
|
||||||
|
// when the job completes. Without a buffered channel, the "set" function
|
||||||
|
// can get hung if any one of the listeners does not read from the channel.
|
||||||
|
ret := make(chan Result[V], 1)
|
||||||
task.listeners = append(task.listeners, ret)
|
task.listeners = append(task.listeners, ret)
|
||||||
return func() (V, error) {
|
return func() (V, error) {
|
||||||
res := <-ret
|
res := <-ret
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user