Documentation ¶
Index ¶
- type FAQ
- type GetInvolvedModel
- type IndexModel
- type MessageModel
- type Model
- type ModelInterface
- type OnDemandModel
- type PeopleModel
- type PodcastModel
- type ScheduleItem
- func MakeScheduleSlice(c structs.SustainerConfig, start, finish time.Time, slots []myradio.Timeslot, ...) ([]*ScheduleItem, error)
- func NewSustainerItem(c structs.SustainerConfig, start, finish time.Time) *ScheduleItem
- func NewTimeslotItem(t *myradio.Timeslot, finish time.Time, ...) (*ScheduleItem, error)
- type ScheduleModel
- type SearchModel
- type ShortURLModel
- type ShowInfo
- type ShowModel
- func (m *ShowModel) GetPodcastRSS(id int) (string, error)
- func (m *ShowModel) GetSeason(id int) (season myradio.Season, timeslots []myradio.Timeslot, err error)
- func (m *ShowModel) GetShow(id int) (show *ShowInfo, err error)
- func (m *ShowModel) GetTimeslot(id int) (timeslot myradio.Timeslot, tracklist []myradio.TracklistItem, ...)
- type SignUpModel
- type TeamModel
- type WeekSchedule
- type WeekScheduleCell
- type WeekScheduleCol
- type WeekScheduleRow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FAQ ¶
type FAQ struct { FAQs []struct { Question string `toml:"question"` Answer string `toml:"answer"` SeeMore string `toml:"seemore"` } `toml:"faqs"` }
FAQ contains all the FAQ objects, containing a question and an answer
type GetInvolvedModel ¶
type GetInvolvedModel struct {
Model
}
GetInvolvedModel is the model for getting data for the getinvolved controller
func NewGetInvolvedModel ¶
func NewGetInvolvedModel(s *myradio.Session) *GetInvolvedModel
NewGetInvolvedModel returns a new GetInvolvedModel on the MyRadio session s.
func (*GetInvolvedModel) Get ¶
func (m *GetInvolvedModel) Get() (colleges []myradio.College, numTeams int, teamInterestLists map[int]*myradio.Team, faq *FAQ, err error)
Get gets the data required for the GetInvolved controller from MyRadio.
On success, it returns all the current teams, and a map from listID to
the team associated with that list
Otherwise, it returns undefined data and the error causing failure.
type IndexModel ¶
type IndexModel struct {
Model
}
IndexModel is the model for the Index controller.
func NewIndexModel ¶
func NewIndexModel(s *myradio.Session) *IndexModel
NewIndexModel returns a new IndexModel on the MyRadio session s.
func (*IndexModel) Get ¶
func (m *IndexModel) Get() (currentAndNext *myradio.CurrentAndNext, banners []myradio.Banner, teams []myradio.Team, podcasts []myradio.Podcast, showOnAir bool, err error)
Get gets the data required for the Index controller from MyRadio.
On success, it returns the current and next show, and nil. Otherwise, it returns undefined data and the error causing failure.
type MessageModel ¶
type MessageModel struct {
Model
}
MessageModel is the model that takes the response from sending a message
func NewMessageModel ¶
func NewMessageModel(s *myradio.Session) *MessageModel
NewMessageModel returns a new MessageModel
func (*MessageModel) Put ¶
func (m *MessageModel) Put(msg string) (err error)
Put PUTs the given message to the current show
On success, it returns nil Otherwise, it returns the error causing failure.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the base type of models in the 2016site architecture.
Each model wraps the MyRadio API to provide the data required for a controller.
type ModelInterface ¶
type ModelInterface interface {
Get() (data *interface{}, err error) // @TODO: Refactor this to a more appropriate name
}
ModelInterface is the interface to which models adhere.
type OnDemandModel ¶
type OnDemandModel struct {
Model
}
OnDemandModel is the model for the OnDemand controller.
func NewOnDemandModel ¶
func NewOnDemandModel(s *myradio.Session) *OnDemandModel
NewOnDemandModel returns a new OnDemandModel on the MyRadio session s.
func (*OnDemandModel) GetLastMixcloudTimeslots ¶
func (m *OnDemandModel) GetLastMixcloudTimeslots() (timeslots []myradio.Timeslot, err error)
GetLastMixcloudTimeslots gets the data required for the OnDemand controller from MyRadio.
On success, it returns the previous 10/11 timeslots, and nil. Otherwise, it returns undefined data and the error causing failure.
type PeopleModel ¶
type PeopleModel struct {
Model
}
PeopleModel is the model for the People controller.
func NewPeopleModel ¶
func NewPeopleModel(s *myradio.Session) *PeopleModel
NewPeopleModel returns a new PeopleModel on the MyRadio session s.
func (*PeopleModel) Get ¶
func (m *PeopleModel) Get(id int) (user *myradio.User, officerships []myradio.Officership, credits []myradio.ShowMeta, currentAndNext *myradio.CurrentAndNext, err error)
Get gets the data required for the People controller from MyRadio.
On success, it returns the users name, bio, a list of officerships, their photo if they have one and nil Otherwise, it returns undefined data and the error causing failure.
type PodcastModel ¶
type PodcastModel struct {
Model
}
PodcastModel is the model for the Podcast controller.
func NewPodcastModel ¶
func NewPodcastModel(s *myradio.Session) *PodcastModel
NewPodcastModel returns a new PodcastModel on the MyRadio session s.
func (*PodcastModel) Get ¶
func (m *PodcastModel) Get(id int) (podcast *myradio.Podcast, err error)
Get gets the data required for the Podcast controller from MyRadio.
func (*PodcastModel) GetAllPodcasts ¶
GetAllPodcasts gets the data required for the Podcast controller from MyRadio.
On success, it returns the podcasts and nil Otherwise, it returns undefined data and the error causing failure.
type ScheduleItem ¶
type ScheduleItem struct { // Name is the display name of the schedule item. Name string // Desc is the description of the schedule item. Desc string // Start is the start time of the schedule item. Start time.Time // Finish is the finish time of the schedule item. Finish time.Time // Block is the block name of the schedule item. Block string // PageURL is the root-relative URL to this schedule item's page, // or "" if there is no URL. PageURL string }
ScheduleItem contains information about one item in a URY schedule.
func MakeScheduleSlice ¶
func MakeScheduleSlice(c structs.SustainerConfig, start, finish time.Time, slots []myradio.Timeslot, tbuilder func(*myradio.Timeslot, time.Time) (*ScheduleItem, error)) ([]*ScheduleItem, error)
MakeScheduleSlice converts a slice of Timeslots to a slice of ScheduleItems. It does so by filling in any gaps between the start time and the first show, the final show and the finish time, and any two shows. Any overlaps are resolved by truncating the timeslot finish time, and dropping it if this makes the timeslot disappear. It expects a constructor function for lifting Timeslots (and overlap-adjusted finish times) to TimeslotItems. It will return an error if any two shows overlap. It presumes the timeslot slice is already sorted in chronological order.
func NewSustainerItem ¶
func NewSustainerItem(c structs.SustainerConfig, start, finish time.Time) *ScheduleItem
NewSustainerItem creates a new sustainer schedule item lasting from start to finish. It takes a sustainer config, c, to work out the sustainer name.
func NewTimeslotItem ¶
func NewTimeslotItem(t *myradio.Timeslot, finish time.Time, u func(*myradio.Timeslot) (*url.URL, error)) (*ScheduleItem, error)
NewTimeslotItem converts a myradio.Timeslot into a TimeslotItem. It accepts a separate finish time to account for any truncating that occurs when resolving overlaps.
func (*ScheduleItem) IsSustainer ¶
func (s *ScheduleItem) IsSustainer() bool
IsSustainer checks whether this schedule item is the URY sustainer.
type ScheduleModel ¶
type ScheduleModel struct {
Model
}
ScheduleModel is the model for the schedule controllers.
func NewScheduleModel ¶
func NewScheduleModel(s *myradio.Session) *ScheduleModel
NewScheduleModel returns a new ScheduleModel on the MyRadio session s.
func (*ScheduleModel) GetCurrentAndNext ¶
func (m *ScheduleModel) GetCurrentAndNext() (*myradio.CurrentAndNext, error)
GetCurrentAndNext retrieves the data for the current and next show
func (*ScheduleModel) WeekSchedule ¶
func (m *ScheduleModel) WeekSchedule(year, week int, sustainerConfig structs.SustainerConfig, timeslotURLBuilder func(*myradio.Timeslot) (*url.URL, error)) (*WeekSchedule, error)
WeekSchedule gets the week schedule with ISO-8601 year year and week number week. It also takes sustainer configuration, and a function to use for generating timeslot URLs. On success, it returns the fully tabulated WeekSchedule for the given week. Otherwise, it returns undefined data and the error causing failure.
type SearchModel ¶
type SearchModel struct {
Model
}
SearchModel is the model for the Search controller.
func NewSearchModel ¶
func NewSearchModel(s *myradio.Session) *SearchModel
NewSearchModel returns a new SearchModel on the MyRadio session s.
func (*SearchModel) Get ¶
func (m *SearchModel) Get(term string) ([]myradio.ShowMeta, error)
Get gets the data required for the Search controller from MyRadio.
term is the string term to search for. This is currently a show search.
On success, it returns the search results, and nil. Otherwise, it returns undefined data and the error causing failure.
type ShortURLModel ¶
type ShortURLModel struct {
// contains filtered or unexported fields
}
func NewShortURLsModel ¶
func NewShortURLsModel(c *structs.Config, s *myradio.Session) *ShortURLModel
func (*ShortURLModel) Match ¶
func (m *ShortURLModel) Match(slug string) *myradio.ShortURL
func (*ShortURLModel) TrackClick ¶
func (*ShortURLModel) UpdateTimer ¶
func (m *ShortURLModel) UpdateTimer()
type ShowInfo ¶
type ShowInfo struct { Show *myradio.ShowMeta Seasons []myradio.Season CreditsToUsers map[string][]myradio.User Podcasts []myradio.Podcast }
type ShowModel ¶
type ShowModel struct {
Model
}
ShowModel is the model for the Show controller.
func NewShowModel ¶
func NewShowModel(s *myradio.Session) *ShowModel
NewShowModel returns a new ShowModel on the MyRadio session s.
func (*ShowModel) GetSeason ¶
func (m *ShowModel) GetSeason(id int) (season myradio.Season, timeslots []myradio.Timeslot, err error)
GetSeason gets the show season with season ID id.
On success, it returns the season information, timeslots and nil. Otherwise, it returns undefined data and the error causing the failure.
func (*ShowModel) GetShow ¶
GetShow gets the show with show ID id.
On success, it returns the show's metadata, season list, and nil. Otherwise, it returns undefined data and the error causing failure.
func (*ShowModel) GetTimeslot ¶
func (m *ShowModel) GetTimeslot(id int) (timeslot myradio.Timeslot, tracklist []myradio.TracklistItem, creditsToUsers map[string][]myradio.User, err error)
GetTimeslot gets the timeslot with ID id.
On success, it returns the timeslot information, the tracklist and nil. Otherwise, it returns undefined data and the error causing the failure.
type SignUpModel ¶
type SignUpModel struct {
Model
}
SignUpModel is the model for getting team data
func NewSignUpModel ¶
func NewSignUpModel(s *myradio.Session) *SignUpModel
NewSignUpModel returns a new SignUpModel on the MyRadio session s.
type TeamModel ¶
type TeamModel struct {
Model
}
TeamModel is the model for the Team controller.
func NewTeamModel ¶
func NewTeamModel(s *myradio.Session) *TeamModel
NewTeamModel returns a new TeamModel on the MyRadio session s.
func (*TeamModel) Get ¶
func (m *TeamModel) Get(alias string) (team myradio.Team, heads []myradio.Officer, assistants []myradio.Officer, officers []myradio.Officer, err error)
Get gets the data required for the Team controller from MyRadio.
On success, it returns the users name, bio, a list of officerships, their photo if they have one and nil Otherwise, it returns undefined data and the error causing failure.
type WeekSchedule ¶
type WeekSchedule struct { // Dates enumerates the dates this week schedule covers. Dates []time.Time // Table is the actual week table. // If there is no schedule for the given week, this will be nil. Table []WeekScheduleCol }
WeekSchedule is the type of week schedules.
type WeekScheduleCell ¶
type WeekScheduleCell struct { // Number of rows this cell spans. // If 0, this is a continuation from a cell further up. RowSpan uint // Pointer to the timeslot in this cell, if any. // Will be nil if 'RowSpan' is 0. Item *ScheduleItem // Hour stores which hour (row) the cell is in Hour int // Minute stores the minute for this row Minute int }
WeekScheduleCell represents one cell in the week schedule.
type WeekScheduleCol ¶
type WeekScheduleCol struct { // The day of the show. Day time.Time // The cells inside this row. Cells []WeekScheduleCell }
WeekScheduleCol represents one day in the week schedule.
type WeekScheduleRow ¶
type WeekScheduleRow struct { // The hour of the row (0..23). Hour int // The minute of the show (0..59). Minute int // The cells inside this row. Cells []WeekScheduleCell }
WeekScheduleRow represents one row in the week schedule.