Доп. статистика в конце проверки плейлистов
This commit is contained in:
20
cmd/check.go
20
cmd/check.go
@@ -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))
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user