forked from Ivasoft/opds-proxy
fix: single conversion at a time
See the notes for a full explanation, but basically Kobo is making simultaneous requests and the files were conflicting because there were 2 being downloaded / converted at the same time which resulted in unreliable behavior. The solution is to protect the conversion section to allow a single conversion to complete before allowing the next one to start.
This commit is contained in:
@@ -2,7 +2,6 @@ package convert
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
@@ -26,8 +25,7 @@ func (kc *KepubConverter) Convert(input string) (string, error) {
|
||||
kc.mutex.Lock()
|
||||
defer kc.mutex.Unlock()
|
||||
|
||||
dir := filepath.Dir(input)
|
||||
kepubFile := filepath.Join(dir, strings.Replace(filepath.Base(input), ".epub", ".kepub.epub", 1))
|
||||
kepubFile := strings.Replace(input, ".epub", ".kepub.epub", 1)
|
||||
|
||||
cmd := exec.Command("kepubify", "-v", "-u", "-o", kepubFile, input)
|
||||
if err := cmd.Run(); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user