This commit is contained in:
2026-05-30 09:24:42 +08:00
parent 6c3de4b2ef
commit 6cef7b6da3
15 changed files with 520 additions and 68 deletions
+11 -5
View File
@@ -44,18 +44,20 @@ var checkCmd = &cobra.Command{
)
}
ch := checker.NewChecker(app.Args.TagsPath)
var lists []playlist.Playlist
if len(files) == 0 && len(urls) == 0 && len(codes) == 0 {
lists = checker.PrepareListsToCheck(files, urls, codes)
lists = ch.PrepareListsToCheck(files, urls, codes)
} else {
if currentIteration == 1 {
lists = checker.PrepareListsToCheck(files, urls, codes)
lists = ch.PrepareListsToCheck(files, urls, codes)
}
}
if len(lists) > 0 {
startTime := time.Now()
onlineCount, offlineCount := checker.CheckPlaylists(lists)
onlineCount, offlineCount := ch.CheckPlaylists(lists)
log.Printf(
"Done! count=%d online=%d offline=%d elapsedTime=%.2fs\n",
@@ -66,8 +68,12 @@ var checkCmd = &cobra.Command{
)
if app.Args.NeedJson {
marshal, _ := json.Marshal(lists)
fmt.Println(string(marshal))
marshal, err := json.Marshal(lists)
if err != nil {
log.Printf("Error marshaling results: %s", err)
} else {
fmt.Println(string(marshal))
}
}
} else {
log.Println("There are no playlists to check")