Skip to content

Commit

Permalink
文件路径格式化,解决windows路径分隔符兼容问题
Browse files Browse the repository at this point in the history
  • Loading branch information
fengqi committed Aug 11, 2023
1 parent 5bf1d1e commit b00f475
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
21 changes: 11 additions & 10 deletions kodi/video_library_scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package kodi

import (
"fengqi/kodi-metadata-tmdb-cli/utils"
"path/filepath"
"strings"
"time"
)
Expand All @@ -12,16 +13,16 @@ func (r *JsonRpc) AddScanTask(directory string) {
}

utils.Logger.DebugF("AddScanTask %s", directory)

sources := r.Files.GetSources("video")
if sources == nil {
return
}

for _, item := range sources {
if strings.Contains(directory, item.File) {
directory = item.File
break
if directory != "" {
directory = filepath.Clean(directory)
sources := r.Files.GetSources("video")
if sources != nil {
for _, item := range sources {
if strings.Contains(item.File, directory) {
directory = item.File
break
}
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion music_videos/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"os"
"path/filepath"
"runtime"
"strings"
"time"
)

Expand Down Expand Up @@ -152,7 +153,8 @@ func (c *Collector) videoProcessor(video *MusicVideo) {
_ = video.saveToNfo()
}

kodi.Rpc.AddScanTask(video.Dir)
split := strings.Split(video.BaseDir, "/")
kodi.Rpc.AddScanTask(split[len(split)-1])
}

// 运行扫描器
Expand Down

0 comments on commit b00f475

Please sign in to comment.