[add] tests, [add] refactor epub feat

This commit is contained in:
2023-10-23 20:18:16 -04:00
parent bf6ac96376
commit b5d5e4bd64
17 changed files with 429 additions and 353 deletions

View File

@@ -58,13 +58,10 @@ func GetWordCount(filepath string) (int64, error) {
}
if fileExtension := fileMime.Extension(); fileExtension == ".epub" {
rc, err := OpenEPUBReader(filepath)
totalWords, err := countEPUBWords(filepath)
if err != nil {
return 0, err
}
rf := rc.Rootfiles[0]
totalWords := rf.CountWords()
return totalWords, nil
} else {
return 0, errors.New("Invalid Extension")