mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 12:12:00 -06:00
Refactor to use consts instead of string
This commit is contained in:
parent
3dcfbc0fbb
commit
79c3ba2636
3 changed files with 8 additions and 8 deletions
|
|
@ -61,7 +61,7 @@ func (c *Crunchyroll) Browse(options BrowseOptions, limit uint) (s []*Series, m
|
|||
|
||||
for _, item := range jsonBody["items"].([]interface{}) {
|
||||
switch item.(map[string]interface{})["type"] {
|
||||
case "series":
|
||||
case MediaTypeSeries:
|
||||
series := &Series{
|
||||
crunchy: c,
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@ func (c *Crunchyroll) Browse(options BrowseOptions, limit uint) (s []*Series, m
|
|||
}
|
||||
|
||||
s = append(s, series)
|
||||
case "movie_listing":
|
||||
case MediaTypeMovie:
|
||||
movie := &Movie{
|
||||
crunchy: c,
|
||||
}
|
||||
|
|
@ -160,7 +160,7 @@ func (c *Crunchyroll) Search(query string, limit uint) (s []*Series, m []*Movie,
|
|||
item := item.(map[string]interface{})
|
||||
if item["total"].(float64) > 0 {
|
||||
switch item["type"] {
|
||||
case "series":
|
||||
case MediaTypeSeries:
|
||||
for _, series := range item["items"].([]interface{}) {
|
||||
series2 := &Series{
|
||||
crunchy: c,
|
||||
|
|
@ -174,7 +174,7 @@ func (c *Crunchyroll) Search(query string, limit uint) (s []*Series, m []*Movie,
|
|||
|
||||
s = append(s, series2)
|
||||
}
|
||||
case "movie_listing":
|
||||
case MediaTypeMovie:
|
||||
for _, movie := range item["items"].([]interface{}) {
|
||||
movie2 := &Movie{
|
||||
crunchy: c,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ func (c *Crunchyroll) Recommendations(limit uint) (s []*Series, m []*Movie, err
|
|||
|
||||
for _, item := range jsonBody["items"].([]interface{}) {
|
||||
switch item.(map[string]interface{})["type"] {
|
||||
case "series":
|
||||
case MediaTypeSeries:
|
||||
series := &Series{
|
||||
crunchy: c,
|
||||
}
|
||||
|
|
@ -35,7 +35,7 @@ func (c *Crunchyroll) Recommendations(limit uint) (s []*Series, m []*Movie, err
|
|||
}
|
||||
|
||||
s = append(s, series)
|
||||
case "movie_listing":
|
||||
case MediaTypeMovie:
|
||||
movie := &Movie{
|
||||
crunchy: c,
|
||||
}
|
||||
|
|
|
|||
4
video.go
4
video.go
|
|
@ -223,7 +223,7 @@ func (s *Series) Similar(limit uint) (ss []*Series, m []*Movie, err error) {
|
|||
|
||||
for _, item := range jsonBody["items"].([]interface{}) {
|
||||
switch item.(map[string]interface{})["type"] {
|
||||
case "series":
|
||||
case MediaTypeSeries:
|
||||
series := &Series{
|
||||
crunchy: s.crunchy,
|
||||
}
|
||||
|
|
@ -235,7 +235,7 @@ func (s *Series) Similar(limit uint) (ss []*Series, m []*Movie, err error) {
|
|||
}
|
||||
|
||||
ss = append(ss, series)
|
||||
case "movie_listing":
|
||||
case MediaTypeMovie:
|
||||
movie := &Movie{
|
||||
crunchy: s.crunchy,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue