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

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

@@ -13,8 +13,6 @@ import (
"axenov/iptv-checker/app/tagfile"
"axenov/iptv-checker/app/utils"
"crypto/tls"
"encoding/json"
"fmt"
"io"
"log"
"maps"
@@ -82,8 +80,8 @@ func PrepareListsToCheck(files []string, urls []string, codes []string) []playli
}
// CheckPlaylists проверяет плейлисты и возвращает их же с результатами проверки
func CheckPlaylists(lists []playlist.Playlist) {
step := 0
func CheckPlaylists(lists []playlist.Playlist) (int, int) {
step, onlineCount, offlineCount := 0, 0, 0
count := len(lists)
tagBlocks = tagfile.Init(app.Args.TagsPath)
@@ -115,12 +113,14 @@ func CheckPlaylists(lists []playlist.Playlist) {
}
if err != nil {
log.Printf("Cannot read playlist [%s]: %s", pls.Url, err)
log.Printf("Cannot read playlist [%s]: %s\n", pls.Url, err)
offlineCount++
continue
}
log.Println("Parsing content...")
pls.IsOnline = true
onlineCount++
pls = pls.Parse()
log.Printf("Parsed, checking channels (%d)...\n", len(pls.Channels))
@@ -129,10 +129,7 @@ func CheckPlaylists(lists []playlist.Playlist) {
lists[idx] = pls
}
if app.Args.NeedJson {
marshal, _ := json.Marshal(lists)
fmt.Println(string(marshal))
}
return onlineCount, offlineCount
}
// CheckChannels проверяет каналы и возвращает их же с результатами проверки