mirror of
https://github.com/simon-ding/polaris.git
synced 2026-05-29 22:18:08 +08:00
fix: check files
This commit is contained in:
@@ -105,6 +105,8 @@ func (s *Server) checkAllFiles() {
|
|||||||
func (s *Server) checkFileExists(series *ent.Series) error{
|
func (s *Server) checkFileExists(series *ent.Series) error{
|
||||||
log.Infof("check files in directory: %s", series.TargetDir)
|
log.Infof("check files in directory: %s", series.TargetDir)
|
||||||
st := s.db.GetStorage(series.StorageID)
|
st := s.db.GetStorage(series.StorageID)
|
||||||
|
|
||||||
|
targetDir := filepath.Join(st.GetPath(), series.TargetDir)
|
||||||
var storageImpl storage.Storage
|
var storageImpl storage.Storage
|
||||||
|
|
||||||
switch st.Implementation {
|
switch st.Implementation {
|
||||||
@@ -124,9 +126,9 @@ func (s *Server) checkFileExists(series *ent.Series) error{
|
|||||||
}
|
}
|
||||||
storageImpl = storageImpl1
|
storageImpl = storageImpl1
|
||||||
}
|
}
|
||||||
files, err := storageImpl.ReadDir(series.TargetDir)
|
files, err := storageImpl.ReadDir(targetDir)
|
||||||
if err != nil {
|
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]+")
|
numRe := regexp.MustCompile("[0-9]+")
|
||||||
epRe := regexp.MustCompile("E[0-9]+")
|
epRe := regexp.MustCompile("E[0-9]+")
|
||||||
|
|||||||
Reference in New Issue
Block a user