Skip to content

Commit f49a177

Browse files
authored
Merge pull request #138 from shift72/AB#12169-Add-carousel-image-focus-to-film-and-tv-models
Ab#12169 add carousel image focus to film and tv models
2 parents 3c6508c + 3ee8784 commit f49a177

File tree

6 files changed

+33
-1
lines changed

6 files changed

+33
-1
lines changed

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Unreleased
44

5+
### Added
6+
- Carousel Focus to film / tv models.
7+
58
## 0.17.4
69

710
### Changed

kibble/api/films.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ func (f filmV2) mapToModel(serviceConfig models.ServiceConfig, itemIndex models.
171171
Refs: models.FilmRefs{
172172
LetterboxdID: f.Refs.LetterboxdID,
173173
},
174-
Subtitles: f.Subtitles,
174+
Subtitles: f.Subtitles,
175+
CarouselFocus: f.CarouselFocus,
175176
}
176177

177178
film.Images = models.ImageMapToImageSet(film.ImageMap)
@@ -274,6 +275,7 @@ type filmV2 struct {
274275
Genres []string `json:"genres"`
275276
Tags []string `json:"tags"`
276277
Title string `json:"title"`
278+
CarouselFocus string `json:"carousel_focus"`
277279
Slug string `json:"slug"`
278280
FilmID int `json:"film_id"`
279281
ID int `json:"id"`

kibble/api/tv.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ func (t tvSeasonV2) mapToModel(serviceConfig models.ServiceConfig, itemIndex mod
201201
Cast: make([]models.CastMember, 0),
202202
Crew: make([]models.CrewMember, 0),
203203
CustomFields: t.CustomFields,
204+
CarouselFocus: t.CarouselFocus,
204205
}
205206

206207
// map trailers
@@ -373,6 +374,7 @@ type tvSeasonV2 struct {
373374
Overview string `json:"overview"`
374375
PublishingState string `json:"publishing_state"`
375376
Title string `json:"title"`
377+
CarouselFocus string `json:"carousel_focus"`
376378
ShowInfo tvShowV2 `json:"show_info"`
377379
Slug string `json:"slug"`
378380
SeasonNum int `json:"season_num"`

kibble/models/film.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ type Film struct {
5454
CustomFields CustomFields
5555
Refs FilmRefs
5656
Classifications []Classification
57+
CarouselFocus string
5758
}
5859

5960
// FilmCollection - all films

kibble/models/generic_item.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,26 @@ func (i GenericItem) GetTranslatedTitle(T i18n.TranslateFunc, i18nKey string) st
5959
}
6060
return i.Title
6161
}
62+
63+
// get carousel focus
64+
func (i GenericItem) GetCarouselImageFocusArea() string {
65+
switch i.ItemType {
66+
case "film":
67+
if f, ok := i.InnerItem.(Film); ok {
68+
return f.CarouselFocus
69+
}
70+
case "tvseason":
71+
if s, ok := i.InnerItem.(TVSeason); ok {
72+
return s.CarouselFocus
73+
}
74+
case "page":
75+
if p, ok := i.InnerItem.(Page); ok {
76+
return p.CustomFields.GetString("carousel_focus", "")
77+
}
78+
case "bundle":
79+
if b, ok := i.InnerItem.(Bundle); ok {
80+
return b.CustomFields.GetString("carousel_focus", "")
81+
}
82+
}
83+
return ""
84+
}

kibble/models/tv.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ type TVSeason struct {
7979
Recommendations []GenericItem
8080
CustomFields CustomFields
8181
Classifications []Classification
82+
CarouselFocus string
8283
}
8384

8485
// TVShowCollection -

0 commit comments

Comments
 (0)