Przeglądaj źródła

增加更多的输出日志

Minho 7 lat temu
rodzic
commit
5f64530ccf
2 zmienionych plików z 10 dodań i 12 usunięć
  1. 9 9
      converter/converter.go
  2. 1 3
      models/book_result.go

+ 9 - 9
converter/converter.go

@@ -458,15 +458,15 @@ func (this *Converter) convertToEpub() (err error) {
 		filepath.Join(this.OutputPath, "content.epub"),
 		filepath.Join(this.OutputPath, output, "book.epub"),
 	}
-	cmd := exec.Command(ebookConvert, args...)
-
-	if this.Debug {
-		fmt.Println(cmd.Args)
-	}
-	fmt.Println("正在转换EPUB文件", args[0])
-	return cmd.Run()
-
-	//return filetil.CopyFile(filepath.Join(this.OutputPath, "content.epub"),filepath.Join(this.OutputPath, output, "book.epub"))
+	//cmd := exec.Command(ebookConvert, args...)
+	//
+	//if this.Debug {
+	//	fmt.Println(cmd.Args)
+	//}
+	//fmt.Println("正在转换EPUB文件", args[0])
+	//return cmd.Run()
+
+	return filetil.CopyFile(args[0],args[1])
 }
 
 //转成mobi

+ 1 - 3
models/book_result.go

@@ -232,9 +232,7 @@ func (m *BookResult) Converter(sessionId string) (ConvertBookResult, error) {
 		beego.Error("创建目录失败 => ",tempOutputPath,err)
 	}
 
-	defer func(p string) {
-		os.RemoveAll(p)
-	}(tempOutputPath)
+	defer os.RemoveAll(strings.TrimSuffix(tempOutputPath,"source"))
 
 	if filetil.FileExists(pdfpath) && filetil.FileExists(epubpath) && filetil.FileExists(mobipath) && filetil.FileExists(docxpath) {
 		convertBookResult.EpubPath = epubpath