fix: target dir

This commit is contained in:
Simon Ding
2024-07-30 11:49:42 +08:00
parent b7aeb9c3c6
commit e2bba8ec71
3 changed files with 4 additions and 3 deletions

View File

@@ -98,7 +98,7 @@ func (c *Client) generateDefaultLocalStorage() error {
func (c *Client) GetSetting(key string) string {
v, err := c.ent.Settings.Query().Where(settings.Key(key)).Only(context.TODO())
if err != nil {
log.Warnf("get setting by key: %s error: %v", key, err)
log.Debugf("get setting by key: %s error: %v", key, err)
return ""
}
return v.Value

View File

@@ -37,6 +37,7 @@ func (l *LocalStorage) Move(src, destDir string) error {
if info.IsDir() { //如果是路径,则只移动路径里面的文件,不管当前路径, 行为类似 move dirname/* target_dir/
targetBase = filepath.Join(l.dir, destDir)
}
log.Debugf("local storage target base dir is: %v", targetBase)
err = filepath.Walk(src, func(path string, info fs.FileInfo, err error) error {

View File

@@ -284,7 +284,7 @@ func (s *Server) DownloadTorrent(c *gin.Context) (interface{}, error) {
MediaID: m.ID,
EpisodeID: ep.ID,
SourceTitle: name,
TargetDir: "./",
TargetDir: m.TargetDir,
Status: history.StatusRunning,
Size: in.Size,
Saved: torrent.Save(),
@@ -297,7 +297,7 @@ func (s *Server) DownloadTorrent(c *gin.Context) (interface{}, error) {
s.db.SetEpisodeStatus(ep.ID, episode.StatusDownloading)
}()
s.sendMsg(fmt.Sprintf(message.BeginDownload, in.Name))
log.Infof("success add %s to download task", in.Name)
return in.Name, nil