mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-04 00:47:43 +08:00
fix: local storage
This commit is contained in:
@@ -36,11 +36,11 @@ func (l *LocalStorage) Move(src, dest string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "relation between %s and %s", src, path)
|
return errors.Wrapf(err, "relation between %s and %s", src, path)
|
||||||
}
|
}
|
||||||
destName := filepath.Join(targetDir, rel, info.Name())
|
destName := filepath.Join(targetDir, rel)
|
||||||
|
|
||||||
if info.IsDir() {
|
if info.IsDir() {
|
||||||
|
|
||||||
if err := os.Mkdir(destName, 0666); err != nil {
|
if err := os.Mkdir(destName, 0655); err != nil {
|
||||||
return errors.Wrapf(err, "mkdir %v", destName)
|
return errors.Wrapf(err, "mkdir %v", destName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ func (s *Server) moveCompletedTask(id int) (err1 error) {
|
|||||||
seasonNum = -1
|
seasonNum = -1
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err1 != nil {
|
||||||
s.db.SetHistoryStatus(r.ID, history.StatusFail)
|
s.db.SetHistoryStatus(r.ID, history.StatusFail)
|
||||||
if r.EpisodeID != 0 {
|
if r.EpisodeID != 0 {
|
||||||
s.db.SetEpisodeStatus(r.EpisodeID, episode.StatusMissing)
|
s.db.SetEpisodeStatus(r.EpisodeID, episode.StatusMissing)
|
||||||
@@ -100,8 +100,7 @@ func (s *Server) moveCompletedTask(id int) (err1 error) {
|
|||||||
}
|
}
|
||||||
storageImpl, err := storage.NewWebdavStorage(ws.URL, ws.User, ws.Password, targetPath)
|
storageImpl, err := storage.NewWebdavStorage(ws.URL, ws.User, ws.Password, targetPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err1 = errors.Wrap(err, "new webdav")
|
return errors.Wrap(err, "new webdav")
|
||||||
return
|
|
||||||
}
|
}
|
||||||
stImpl = storageImpl
|
stImpl = storageImpl
|
||||||
|
|
||||||
@@ -114,8 +113,8 @@ func (s *Server) moveCompletedTask(id int) (err1 error) {
|
|||||||
|
|
||||||
storageImpl, err := storage.NewLocalStorage(targetPath)
|
storageImpl, err := storage.NewLocalStorage(targetPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err1 = errors.Wrap(err, "new storage")
|
return errors.Wrap(err, "new storage")
|
||||||
return
|
|
||||||
}
|
}
|
||||||
stImpl = storageImpl
|
stImpl = storageImpl
|
||||||
|
|
||||||
@@ -123,14 +122,14 @@ func (s *Server) moveCompletedTask(id int) (err1 error) {
|
|||||||
if r.EpisodeID == 0 {
|
if r.EpisodeID == 0 {
|
||||||
//season package download
|
//season package download
|
||||||
if err := stImpl.Move(filepath.Join(s.db.GetDownloadDir(), torrent.Name()), r.TargetDir); err != nil {
|
if err := stImpl.Move(filepath.Join(s.db.GetDownloadDir(), torrent.Name()), r.TargetDir); err != nil {
|
||||||
err1 = errors.Wrap(err, "move file")
|
return errors.Wrap(err, "move file")
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if err := stImpl.Move(filepath.Join(s.db.GetDownloadDir(), torrent.Name()), filepath.Join(r.TargetDir, torrent.Name())); err != nil {
|
if err := stImpl.Move(filepath.Join(s.db.GetDownloadDir(), torrent.Name()), filepath.Join(r.TargetDir, torrent.Name())); err != nil {
|
||||||
err1 = errors.Wrap(err, "move file")
|
return errors.Wrap(err, "move file")
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user