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 { func (c *Client) GetSetting(key string) string {
v, err := c.ent.Settings.Query().Where(settings.Key(key)).Only(context.TODO()) v, err := c.ent.Settings.Query().Where(settings.Key(key)).Only(context.TODO())
if err != nil { 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 ""
} }
return v.Value return v.Value

View File

@@ -37,6 +37,7 @@ func (l *LocalStorage) Move(src, destDir string) error {
if info.IsDir() { //如果是路径,则只移动路径里面的文件,不管当前路径, 行为类似 move dirname/* target_dir/ if info.IsDir() { //如果是路径,则只移动路径里面的文件,不管当前路径, 行为类似 move dirname/* target_dir/
targetBase = filepath.Join(l.dir, destDir) 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 { 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, MediaID: m.ID,
EpisodeID: ep.ID, EpisodeID: ep.ID,
SourceTitle: name, SourceTitle: name,
TargetDir: "./", TargetDir: m.TargetDir,
Status: history.StatusRunning, Status: history.StatusRunning,
Size: in.Size, Size: in.Size,
Saved: torrent.Save(), Saved: torrent.Save(),