drafthouse

package
v0.0.0-...-4f2d80d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2018 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSeatChart

func NewSeatChart(cinemaName string, baseUrl string, res SeatResponse) template.HTML

func Service

func Service(routes *echo.Echo, collector *Collector, config *DrafthouseServiceConfig)

Service registers the routes for the drafthouse service

Types

type Area

type Area struct {
	AreaCategoryCode      string  `json:"AreaCategoryCode"`
	ColumnCount           int     `json:"ColumnCount"`
	Description           string  `json:"Description"`
	DescriptionAlt        string  `json:"DescriptionAlt"`
	HasSofaSeatingEnabled bool    `json:"HasSofaSeatingEnabled"`
	Height                float64 `json:"Height"`
	IsAllocatedSeating    bool    `json:"IsAllocatedSeating"`
	Left                  int     `json:"Left"`
	Number                int     `json:"Number"`
	NumberOfSeats         int     `json:"NumberOfSeats"`
	RowCount              int     `json:"RowCount"`
	Rows                  []Row   `json:"Rows"`
	Top                   float64 `json:"Top"`
	Width                 int     `json:"Width"`
}

type AreaCategory

type AreaCategory struct {
	AreaCategoryCode        string        `json:"AreaCategoryCode"`
	IsInSeatDeliveryEnabled bool          `json:"IsInSeatDeliveryEnabled"`
	SeatsAllocatedCount     int           `json:"SeatsAllocatedCount"`
	SeatsNotAllocatedCount  int           `json:"SeatsNotAllocatedCount"`
	SeatsToAllocate         int           `json:"SeatsToAllocate"`
	SelectedSeats           []interface{} `json:"SelectedSeats"`
}

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache is a synchronised map of items that auto-expire once they hit the expiration

func NewCache

func NewCache(duration time.Duration) *Cache

NewCache is a helper to create instance of the Cache struct

func (*Cache) Get

func (cache *Cache) Get(key string) (data interface{}, found bool)

Get is a thread-safe way to lookup items

func (*Cache) Set

func (cache *Cache) Set(key string, data interface{})

Set is a thread-safe way to add new items to the map

func (*Cache) SetWithExpiration

func (cache *Cache) SetWithExpiration(key string, data interface{}, ttl time.Duration)

SetWithExpiration is a thread-safe way to add new items with a specific ttl

type CacheItem

type CacheItem struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

CacheItem represents a value in the cache map

type Chart

type Chart [][]string

type Cinema

type Cinema struct {
	CinemaID          string `json:"CinemaId"`
	CinemaName        string `json:"CinemaName"`
	CinemaTimeZoneATE string `json:"CinemaTimeZoneATE"`
	MarketName        string `json:"MarketName"`
	CinemaSlug        string `json:"CinemaSlug"`
	MarketSlug        string `json:"MarketSlug"`
	Films             []Film `json:"Films"`
}

func (*Cinema) GetFilmNames

func (c *Cinema) GetFilmNames() []string

func (*Cinema) GetFilmSessions

func (c *Cinema) GetFilmSessions(filmSlug string) []FilmSession

func (*Cinema) GetFilmTimes

func (c *Cinema) GetFilmTimes(filmSlug string) []string

func (*Cinema) GetFilms

func (c *Cinema) GetFilms() []SimpleFilm

type Collector

type Collector struct {
	Client     http.Client
	Cache      *Cache
	TMDBClient *tmdb.TMDb
}

func (*Collector) GetFilmMetaData

func (c *Collector) GetFilmMetaData(film *SimpleFilm) *MetaDataResults

func (*Collector) GetFilmSeats

func (c *Collector) GetFilmSeats(film FilmSession) SeatResponse

func (*Collector) GetMarketInfo

func (c *Collector) GetMarketInfo() Market

type Date

type Date struct {
	DateID  string   `json:"DateId"`
	Date    string   `json:"Date"`
	Cinemas []Cinema `json:"Cinemas"`
}

func (*Date) GetCinemas

func (d *Date) GetCinemas() []SimpleCinema

func (*Date) GetFilmNames

func (d *Date) GetFilmNames(cinemaFilter string) []string

func (*Date) GetFilmSessions

func (d *Date) GetFilmSessions(filmSlug string, cinemaFilter string) []FilmSession

func (*Date) GetFilmTimes

func (d *Date) GetFilmTimes(filmSlug string, cinemaFilter string) map[string][]string

func (*Date) GetFilms

func (d *Date) GetFilms(cinemaFilter string) SimpleFilms

type DrafthouseService

type DrafthouseService struct {
	// contains filtered or unexported fields
}

func (*DrafthouseService) HandleGetFilms

func (s *DrafthouseService) HandleGetFilms(c echo.Context) error

HandleGetFilms is the handler for GET /films

func (*DrafthouseService) HandleGetSingleFilm

func (s *DrafthouseService) HandleGetSingleFilm(c echo.Context) error

HandleGetSingleFilm is the handler for GET /film/:film-slug

func (*DrafthouseService) HandleIndex

func (s *DrafthouseService) HandleIndex(c echo.Context) error

HandleIndex is the handler for GET /

func (*DrafthouseService) HandleSeats

func (s *DrafthouseService) HandleSeats(c echo.Context) error

HandleSeats is the handler for POST /seats

type DrafthouseServiceConfig

type DrafthouseServiceConfig struct {
	Index string
	Base  string
}

type Film

type Film struct {
	FilmID        string   `json:"FilmId"`
	FilmName      string   `json:"FilmName"`
	FilmYear      string   `json:"FilmYear"`
	FilmRating    string   `json:"FilmRating"`
	FilmRuntime   string   `json:"FilmRuntime"`
	FilmAgePolicy string   `json:"FilmAgePolicy"`
	FilmSlug      string   `json:"FilmSlug"`
	Series        []Series `json:"Series"`
}

func (*Film) GetFilmSessions

func (f *Film) GetFilmSessions() []FilmSession

func (*Film) GetFilmTimes

func (f *Film) GetFilmTimes() []string

type FilmSession

type FilmSession struct {
	CinemaID        string
	CinemaName      string
	FilmName        string
	FilmYear        string
	FilmSlug        string
	PosterURL       string
	FilmDescription string
	SessionTime     string
	SessionID       string
	SeatChart       template.HTML
}

type Format

type Format struct {
	FormatID   string    `json:"FormatId"`
	FormatName string    `json:"FormatName"`
	Sessions   []Session `json:"Sessions"`
}

type IndexTemplate

type IndexTemplate struct {
	BaseUrl  string
	IndexUrl string
	Dates    []string
	Films    []SimpleFilm
	Cinemas  []SimpleCinema
}

type Market

type Market struct {
	FeedGenerated     string `json:"FeedGenerated"`
	SessionsGenerated string `json:"SessionsGenerated"`
	MarketID          string `json:"MarketId"`
	MarketName        string `json:"MarketName"`
	MarketSlug        string `json:"MarketSlug"`
	Dates             []Date `json:"Dates"`
}

func (*Market) GetCinemas

func (m *Market) GetCinemas() []SimpleCinema

func (*Market) GetDates

func (m *Market) GetDates() []string

func (*Market) GetFilmNames

func (m *Market) GetFilmNames(date time.Time, cinemaFilter string) []string

func (*Market) GetFilmSessions

func (m *Market) GetFilmSessions(filmSlug string, date time.Time, cinemaFilter string) []FilmSession

func (*Market) GetFilmTimes

func (m *Market) GetFilmTimes(filmSlug string, date time.Time, cinemaFilter string) map[string][]string

func (*Market) GetSimpleFilms

func (m *Market) GetSimpleFilms(date time.Time, collector *Collector, cinemaFilter string, preload bool) []SimpleFilm

type MarketResponse

type MarketResponse struct {
	Market Market `json:"Market"`
}

type MetaDataResults

type MetaDataResults struct {
	PosterURL   string
	Description string
}

type Position

type Position struct {
	AreaNumber  int `json:"AreaNumber"`
	ColumnIndex int `json:"ColumnIndex"`
	RowIndex    int `json:"RowIndex"`
}

type ResponseFilms

type ResponseFilms struct {
	Films []SimpleFilm `json:"films"`
}

type ResponseMovieTimes

type ResponseMovieTimes struct {
	Times map[string][]string `json:"times"`
}

type Row

type Row struct {
	PhysicalName string  `json:"PhysicalName"`
	Seats        []Seats `json:"Seats"`
}

type SeatLayoutData

type SeatLayoutData struct {
	AreaCategories []AreaCategory `json:"AreaCategories"`
	Areas          []Area         `json:"Areas"`
	BoundaryLeft   int            `json:"BoundaryLeft"`
	BoundaryRight  int            `json:"BoundaryRight"`
	BoundaryTop    float64        `json:"BoundaryTop"`
	ScreenStart    int            `json:"ScreenStart"`
	ScreenWidth    int            `json:"ScreenWidth"`
}

type SeatPickerTemplate

type SeatPickerTemplate struct {
	BaseUrl  string
	IndexUrl string
	Cinemas  map[string][]FilmSession
}

type SeatResponse

type SeatResponse struct {
	ResponseCode     int            `json:"ResponseCode"`
	SeatLayoutData   SeatLayoutData `json:"SeatLayoutData"`
	ErrorDescription string         `json:"ErrorDescription"`
}

type Seats

type Seats struct {
	ID             string         `json:"Id"`
	OriginalStatus int            `json:"OriginalStatus"`
	Position       Position       `json:"Position"`
	Priority       int            `json:"Priority"`
	SeatStyle      int            `json:"SeatStyle"`
	SeatsInGroup   []SeatsInGroup `json:"SeatsInGroup"`
	Status         int            `json:"Status"`
}

type SeatsInGroup

type SeatsInGroup struct {
	AreaNumber  int `json:"AreaNumber"`
	ColumnIndex int `json:"ColumnIndex"`
	RowIndex    int `json:"RowIndex"`
}

type Series

type Series struct {
	SeriesID   string   `json:"SeriesId"`
	SeriesName string   `json:"SeriesName"`
	Formats    []Format `json:"Formats"`
}

type Session

type Session struct {
	SessionID       string `json:"SessionId"`
	SessionTime     string `json:"SessionTime"`
	SessionStatus   string `json:"SessionStatus"`
	SessionSalesURL string `json:"SessionSalesURL"`
	SessionDateTime string `json:"SessionDateTime"`
	SessionType     string `json:"SessionType"`
	SeatsLeft       string `json:"SeatsLeft"`
	SeatingLow      string `json:"SeatingLow"`
}

type SimpleCinema

type SimpleCinema struct {
	CinemaName string
	CinemaSlug string
}

type SimpleFilm

type SimpleFilm struct {
	FilmName        string `json:"FilmName"`
	FilmSlug        string `json:"FilmSlug"`
	FilmYear        string `json:"FilmYear"`
	FilmID          string `json:"FilmID"`
	FilmPosterURL   string `json:"FilmPosterURL"`
	FilmDescription string `json:"FilmDescription"`
}

type SimpleFilms

type SimpleFilms []SimpleFilm

func (SimpleFilms) Len

func (slice SimpleFilms) Len() int

func (SimpleFilms) Less

func (slice SimpleFilms) Less(i, j int) bool

func (SimpleFilms) Swap

func (slice SimpleFilms) Swap(i, j int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL