From b00f4759a68a28265f4be0b20a5527d05ff70760 Mon Sep 17 00:00:00 2001 From: fengqi Date: Sat, 5 Aug 2023 14:14:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=8C=96=EF=BC=8C=E8=A7=A3=E5=86=B3windows=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E5=88=86=E9=9A=94=E7=AC=A6=E5=85=BC=E5=AE=B9=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kodi/video_library_scan.go | 21 +++++++++++---------- music_videos/collector.go | 4 +++- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/kodi/video_library_scan.go b/kodi/video_library_scan.go index 7e09185..370242e 100644 --- a/kodi/video_library_scan.go +++ b/kodi/video_library_scan.go @@ -2,6 +2,7 @@ package kodi import ( "fengqi/kodi-metadata-tmdb-cli/utils" + "path/filepath" "strings" "time" ) @@ -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 + } + } } } diff --git a/music_videos/collector.go b/music_videos/collector.go index afa5969..8f70789 100644 --- a/music_videos/collector.go +++ b/music_videos/collector.go @@ -9,6 +9,7 @@ import ( "os" "path/filepath" "runtime" + "strings" "time" ) @@ -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]) } // 运行扫描器