Skip to content

Commit

Permalink
根目录电视剧不允许以单文件的形式存在
Browse files Browse the repository at this point in the history
  • Loading branch information
fengqi committed Apr 5, 2024
1 parent 010bf54 commit 1745c58
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion shows/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fengqi/kodi-metadata-tmdb-cli/kodi"
"fengqi/kodi-metadata-tmdb-cli/utils"
"fmt"
"github.com/fsnotify/fsnotify"
"io/fs"
"io/ioutil"
"os"
Expand All @@ -15,6 +14,8 @@ import (
"strconv"
"strings"
"time"

"github.com/fsnotify/fsnotify"
)

type Collector struct {
Expand Down Expand Up @@ -184,6 +185,12 @@ func (c *Collector) runWatcher() {
continue
}

// 根目录电视剧不允许以单文件的形式存在
if !fileInfo.IsDir() && utils.InArray(c.config.Collector.ShowsDir, filepath.Dir(event.Name)) {
utils.Logger.WarningF("shows file not allow root: %s", event.Name)
continue
}

// 删除文件夹
if event.Has(fsnotify.Remove) && fileInfo.IsDir() {
utils.Logger.InfoF("removed dir: %s", event.Name)
Expand Down

0 comments on commit 1745c58

Please sign in to comment.