Фикс игнорирования флагов -f/-u/-c при наличии playlists.ini

This commit is contained in:
2025-05-06 22:52:26 +08:00
parent 9c4f09db81
commit a346d9e2d7
2 changed files with 23 additions and 26 deletions

View File

@@ -53,6 +53,7 @@ func PrepareListsToCheck(files []string, urls []string, codes []string) []playli
}
}
if len(lists) == 0 || len(codes) > 0 {
ini, err := inifile.Init(app.Args.IniPath)
if err != nil {
log.Printf("Warning: %s, all --code flags will be ignored\n", err)
@@ -75,6 +76,7 @@ func PrepareListsToCheck(files []string, urls []string, codes []string) []playli
lists = lists[:app.Args.RandomCount]
}
}
}
return lists
}

View File

@@ -12,7 +12,6 @@ import (
"axenov/iptv-checker/app/logger"
"github.com/spf13/cobra"
"log"
"os"
)
// checkCmd represents the file command
@@ -25,14 +24,10 @@ var checkCmd = &cobra.Command{
files, _ := cmd.Flags().GetStringSlice("file")
urls, _ := cmd.Flags().GetStringSlice("url")
codes, _ := cmd.Flags().GetStringSlice("code")
if len(files) < 1 && len(urls) < 1 && len(codes) < 1 {
log.Println("ERROR: You should provide at least one of --file, --url or --code flags")
os.Exit(2)
}
lists := checker.PrepareListsToCheck(files, urls, codes)
checker.CheckPlaylists(lists)
log.Println("Done!")
},
}