Documentation ¶
Index ¶
- Constants
- type Album
- type Alias
- type Banner
- type College
- type Credit
- type CurrentAndNext
- type Link
- type List
- type Officer
- type OfficerPosition
- type Officership
- type Photo
- type Podcast
- type Season
- type SelectorInfo
- type Session
- func (s *Session) CreateOrActivateUser(formParams map[string][]string) (user *User, err error)
- func (s *Session) Get(id int) (podcast *Podcast, err error)
- func (s *Session) GetAllAliases(mixins []string) (aliases []Alias, err error)
- func (s *Session) GetAllLists() (lists []List, err error)
- func (s *Session) GetAllOfficerPositions(mixins []string) (positions []OfficerPosition, err error)
- func (s *Session) GetAllPodcasts(numResults int, page int, includeSuspended bool) (podcasts []Podcast, err error)
- func (s *Session) GetAllSeasonsInLatestTerm() (seasons []Season, err error)
- func (s *Session) GetAllShortURLs() (urls []ShortURL, err error)
- func (s *Session) GetAllShowPodcasts(id int) (result []Podcast, err error)
- func (s *Session) GetAllShowSubtypes() (subtypes []ShowSeasonSubtype, err error)
- func (s *Session) GetColleges() (colleges []College, err error)
- func (s *Session) GetCreditsToUsers(id int, isTimeslot bool) (creditsToUsers map[string][]User, err error)
- func (s *Session) GetCurrentAndNext() (can *CurrentAndNext, err error)
- func (s *Session) GetCurrentTeams() (teams []Team, err error)
- func (s *Session) GetCurrentTimeslot() (timeslot Timeslot, err error)
- func (s *Session) GetCurrentTimeslotAtTime(time int) (timeslot Timeslot, err error)
- func (s *Session) GetLiveBanners() (banners []Banner, err error)
- func (s *Session) GetNowPlaying(allowOffAir bool) (Track, error)
- func (s *Session) GetPodcastRSS(id int) (result string, err error)
- func (s *Session) GetPodcastWithShow(id int) (podcast *Podcast, err error)
- func (s *Session) GetPreviousTimeslots(numOfTimeslots int) (timeslots []Timeslot, err error)
- func (s *Session) GetSearchMeta(term string) (shows []ShowMeta, err error)
- func (s *Session) GetSeason(id int) (season Season, err error)
- func (s *Session) GetSeasons(id int) (seasons []Season, err error)
- func (s *Session) GetSelectorInfo() (info *SelectorInfo, err error)
- func (s *Session) GetShow(id int) (show *ShowMeta, err error)
- func (s *Session) GetShowSubtypeByClass(class string) (subtype *ShowSeasonSubtype, err error)
- func (s *Session) GetTeamAssistantHeadPositions(id int, mixins []string) (assHead []Officer, err error)
- func (s *Session) GetTeamHeadPositions(id int, mixins []string) (head []Officer, err error)
- func (s *Session) GetTeamOfficerPositions(id int, mixins []string) (officer []Officer, err error)
- func (s *Session) GetTeamWithOfficers(teamName string) (team Team, err error)
- func (s *Session) GetTimeslot(id int) (timeslot Timeslot, err error)
- func (s *Session) GetTimeslotMetadata(timeslotId uint64, key string) (value string, err error)
- func (s *Session) GetTimeslotsForSeason(id int) (timeslots []Timeslot, err error)
- func (s *Session) GetTrack(trackid uint64) (track *Track, err error)
- func (s *Session) GetTrackAlbum(trackid uint64) (album *Album, err error)
- func (s *Session) GetTrackListForTimeslot(id int) (tracklist []TracklistItem, err error)
- func (s *Session) GetTrackTitle(trackid uint64) (title string, err error)
- func (s *Session) GetUser(id int) (user *User, err error)
- func (s *Session) GetUserAliases() ([]UserAlias, error)
- func (s *Session) GetUserBio(id int) (bio string, err error)
- func (s *Session) GetUserName(id int) (name string, err error)
- func (s *Session) GetUserOfficerships(id int) (officerships []Officership, err error)
- func (s *Session) GetUserProfilePhoto(id int) (profilephoto Photo, err error)
- func (s *Session) GetUserShowCredits(id int) (shows []ShowMeta, err error)
- func (s *Session) GetUsers(l *List) (users []User, err error)
- func (s *Session) GetWeekSchedule(year, week int) (map[int][]Timeslot, error)
- func (s *Session) LogShortURLClick(id uint, userAgent, ipAddress string) error
- func (s *Session) OptIn(UserID int, ListID int) (err error)
- func (s *Session) PutMessage(id uint64, msg string) (err error)
- type ShortURL
- type Show
- type ShowMeta
- type ShowSeasonSubtype
- type Team
- type Time
- type Timeslot
- type Track
- type TracklistItem
- type User
- type UserAlias
Constants ¶
const ( // Values for the current selection/where it was selected from SelectorStudio1 = 1 SelectorStudio2 = 2 SelectorJukebox = 3 SelectorOffAir = 8 SelectorOB = 4 SelectorAux = 0 SelectorHub = 3 // Values for the selector lock LockOff = 0 LockAux = 1 LockKey = 2 // Values for studio power OnNone = 0 OnS1 = 1 OnS2 = 2 OnBoth = 3 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Album ¶
type Album struct { // ID is the unique database ID of the album. ID uint64 `json:"recordid"` // Title is the title of the track. Title string `json:"title"` // Artist is the primary credited artist of the track. Artist string `json:"artist"` // DateAdded is the date on which the album entered the MyRadio library. DateAdded string `json:"date_added"` // DateReleased is the date on which the album was released. DateReleased string `json:"date_released"` // LastModified is the date on which the album was last modified. LastModified string `json:"last_modified"` // CDID is the ID of the CD, if this track comes from one. CDID string `json:"cdid"` // Location is the location of the physical copy of this album, if any. Location string `json:"location"` // ShelfLetter is the shelf on which the physical copy resides, if any. ShelfLetter string `json:"shelf_letter"` // ShelfNumber is the position on the shelf on which the physical copy resides, if any. ShelfNumber uint64 `json:"shelf_number"` // Format is a single-character code identifying the physical format. Format string `json:"format"` // Medium is a single-character code identifying the physical medium. Medium string `json:"media"` // AddingMember is the ID of the member who added this album. AddingMember uint64 `json:"member_add"` // EditingMember is the ID of the member who last modified this album. EditingMember uint64 `json:"member_edit"` // RecordLabel is the record label responsible for this album. RecordLabel string `json:"record_label"` // Status is the digitisation status code for this album. Status string `json:"status"` }
Album contains information about an album in the URY track database.
type Alias ¶
type Alias struct { Id int `json:"alias_id"` Source string Destinations []struct { Atype string `json:"type"` Value *json.RawMessage } }
Alias represents a mail alias.
type Banner ¶
type Banner struct { BannerID int `json:"banner_id"` Alt string `json:"alt"` Target string `json:"target"` URL string `json:"url"` }
Banner represents the key information about banners
type Credit ¶
type Credit struct { Type int `json:"type"` MemberID int `json:"memberid"` User User `json:"User"` }
Credit represents a show credit associating a user with a show.
type CurrentAndNext ¶
CurrentAndNext stores a pair of current and next show.
type Link ¶
type Link struct { Display string `json:"display"` Value interface{} `json:"value"` Title string `json:"title,omitempty"` URL string `json:"url"` }
Link represents a MyRadio action link.
type Officer ¶
type Officer struct { User User `json:"user"` From time.Time FromRaw int64 `json:"from"` MemberOfficerID uint `json:"memberofficerid"` Position OfficerPosition `json:"position"` }
Officer represents information about an officership inside a Team.
type OfficerPosition ¶
type OfficerPosition struct { OfficerID int Name string Alias string Team Team Ordering int Description string Status string Type string Current []User `json:"current,omitempty"` History []struct { User User From time.Time FromRaw int64 `json:"from"` To time.Time ToRaw int64 `json:"to"` MemberOfficerID int } `json:"history,omitempty"` }
OfficerPosition represents a specific station officer position.
type Officership ¶
type Officership struct { OfficerId uint `json:"officerid,string"` OfficerName string `json:"officer_name"` TeamId uint `json:"teamid,string"` FromDateRaw string `json:"from_date,omitempty"` FromDate time.Time TillDateRaw string `json:"till_date,omitempty"` TillDate time.Time }
Officership represents an officership a user holds.
type Photo ¶
type Photo struct { PhotoId uint `json:"photoid"` DateAddedRaw string `json:"date_added"` DateAdded time.Time Format string `json:"format"` Owner uint `json:"owner"` Url string `json:"url"` }
Photo represents a photo of a user.
type Podcast ¶
type Podcast struct { PodcastID int `json:"podcast_id"` Title string Description string Status string Time Time Photo string File string `json:"uri"` EditLink Link `json:"editlink"` MicrositeLink Link `json:"micrositelink"` Show *ShowMeta }
Podcast represents a podcast media item.
type Season ¶
type Season struct { ShowMeta SeasonID int `json:"season_id"` SeasonNum int `json:"season_num"` SubmittedRaw string `json:"submitted"` Submitted time.Time RequestedTime string `json:"requested_time"` FirstTimeRaw string `json:"first_time"` FirstTime time.Time NumEpisodes Link `json:"num_episodes"` AllocateLink Link `json:"allocatelink"` RejectLink Link `json:"rejectlink"` Subtype ShowSeasonSubtype `json:"subtype"` }
Season represents a season in the MyRadio schedule. A MyRadio season contains timeslots.
type SelectorInfo ¶
type SelectorInfo struct { Studio int `json:"studio"` Lock int `json:"lock"` SelectedFrom int `json:"selectedfrom"` Power int `json:"power"` }
SelectorInfo holds data from the /selector/query endpoint
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session represents an open API session.
func MockSession ¶
MockSession creates a new mocked API session returning the JSON message stored in message.
func NewSession ¶
NewSession constructs a new Session with the given API key.
func NewSessionForServer ¶
NewSessionForServer constructs a new Session with the given API key for a non-standard server URL.
func NewSessionFromKeyFile ¶
NewSessionFromKeyFile tries to open a Session with the key from an API key file.
func NewSessionFromKeyFileForServer ¶
NewSessionFromKeyFileForServer tries to open a Session with the key from an API key file, with a non-standard server.
func (*Session) CreateOrActivateUser ¶
CreateOrActivateUser creates oir activates a new myradio user with the given parameters This consumes one API request.
func (*Session) Get ¶
Get retrieves the data for a single podcast from MyRadio given it's ID. This consumes one API request.
func (*Session) GetAllAliases ¶
GetAllAliases retrieves all aliases in use. It takes a list of additional MyRadio API mixins to use when retrieving the aliases. This consumes one API request.
func (*Session) GetAllLists ¶
GetAllLists retrieves all mailing lists in the MyRadio system. This consumes one API request.
func (*Session) GetAllOfficerPositions ¶
func (s *Session) GetAllOfficerPositions(mixins []string) (positions []OfficerPosition, err error)
GetAllOfficerPositions retrieves all officer positions in MyRadio. The amount of detail can be controlled by adding MyRadio mixins. This consumes one API request.
func (*Session) GetAllPodcasts ¶
func (s *Session) GetAllPodcasts(numResults int, page int, includeSuspended bool) (podcasts []Podcast, err error)
GetAllPodcasts retrieves the latest podcasts from MyRadio. This consumes one API request.
func (*Session) GetAllSeasonsInLatestTerm ¶
GetAllSeasonsInLatestTerm gets all seasons in the most recent term. This consumes one API request.
func (*Session) GetAllShortURLs ¶
func (*Session) GetAllShowPodcasts ¶
GetAllShowPodcasts returns all podcasts linked to the given show.
func (*Session) GetAllShowSubtypes ¶
func (s *Session) GetAllShowSubtypes() (subtypes []ShowSeasonSubtype, err error)
GetAllShowSubtypes returns an array of all ShowSeasonSubtypes
func (*Session) GetColleges ¶
GetColleges retrieves a list of all current colleges This consumes one API request.
func (*Session) GetCreditsToUsers ¶
func (s *Session) GetCreditsToUsers(id int, isTimeslot bool) (creditsToUsers map[string][]User, err error)
GetCreditsToUsers retrieves a map of credit names to users. This consumes two API request.
func (*Session) GetCurrentAndNext ¶
func (s *Session) GetCurrentAndNext() (can *CurrentAndNext, err error)
GetCurrentAndNext gets the current and next shows at the time of the call. This consumes one API request.
func (*Session) GetCurrentTeams ¶
GetCurrentTeams retrieves all teams inside the station committee. This consumes one API request.
func (*Session) GetCurrentTimeslot ¶
GetCurrentTimeslot retrieves the current timeslot. This consumes one API request.
func (*Session) GetCurrentTimeslotAtTime ¶
GetCurrentTimeslotAtTime retrieves the current timeslot. This consumes one API request.
func (*Session) GetLiveBanners ¶
GetLiveBanners gets the current live banners and returns a slice of banners
func (*Session) GetNowPlaying ¶
GetNowPlaying returns a Track struct of the currently playing track allowOffAir is for if jukebox should be included even if it is off air This consumes one API request
func (*Session) GetPodcastWithShow ¶
Get retrieves the data for a single podcast, and its associated show. This only consumes one API request.
func (*Session) GetPreviousTimeslots ¶
GetPreviousTimeslots gets the previous shows at the time of the call. This consumes one API request.
func (*Session) GetSearchMeta ¶
GetSearchMeta retrieves all shows whose metadata matches a given search term. This consumes one API request.
func (*Session) GetSeason ¶
GetSeason retrieves the season with the given ID. This consumes one API request.
func (*Session) GetSeasons ¶
GetSeasons retrieves the seasons of the show with the given ID. This consumes one API request.
func (*Session) GetSelectorInfo ¶
func (s *Session) GetSelectorInfo() (info *SelectorInfo, err error)
GetSelectorInfo retrieves the current status of the selector This consumes one API request.
func (*Session) GetShow ¶
GetShow retrieves the show with the given ID. This consumes one API request.
func (*Session) GetShowSubtypeByClass ¶
func (s *Session) GetShowSubtypeByClass(class string) (subtype *ShowSeasonSubtype, err error)
GetShowSubtypeByClass returns a ShowSeasonSubtype based on a given class Can return nil pointer if no subtype found for given class
func (*Session) GetTeamAssistantHeadPositions ¶
func (s *Session) GetTeamAssistantHeadPositions(id int, mixins []string) (assHead []Officer, err error)
GetTeamAssistantHeadPositions retrieves all assistant-head-of-team positions for a given team ID. The amount of detail can be controlled using MyRadio mixins. This consumes one API request.
func (*Session) GetTeamHeadPositions ¶
GetTeamHeadPositions retrieves all head-of-team positions for a given team ID. The amount of detail can be controlled using MyRadio mixins. This consumes one API request.
func (*Session) GetTeamOfficerPositions ¶
GetTeamOfficerPositions retrieves all the other officer positions for a given team ID. The amount of detail can be controlled using MyRadio mixins. This consumes one API request.
func (*Session) GetTeamWithOfficers ¶
GetTeamWithOfficers retrieves a team record with officer information for the given team name. This consumes one API request.
func (*Session) GetTimeslot ¶
GetTimeslot retrieves the timeslot with the given ID. This consumes one API request.
func (*Session) GetTimeslotMetadata ¶
GetTimeslotMetadata gets a metadata key for the timeslot. Be careful. Returns nil err and an empty string if the key does not exist, err if something went wrong.
func (*Session) GetTimeslotsForSeason ¶
GetTimeslotsForSeason retrieves all timeslots for the season with the given ID. This consumes one API request.
func (*Session) GetTrack ¶
GetTrack tries to get the Track with the given ID. Track IDs are unique, so we do not need the record ID. This consumes one API request.
func (*Session) GetTrackAlbum ¶
GetTrackAlbum tries to get the Album of the track with the given ID. This consumes one API request.
func (*Session) GetTrackListForTimeslot ¶
func (s *Session) GetTrackListForTimeslot(id int) (tracklist []TracklistItem, err error)
GetTrackListForTimeslot retrieves the tracklist for the timeslot with the given ID. This consumes one API request.
func (*Session) GetTrackTitle ¶
GetTrackTitle tries to get the title of the track with the given ID. This consumes one API request.
func (*Session) GetUser ¶
GetUser retrieves the User with the given ID. This consumes one API request.
func (*Session) GetUserAliases ¶
GetUserAliases retrieves all aliases associated with the user with the given ID. This consumes one API request.
func (*Session) GetUserBio ¶
GetUserBio retrieves the biography of the user with the given ID. This consumes one API request.
func (*Session) GetUserName ¶
GetUserName retrieves the name of the user with the given ID. This consumes one API request.
func (*Session) GetUserOfficerships ¶
func (s *Session) GetUserOfficerships(id int) (officerships []Officership, err error)
GetUserOfficerships retrieves all officerships held by the user with the given ID. This consumes one API request.
func (*Session) GetUserProfilePhoto ¶
GetUserProfilePhoto retrieves the profile photo of the user with the given ID. This consumes one API request.
func (*Session) GetUserShowCredits ¶
GetUserShowCredits retrieves all show credits associated with the user with the given ID. This consumes one API request.
func (*Session) GetUsers ¶
GetUsers retrieves all users subscribed to a given mailing list. This consumes one API request.
func (*Session) GetWeekSchedule ¶
GetWeekSchedule gets the weekly schedule for ISO 8601 week week of year year. If such a schedule exists, it returns the result as an map from ISO 8601 weekdays to timeslot slices. Thus, 1 maps to Monday's timeslots; 2 to Tuesday; and so on. Each slice progresses chronologically from start of URY day to finish of URY day. If no such schedule exists, it returns a map of empty slices. If an error occurred, this is returned in error, and the timeslot map is undefined. This consumes one API request.
func (*Session) LogShortURLClick ¶
type ShortURL ¶
type ShortURL struct { ShortURLID uint `json:"short_url_id"` Slug string `json:"slug"` RedirectTo string `json:"redirect_to"` }
ShortURL represents the key information of a short URL.
type Show ¶
type Show struct { Title string `json:"title"` Desc string `json:"desc"` Photo string `json:"photo"` StartTime Time `json:"start_time"` EndTime Time `json:"end_time"` // Sometimes "The End of Time" Presenters string `json:"presenters,omitempty"` Url string `json:"url,omitempty"` Id uint64 `json:"id,omitempty"` }
Show contains a summary of information about a URY schedule timeslot.
type ShowMeta ¶
type ShowMeta struct { ShowID int `json:"show_id"` Title string `json:"title"` CreditsString string `json:"credits_string"` Credits []Credit `json:"credits"` Description string `json:"description"` ShowTypeID int `json:"show_type_id"` Season Link `json:"seasons"` EditLink Link `json:"editlink"` ApplyLink Link `json:"applylink"` MicroSiteLink Link `json:"micrositelink"` Photo string `json:"photo"` Subtype ShowSeasonSubtype `json:"subtype"` }
ShowMeta represents a show in the MyRadio schedule. A MyRadio show contains seasons, each containing timeslots. @TODO: Refactor this to something better named
type ShowSeasonSubtype ¶
type ShowSeasonSubtype struct { SubtypeID string `json:"id"` Name string `json:"name"` Class string `json:"class"` Description string `json:"description"` }
ShowSeasonSubtype gives information about an available show subtype
type Team ¶
type Team struct { TeamID uint `json:"teamid"` Name string `json:"name"` Alias string `json:"alias"` Ordering uint `json:"ordering"` Description string `json:"description"` Status string `json:"status"` Officers []Officer `json:"officers"` }
Team represents a station committee team.
type Time ¶
Time is a custom time wrapper
func (*Time) UnmarshalJSON ¶
UnmarshalJSON a method to convert myradio times to unit time stamps
type Timeslot ¶
type Timeslot struct { Season TimeslotID uint64 `json:"timeslot_id"` TimeslotNum int `json:"timeslot_num"` Tags []string `json:"tags"` Time Time `json:"time"` StartTime time.Time StartTimeRaw string `json:"start_time"` Duration time.Duration DurationRaw string `json:"duration"` MixcloudStatus string `json:"mixcloud_status"` }
Timeslot contains information about a single timeslot in the URY schedule. A timeslot is a single slice of time on the schedule, typically one hour long.
type Track ¶
type Track struct { // ID is the unique database ID of the track. ID uint64 `json:"trackid"` // Title is the title of the track. Title string `json:"title"` // Artist is the primary credited artist of the track. Artist string `json:"artist"` // Type is the type ('central' etc.) of the track. Type string `json:"type"` // Length is the length of the track, in hours:minutes:seconds. Length string `json:"length"` // Intro is length of the track's intro, in seconds. Intro uint64 `json:"intro"` // IsClean is true if this track is clean (no expletives). IsClean bool `json:"clean"` // IsDigitised is true if this track is available in the playout system. IsDigitised bool `json:"digitised"` }
Track contains information about a track in the URY track database.
func (*Track) GetAlbum ¶
GetAlbum tries to get the Album for the given Track. This consumes one API request.
func (*Track) IntroUsec ¶
IntroUsec returns the track's intro in microseconds. This consumes no API requests.
func (*Track) LengthSec ¶
LengthSec returns the track's length in seconds. Returns an error if the track's length is ill-formed. This consumes no API requests.
func (*Track) LengthUsec ¶
LengthUsec returns the track's length in microseconds. This is not precise, as it is derived from the length in seconds. Consider estimating the correct length from the track file itself. Returns an error if the track's length is ill-formed. This consumes no API requests.
type TracklistItem ¶
type TracklistItem struct { Track Album Album `json:"album"` EditLink Link `json:"editlink"` DeleteLink Link `json:"deletelink"` Time time.Time TimeRaw int64 `json:"time"` StartTime time.Time StartTimeRaw string `json:"starttime"` AudioLogID uint `json:"audiologid"` }
TracklistItem represents a single item in a show tracklist.