From 09976591124851d58e6ffb967f94bf526e4032fe Mon Sep 17 00:00:00 2001 From: m3philis Date: Wed, 15 Nov 2023 01:39:30 +0100 Subject: [PATCH] add command to add newly created EPUB to CalibreDB --- createepub/createepub.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/createepub/createepub.go b/createepub/createepub.go index ee4e6d4..9b325cc 100644 --- a/createepub/createepub.go +++ b/createepub/createepub.go @@ -8,6 +8,7 @@ import ( "mangacrawler/mangacrawler" "net/http" "os" + "os/exec" "os/user" "regexp" "strings" @@ -83,6 +84,17 @@ func CreateEpub(mangaPath string, mangaTitle string, mangaId string) { log.Fatal(err) } + fmt.Println("Adding EPUB to calibre DB") + cmd := exec.Command("calibredb", "add", "--automerge", "overwrite", strings.Join([]string{homepath.HomeDir, "mangas/EPUB", mangaTitle + ".epub"}, "/")) + var out strings.Builder + cmd.Stdout = &out + fmt.Println(cmd) + err = cmd.Run() + if err != nil { + log.Fatal(err) + } + fmt.Printf(out.String()) + } func addPages(book *epub.Epub, mangaPath string, bookCss string) *epub.Epub {