Files
opds-proxy/convert/kepub.go
Evan Buss 85c497f70c feat: kepub conversions
Working *.epub to *.kepub.epub file conversions when
using a Kobo reader. Updated docker file to include
`kepubify` to convert to kepub. If not available the
file is just sent without conversion.
2024-07-08 22:20:25 -04:00

30 lines
485 B
Go

package convert
import (
"os/exec"
"sync"
)
type KepubConverter struct {
mutex sync.Mutex
}
func (kc *KepubConverter) Available() bool {
path, err := exec.LookPath("kepubify")
if err != nil {
return false
}
return path != ""
}
func (kc *KepubConverter) Convert(input string, output string) error {
kc.mutex.Lock()
defer kc.mutex.Unlock()
cmd := exec.Command("kepubify", "-v", "-u", "-o", output, input)
if err := cmd.Run(); err != nil {
return err
}
return nil
}