fix: check files

This commit is contained in:
Simon Ding
2024-07-14 23:53:47 +08:00
parent fb16157b87
commit ffa94c9357

View File

@@ -105,6 +105,8 @@ func (s *Server) checkAllFiles() {
func (s *Server) checkFileExists(series *ent.Series) error{
log.Infof("check files in directory: %s", series.TargetDir)
st := s.db.GetStorage(series.StorageID)
targetDir := filepath.Join(st.GetPath(), series.TargetDir)
var storageImpl storage.Storage
switch st.Implementation {
@@ -124,9 +126,9 @@ func (s *Server) checkFileExists(series *ent.Series) error{
}
storageImpl = storageImpl1
}
files, err := storageImpl.ReadDir(series.TargetDir)
files, err := storageImpl.ReadDir(targetDir)
if err != nil {
return errors.Wrapf(err, "read dir %s", series.TargetDir)
return errors.Wrapf(err, "read dir %s", targetDir)
}
numRe := regexp.MustCompile("[0-9]+")
epRe := regexp.MustCompile("E[0-9]+")