Доп. статистика в конце проверки плейлистов

This commit is contained in:
2025-05-07 01:17:25 +08:00
parent 77c646d1f1
commit dcf91c86d9
2 changed files with 24 additions and 11 deletions

View File

@@ -10,8 +10,11 @@ import (
"axenov/iptv-checker/app"
"axenov/iptv-checker/app/checker"
"axenov/iptv-checker/app/logger"
"encoding/json"
"fmt"
"github.com/spf13/cobra"
"log"
"time"
)
// checkCmd represents the file command
@@ -26,8 +29,21 @@ var checkCmd = &cobra.Command{
codes, _ := cmd.Flags().GetStringSlice("code")
lists := checker.PrepareListsToCheck(files, urls, codes)
checker.CheckPlaylists(lists)
log.Println("Done!")
startTime := time.Now()
onlineCount, offlineCount := checker.CheckPlaylists(lists)
log.Printf(
"Done! count=%d online=%d offline=%d elapsedTime=%.2fs\n",
len(lists),
onlineCount,
offlineCount,
time.Since(startTime).Seconds(),
)
if app.Args.NeedJson {
marshal, _ := json.Marshal(lists)
fmt.Println(string(marshal))
}
},
}