Фикс игнорирования флагов -f/-u/-c при наличии playlists.ini
This commit is contained in:
@@ -53,26 +53,28 @@ func PrepareListsToCheck(files []string, urls []string, codes []string) []playli
|
||||
}
|
||||
}
|
||||
|
||||
ini, err := inifile.Init(app.Args.IniPath)
|
||||
if err != nil {
|
||||
log.Printf("Warning: %s, all --code flags will be ignored\n", err)
|
||||
return lists
|
||||
}
|
||||
|
||||
if len(codes) > 0 {
|
||||
for _, plsCode := range codes {
|
||||
list := ini.Lists[plsCode]
|
||||
if list.Url == "" {
|
||||
log.Printf("Warning: playlist [%s] not found in ini-file, skipping\n", plsCode)
|
||||
continue
|
||||
}
|
||||
lists = append(lists, list)
|
||||
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)
|
||||
return lists
|
||||
}
|
||||
} else {
|
||||
lists = slices.Collect(maps.Values(ini.Lists))
|
||||
if int(app.Args.RandomCount) > 0 && int(app.Args.RandomCount) <= len(lists) {
|
||||
rand.Shuffle(len(lists), func(i int, j int) { lists[i], lists[j] = lists[j], lists[i] })
|
||||
lists = lists[:app.Args.RandomCount]
|
||||
|
||||
if len(codes) > 0 {
|
||||
for _, plsCode := range codes {
|
||||
list := ini.Lists[plsCode]
|
||||
if list.Url == "" {
|
||||
log.Printf("Warning: playlist [%s] not found in ini-file, skipping\n", plsCode)
|
||||
continue
|
||||
}
|
||||
lists = append(lists, list)
|
||||
}
|
||||
} else {
|
||||
lists = slices.Collect(maps.Values(ini.Lists))
|
||||
if int(app.Args.RandomCount) > 0 && int(app.Args.RandomCount) <= len(lists) {
|
||||
rand.Shuffle(len(lists), func(i int, j int) { lists[i], lists[j] = lists[j], lists[i] })
|
||||
lists = lists[:app.Args.RandomCount]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user