Compare commits
No commits in common. "75c6ce47e1b1dbe49cbd876d1a9a4488057128ee" and "f4497aef7e088fa0e21e96a2684ed95046c84e87" have entirely different histories.
75c6ce47e1
...
f4497aef7e
6 changed files with 17 additions and 98 deletions
17
Taskfile.yml
17
Taskfile.yml
|
|
@ -36,22 +36,6 @@ tasks:
|
|||
cmds:
|
||||
- go build -o build/ ./cmd/{{.CMD}}
|
||||
|
||||
build-mkflex:
|
||||
desc: Builds the mkflex command
|
||||
sources:
|
||||
- cmd/mkflex/**/*.go
|
||||
- cli/**/*.go
|
||||
- convids/**/*.go
|
||||
- internal/cli/mkflex/**/*.go
|
||||
- mkflex/**/*.go
|
||||
- types/**/*.go
|
||||
generates:
|
||||
- builds/mkflex
|
||||
cmds:
|
||||
- task: cmd-build
|
||||
vars:
|
||||
CMD: mkflex
|
||||
|
||||
build-convids:
|
||||
desc: Builds the convids command
|
||||
sources:
|
||||
|
|
@ -93,7 +77,6 @@ tasks:
|
|||
desc: Installs the mkflex command
|
||||
source:
|
||||
- cmd/mkflex/**/*.go
|
||||
- cli/**/*.go
|
||||
- convids/**/*.go
|
||||
- internal/cli/mkflex/**/*.go
|
||||
- mkflex/**/*.go
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ type Show struct {
|
|||
AlternateName []string `yaml:"alternate_name"`
|
||||
Exact bool
|
||||
Skip bool
|
||||
Quality string
|
||||
}
|
||||
|
||||
re *regexp.Regexp
|
||||
|
|
|
|||
|
|
@ -90,9 +90,6 @@ func getShow(show conutils.Show, sh Series) SeriesGroups {
|
|||
if !show.Flexget.Begin.IsZero() {
|
||||
sh.Begin = show.Flexget.Begin
|
||||
}
|
||||
if show.Flexget.Quality != "" {
|
||||
sh.Quality = show.Flexget.Quality
|
||||
}
|
||||
sh.AlternameName = show.Flexget.AlternateName
|
||||
sh.Exact = show.Flexget.Exact
|
||||
name := cmp.Or(show.Flexget.Name, show.Name, show.Pattern)
|
||||
|
|
|
|||
|
|
@ -1,51 +0,0 @@
|
|||
package types
|
||||
|
||||
import "fmt"
|
||||
|
||||
type IntOrString struct {
|
||||
intVal int
|
||||
strVal string
|
||||
isInt bool
|
||||
}
|
||||
|
||||
func (is *IntOrString) Set(val any) error {
|
||||
switch v := val.(type) {
|
||||
case int:
|
||||
case int8:
|
||||
case int16:
|
||||
case int32:
|
||||
case int64:
|
||||
case uint:
|
||||
case uint8:
|
||||
case uint16:
|
||||
case uint32:
|
||||
is.isInt = true
|
||||
is.intVal = int(v)
|
||||
return nil
|
||||
case string:
|
||||
is.isInt = false
|
||||
is.strVal = v
|
||||
return nil
|
||||
case []byte:
|
||||
is.isInt = false
|
||||
is.strVal = string(v)
|
||||
return nil
|
||||
}
|
||||
|
||||
//nolint:err113 // Temp skip
|
||||
return fmt.Errorf("invalid type: %T", val)
|
||||
}
|
||||
|
||||
func (is IntOrString) IsZero() bool {
|
||||
if is.isInt {
|
||||
return is.intVal == 0
|
||||
}
|
||||
return is.strVal == ""
|
||||
}
|
||||
|
||||
func (is IntOrString) Value() any {
|
||||
if is.isInt {
|
||||
return is.intVal
|
||||
}
|
||||
return is.strVal
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
package types
|
||||
|
||||
import "fmt"
|
||||
|
||||
type TomlTypeError struct {
|
||||
Value any
|
||||
}
|
||||
|
||||
func (te *TomlTypeError) Error() string {
|
||||
return fmt.Sprintf("unsupported type: %T", te.Value)
|
||||
}
|
||||
|
||||
func (is *IntOrString) UnmarshalTOML(val any) error {
|
||||
switch v := val.(type) {
|
||||
case string:
|
||||
is.isInt = false
|
||||
is.strVal = v
|
||||
return nil
|
||||
case int64:
|
||||
is.isInt = true
|
||||
is.intVal = int(v)
|
||||
return nil
|
||||
}
|
||||
return &TomlTypeError{Value: val}
|
||||
}
|
||||
|
|
@ -10,8 +10,17 @@ func (ye *YamlTypeError) Error() string {
|
|||
return ye.Node.Tag + " is not a valid type for this field"
|
||||
}
|
||||
|
||||
type IntOrString struct {
|
||||
intVal int
|
||||
strVal string
|
||||
isInt bool
|
||||
}
|
||||
|
||||
func (is IntOrString) MarshalYAML() (any, error) {
|
||||
return is.Value(), nil
|
||||
if is.isInt {
|
||||
return is.intVal, nil
|
||||
}
|
||||
return is.strVal, nil
|
||||
}
|
||||
|
||||
func (is *IntOrString) UnmarshalYAML(value *yaml.Node) error {
|
||||
|
|
@ -27,3 +36,10 @@ func (is *IntOrString) UnmarshalYAML(value *yaml.Node) error {
|
|||
|
||||
return &YamlTypeError{Node: value}
|
||||
}
|
||||
|
||||
func (is IntOrString) IsZero() bool {
|
||||
if is.isInt {
|
||||
return is.intVal == 0
|
||||
}
|
||||
return is.strVal == ""
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue