mirror of
https://github.com/fumiama/paper-manager.git
synced 2026-06-04 23:40:24 +08:00
优化analyze
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"image"
|
||||
"io"
|
||||
@@ -23,6 +24,10 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrPaperFileExist = errors.New("paper file exist")
|
||||
)
|
||||
|
||||
// AddFile from lst and copy it to analyzed path.
|
||||
// The para reg must belong to a valid user
|
||||
func (f *FileDatabase) AddFile(lstid int, reg *Regex, istemp bool, progress func(uint)) error {
|
||||
@@ -379,11 +384,14 @@ func (f *FileDatabase) AddFile(lstid int, reg *Regex, istemp bool, progress func
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
lst.Path = filebasepath + file.Class + ".docx"
|
||||
lst.HasntAnalyzed = false
|
||||
lst.Desc = fmt.Sprintf("%s%v%v%v%c卷",
|
||||
file.Class, file.Year, file.Type.FirstSecond(), file.Type.MiddleFinal(), file.Type.AB(),
|
||||
)
|
||||
lst.Path = filebasepath + lst.Desc + ".docx"
|
||||
if utils.IsExist(lst.Path) {
|
||||
return ErrPaperFileExist
|
||||
}
|
||||
dstf, err := os.Create(lst.Path)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user