Group all unplayable torrents in a separate directory

This commit is contained in:
Ben Sarmiento
2024-01-06 21:58:10 +01:00
parent 9f94a9bb09
commit 4b441ce2d8
5 changed files with 24 additions and 11 deletions

View File

@@ -13,7 +13,8 @@ import (
)
const (
ALL_TORRENTS = "__all__"
ALL_TORRENTS = "__all__"
UNPLAYABLE_TORRENTS = "__unplayable__"
)
func loadV1Config(content []byte, log *logutil.Logger) (*ZurgConfigV1, error) {
@@ -30,13 +31,14 @@ func (z *ZurgConfigV1) GetVersion() string {
}
func (z *ZurgConfigV1) GetDirectories() []string {
rootDirectories := make([]string, len(z.Directories)+1)
rootDirectories := make([]string, len(z.Directories)+2)
i := 0
for directory := range z.Directories {
rootDirectories[i] = directory
i++
}
rootDirectories[i] = ALL_TORRENTS
rootDirectories[i+1] = UNPLAYABLE_TORRENTS
return rootDirectories
}
@@ -74,6 +76,7 @@ func (z *ZurgConfigV1) GetGroupMap() map[string][]string {
temp := make([]string, len(v))
copy(temp, v)
result[k] = temp
// result[k] = append(result[k], UNPLAYABLE_TORRENTS)
}
result[ALL_TORRENTS] = []string{ALL_TORRENTS} // Add special group for all torrents