🎉 Start project
This commit is contained in:
commit
c711ed6567
7 changed files with 119 additions and 0 deletions
26
convids/methods.go
Normal file
26
convids/methods.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package convids
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"iter"
|
||||
"slices"
|
||||
)
|
||||
|
||||
func (s Shows) All() iter.Seq[Show] {
|
||||
return slices.Values(s)
|
||||
}
|
||||
|
||||
func (d Data) AllShows(silent bool) iter.Seq[Show] {
|
||||
return func(yield func(Show) bool) {
|
||||
for _, show := range d.Config.Shows {
|
||||
if !silent {
|
||||
fmt.Println("\nChecking", show, "shows\n")
|
||||
}
|
||||
for s := range d.Shows[show].All() {
|
||||
if !yield(s) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
23
convids/models.go
Normal file
23
convids/models.go
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
package convids
|
||||
|
||||
type Data struct {
|
||||
Config Config
|
||||
Shows ShowMap
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
Source string
|
||||
Extensions []string
|
||||
Shows []string
|
||||
}
|
||||
|
||||
type ShowMap map[string]Shows
|
||||
|
||||
type Shows []Show
|
||||
|
||||
type Show struct {
|
||||
Folder string
|
||||
Pattern string
|
||||
Name string
|
||||
Anime bool
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue