mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-10 03:57:39 +08:00
fix local storage
This commit is contained in:
@@ -28,7 +28,7 @@ type LocalStorage struct {
|
|||||||
|
|
||||||
func (l *LocalStorage) Move(src, dest string) error {
|
func (l *LocalStorage) Move(src, dest string) error {
|
||||||
targetDir := filepath.Join(l.dir, dest)
|
targetDir := filepath.Join(l.dir, dest)
|
||||||
os.MkdirAll(targetDir, 0655)
|
os.MkdirAll(filepath.Dir(targetDir), 0655)
|
||||||
err := filepath.Walk(src, func(path string, info fs.FileInfo, err error) error {
|
err := filepath.Walk(src, func(path string, info fs.FileInfo, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ func (s *Server) searchAndDownloadSeasonPackage(seriesId, seasonNum int) (*strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
r1 := res[0]
|
r1 := res[0]
|
||||||
log.Infof("found resource to download: %v", r1)
|
log.Infof("found resource to download: %+v", r1)
|
||||||
|
|
||||||
downloadDir := s.db.GetDownloadDir()
|
downloadDir := s.db.GetDownloadDir()
|
||||||
size := utils.AvailableSpace(downloadDir)
|
size := utils.AvailableSpace(downloadDir)
|
||||||
@@ -99,7 +99,7 @@ func (s *Server) searchAndDownloadSeasonPackage(seriesId, seasonNum int) (*strin
|
|||||||
if series == nil {
|
if series == nil {
|
||||||
return nil, fmt.Errorf("no tv series of id %v", seriesId)
|
return nil, fmt.Errorf("no tv series of id %v", seriesId)
|
||||||
}
|
}
|
||||||
dir := fmt.Sprintf("%s/Season %02d", series.TargetDir, seasonNum)
|
dir := fmt.Sprintf("%s/Season %02d/", series.TargetDir, seasonNum)
|
||||||
|
|
||||||
history, err := s.db.SaveHistoryRecord(ent.History{
|
history, err := s.db.SaveHistoryRecord(ent.History{
|
||||||
MediaID: seriesId,
|
MediaID: seriesId,
|
||||||
@@ -143,14 +143,14 @@ func (s *Server) searchAndDownload(seriesId, seasonNum, episodeNum int) (*string
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
r1 := res[0]
|
r1 := res[0]
|
||||||
log.Infof("found resource to download: %v", r1)
|
log.Infof("found resource to download: %+v", r1)
|
||||||
torrent, err := trc.Download(r1.Magnet, s.db.GetDownloadDir())
|
torrent, err := trc.Download(r1.Magnet, s.db.GetDownloadDir())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "downloading")
|
return nil, errors.Wrap(err, "downloading")
|
||||||
}
|
}
|
||||||
torrent.Start()
|
torrent.Start()
|
||||||
|
|
||||||
dir := fmt.Sprintf("%s/Season %02d", series.TargetDir, seasonNum)
|
dir := fmt.Sprintf("%s/Season %02d/", series.TargetDir, seasonNum)
|
||||||
|
|
||||||
history, err := s.db.SaveHistoryRecord(ent.History{
|
history, err := s.db.SaveHistoryRecord(ent.History{
|
||||||
MediaID: ep.MediaID,
|
MediaID: ep.MediaID,
|
||||||
|
|||||||
Reference in New Issue
Block a user