Documentation ¶
Index ¶
- type Client
- func (a Client) GetAuthToken(ctx context.Context) (string, error)
- func (c *Client) GetEpisodes(ctx context.Context, key string) ([]Episode, error)
- func (c *Client) GetIdentity(ctx context.Context) (Identity, error)
- func (c *Client) GetLibraries(ctx context.Context) ([]Library, error)
- func (c *Client) GetMovies(ctx context.Context, key string) ([]Movie, error)
- func (c *Client) GetSeasons(ctx context.Context, key string) ([]Season, error)
- func (c *Client) GetSessions(ctx context.Context) ([]Session, error)
- func (c *Client) GetShows(ctx context.Context, key string) ([]Show, error)
- func (a Client) RoundTrip(request *http.Request) (*http.Response, error)
- func (a Client) SetAuthToken(s string)
- type Episode
- type Identity
- type Library
- type Media
- type MediaPart
- type MediaSessionPart
- type MediaSessionPartStream
- type Movie
- type Season
- type Session
- type SessionMedia
- type SessionPlayer
- type SessionStats
- type SessionTranscoder
- type SessionUser
- type Show
- type Timestamp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client calls the Plex APIs
func New ¶
func New(username, password, product, version, url string, roundTripper http.RoundTripper) *Client
func (Client) GetAuthToken ¶
GetAuthToken logs into plex.tv and returns the current authToken.
func (*Client) GetEpisodes ¶ added in v0.3.0
func (*Client) GetIdentity ¶
GetIdentity calls Plex' /identity endpoint. Mainly useful to get the server's version.
func (*Client) GetSeasons ¶ added in v0.3.0
func (*Client) GetSessions ¶
GetSessions retrieves session information from the server.
type Episode ¶ added in v0.3.0
type Episode struct { RatingKey string `json:"ratingKey"` Key string `json:"key"` ParentRatingKey string `json:"parentRatingKey"` GrandparentRatingKey string `json:"grandparentRatingKey"` Guid string `json:"guid"` ParentGuid string `json:"parentGuid"` GrandparentGuid string `json:"grandparentGuid"` Type string `json:"type"` Title string `json:"title"` GrandparentKey string `json:"grandparentKey"` ParentKey string `json:"parentKey"` GrandparentTitle string `json:"grandparentTitle"` ParentTitle string `json:"parentTitle"` ContentRating string `json:"contentRating"` Summary string `json:"summary"` Index int `json:"index"` ParentIndex int `json:"parentIndex"` AudienceRating float64 `json:"audienceRating"` ViewCount int `json:"viewCount"` LastViewedAt Timestamp `json:"lastViewedAt"` Year int `json:"year"` Thumb string `json:"thumb"` Art string `json:"art"` ParentThumb string `json:"parentThumb"` GrandparentThumb string `json:"grandparentThumb"` GrandparentArt string `json:"grandparentArt"` GrandparentTheme string `json:"grandparentTheme"` Duration int `json:"duration"` OriginallyAvailableAt string `json:"originallyAvailableAt"` AddedAt Timestamp `json:"addedAt"` UpdatedAt Timestamp `json:"updatedAt"` AudienceRatingImage string `json:"audienceRatingImage"` Media []Media `json:"Media"` Director []struct { Tag string `json:"tag"` } `json:"Director"` Writer []struct { Tag string `json:"tag"` } `json:"Writer"` Role []struct { Tag string `json:"tag"` } `json:"Role"` }
type Identity ¶
type Identity struct { Size int `json:"size"` Claimed bool `json:"claimed"` MachineIdentifier string `json:"machineIdentifier"` Version string `json:"version"` }
Identity contains the response of Plex's /identity API
type Library ¶ added in v0.3.0
type Library struct { AllowSync bool `json:"allowSync"` Art string `json:"art"` Composite string `json:"composite"` Filters bool `json:"filters"` Refreshing bool `json:"refreshing"` Thumb string `json:"thumb"` Key string `json:"key"` Type string `json:"type"` Title string `json:"title"` Agent string `json:"agent"` Scanner string `json:"scanner"` Language string `json:"language"` Uuid string `json:"uuid"` UpdatedAt Timestamp `json:"updatedAt"` CreatedAt Timestamp `json:"createdAt"` ScannedAt Timestamp `json:"scannedAt"` Content bool `json:"content"` Directory bool `json:"directory"` ContentChangedAt Timestamp `json:"contentChangedAt"` Hidden int `json:"hidden"` Location []struct { Id int `json:"id"` Path string `json:"path"` } `json:"Location"` }
type Media ¶ added in v0.3.0
type Media struct { Id int `json:"id"` Duration int `json:"duration"` Bitrate int `json:"bitrate"` Width int `json:"width"` Height int `json:"height"` AspectRatio float64 `json:"aspectRatio"` AudioChannels int `json:"audioChannels"` AudioCodec string `json:"audioCodec"` VideoCodec string `json:"videoCodec"` VideoResolution string `json:"videoResolution"` Container string `json:"container"` VideoFrameRate string `json:"videoFrameRate"` OptimizedForStreaming int `json:"optimizedForStreaming,omitempty"` AudioProfile string `json:"audioProfile,omitempty"` Has64BitOffsets bool `json:"has64bitOffsets,omitempty"` VideoProfile string `json:"videoProfile"` Part []MediaPart `json:"Part"` }
type MediaPart ¶ added in v0.3.0
type MediaPart struct { Id int `json:"id"` Key string `json:"key"` Duration int `json:"duration"` File string `json:"file"` Size int64 `json:"size"` AudioProfile string `json:"audioProfile,omitempty"` Container string `json:"container"` Has64BitOffsets bool `json:"has64bitOffsets,omitempty"` OptimizedForStreaming bool `json:"optimizedForStreaming,omitempty"` VideoProfile string `json:"videoProfile"` HasThumbnail string `json:"hasThumbnail,omitempty"` }
type MediaSessionPart ¶
type MediaSessionPart struct { AudioProfile string `json:"audioProfile"` ID string `json:"id"` VideoProfile string `json:"videoProfile"` Bitrate int `json:"bitrate"` Container string `json:"container"` Duration int `json:"duration"` Height int `json:"height"` OptimizedForStreaming bool `json:"optimizedForStreaming"` Protocol string `json:"protocol"` Width int `json:"width"` Decision string `json:"decision"` Selected bool `json:"selected"` Stream []MediaSessionPartStream `json:"Stream"` }
MediaSessionPart contains one record in a MediaSession's Part list
type MediaSessionPartStream ¶
type MediaSessionPartStream struct { Bitrate int `json:"bitrate,omitempty"` Codec string `json:"codec"` Default bool `json:"default"` DisplayTitle string `json:"displayTitle"` ExtendedDisplayTitle string `json:"extendedDisplayTitle"` FrameRate float64 `json:"frameRate,omitempty"` Height int `json:"height,omitempty"` ID string `json:"id"` Language string `json:"language"` LanguageCode string `json:"languageCode"` LanguageTag string `json:"languageTag"` StreamType int `json:"streamType"` Width int `json:"width,omitempty"` Decision string `json:"decision"` Location string `json:"location"` AudioChannelLayout string `json:"audioChannelLayout,omitempty"` BitrateMode string `json:"bitrateMode,omitempty"` Channels int `json:"channels,omitempty"` Profile string `json:"profile,omitempty"` SamplingRate int `json:"samplingRate,omitempty"` Selected bool `json:"selected,omitempty"` Title string `json:"title,omitempty"` Container string `json:"container,omitempty"` Format string `json:"format,omitempty"` }
MediaSessionPartStream contains one stream (video, audio, subtitles) in a MediaSession's Part list
type Movie ¶ added in v0.3.0
type Movie struct { RatingKey string `json:"ratingKey"` Key string `json:"key"` Guid string `json:"guid"` Studio string `json:"studio,omitempty"` Type string `json:"type"` Title string `json:"title"` ContentRating string `json:"contentRating,omitempty"` Summary string `json:"summary"` Rating float64 `json:"rating,omitempty"` AudienceRating float64 `json:"audienceRating,omitempty"` ViewCount int `json:"viewCount,omitempty"` LastViewedAt Timestamp `json:"lastViewedAt,omitempty"` Year int `json:"year,omitempty"` Tagline string `json:"tagline,omitempty"` Thumb string `json:"thumb,omitempty"` Art string `json:"art,omitempty"` Duration int `json:"duration"` OriginallyAvailableAt string `json:"originallyAvailableAt,omitempty"` AddedAt Timestamp `json:"addedAt"` UpdatedAt Timestamp `json:"updatedAt"` AudienceRatingImage string `json:"audienceRatingImage,omitempty"` PrimaryExtraKey string `json:"primaryExtraKey,omitempty"` RatingImage string `json:"ratingImage,omitempty"` Media []Media `json:"Media"` Genre []struct { Tag string `json:"tag"` } `json:"Genre,omitempty"` Country []struct { Tag string `json:"tag"` } `json:"Country,omitempty"` Director []struct { Tag string `json:"tag"` } `json:"Director,omitempty"` Writer []struct { Tag string `json:"tag"` } `json:"Writer,omitempty"` Role []struct { Tag string `json:"tag"` } `json:"Role,omitempty"` ChapterSource string `json:"chapterSource,omitempty"` TitleSort string `json:"titleSort,omitempty"` SkipCount int `json:"skipCount,omitempty"` UserRating float64 `json:"userRating,omitempty"` LastRatedAt int `json:"lastRatedAt,omitempty"` }
type Season ¶ added in v0.3.0
type Season struct { RatingKey string `json:"ratingKey"` Key string `json:"key"` ParentRatingKey string `json:"parentRatingKey"` GrandparentRatingKey string `json:"grandparentRatingKey"` Guid string `json:"guid"` ParentGuid string `json:"parentGuid"` GrandparentGuid string `json:"grandparentGuid"` Type string `json:"type"` Title string `json:"title"` GrandparentKey string `json:"grandparentKey"` ParentKey string `json:"parentKey"` GrandparentTitle string `json:"grandparentTitle"` ParentTitle string `json:"parentTitle"` ContentRating string `json:"contentRating"` Summary string `json:"summary"` Index int `json:"index"` ParentIndex int `json:"parentIndex"` AudienceRating float64 `json:"audienceRating"` ViewCount int `json:"viewCount"` LastViewedAt Timestamp `json:"lastViewedAt"` Year int `json:"year"` Thumb string `json:"thumb"` Art string `json:"art"` ParentThumb string `json:"parentThumb"` GrandparentThumb string `json:"grandparentThumb"` GrandparentArt string `json:"grandparentArt"` GrandparentTheme string `json:"grandparentTheme"` Duration int `json:"duration"` OriginallyAvailableAt string `json:"originallyAvailableAt"` AddedAt Timestamp `json:"addedAt"` UpdatedAt Timestamp `json:"updatedAt"` AudienceRatingImage string `json:"audienceRatingImage"` Media []Media `json:"Media"` Director []struct { Tag string `json:"tag"` } `json:"Director"` Writer []struct { Tag string `json:"tag"` } `json:"Writer"` Role []struct { Tag string `json:"tag"` } `json:"Role"` }
type Session ¶
type Session struct { AddedAt int `json:"addedAt"` Art string `json:"art"` AudienceRating float64 `json:"audienceRating"` AudienceRatingImage string `json:"audienceRatingImage"` ContentRating string `json:"contentRating"` Duration int `json:"duration"` GrandparentArt string `json:"grandparentArt"` GrandparentGUID string `json:"grandparentGuid"` GrandparentKey string `json:"grandparentKey"` GrandparentRatingKey string `json:"grandparentRatingKey"` GrandparentTheme string `json:"grandparentTheme"` GrandparentThumb string `json:"grandparentThumb"` GrandparentTitle string `json:"grandparentTitle"` GUID string `json:"guid"` Index int `json:"index"` Key string `json:"key"` LastViewedAt Timestamp `json:"lastViewedAt"` LibrarySectionID string `json:"librarySectionID"` LibrarySectionKey string `json:"librarySectionKey"` LibrarySectionTitle string `json:"librarySectionTitle"` OriginallyAvailableAt string `json:"originallyAvailableAt"` ParentGUID string `json:"parentGuid"` ParentIndex int `json:"parentIndex"` ParentKey string `json:"parentKey"` ParentRatingKey string `json:"parentRatingKey"` ParentThumb string `json:"parentThumb"` ParentTitle string `json:"parentTitle"` Rating float64 `json:"rating"` RatingKey string `json:"ratingKey"` SessionKey string `json:"sessionKey"` Summary string `json:"summary"` Thumb string `json:"thumb"` Title string `json:"title"` Type string `json:"type"` UpdatedAt Timestamp `json:"updatedAt"` ViewOffset int `json:"viewOffset"` Media []SessionMedia `json:"Media"` Director []struct { Filter string `json:"filter"` ID string `json:"id"` Tag string `json:"tag"` } `json:"Director"` Writer []struct { Filter string `json:"filter"` ID string `json:"id"` Tag string `json:"tag"` } `json:"Writer"` Rating2 []struct { Image string `json:"image"` Type string `json:"type"` Value string `json:"value"` } `json:"Rating"` Role []struct { Filter string `json:"filter"` ID string `json:"id"` Role string `json:"role"` Tag string `json:"tag"` Thumb string `json:"thumb,omitempty"` } `json:"Role"` User SessionUser `json:"User"` Player SessionPlayer `json:"Player"` Session SessionStats `json:"Session"` TranscodeSession SessionTranscoder `json:"TranscodeSession"` }
Session contains one record in a Sessions
func (Session) GetProgress ¶
GetProgress returns the progress of the session, i.e. how much of the movie / tv episode has been watched. Returns a percentage between 0.0 and 1.0
func (Session) GetTitle ¶
GetTitle returns the title of the movie, tv episode being played. For movies, this is just the title. For TV Shows, it returns the show, season & episode title.
func (Session) GetVideoMode ¶
GetVideoMode returns the session's video mode (transcoding, direct play, etc).
type SessionMedia ¶
type SessionMedia struct { AudioProfile string `json:"audioProfile"` ID string `json:"id"` VideoProfile string `json:"videoProfile"` AudioChannels int `json:"audioChannels"` AudioCodec string `json:"audioCodec"` Bitrate int `json:"bitrate"` Container string `json:"container"` Duration int `json:"duration"` Height int `json:"height"` OptimizedForStreaming bool `json:"optimizedForStreaming"` Protocol string `json:"protocol"` VideoCodec string `json:"videoCodec"` VideoFrameRate string `json:"videoFrameRate"` VideoResolution string `json:"videoResolution"` Width int `json:"width"` Selected bool `json:"selected"` Part []MediaSessionPart `json:"Part"` }
SessionMedia contains one record in a Session's Media list
type SessionPlayer ¶
type SessionPlayer struct { Address string `json:"address"` Device string `json:"device"` MachineIdentifier string `json:"machineIdentifier"` Model string `json:"model"` Platform string `json:"platform"` PlatformVersion string `json:"platformVersion"` Product string `json:"product"` Profile string `json:"profile"` RemotePublicAddress string `json:"remotePublicAddress"` State string `json:"state"` Title string `json:"title"` Version string `json:"version"` Local bool `json:"local"` Relayed bool `json:"relayed"` Secure bool `json:"secure"` UserID int `json:"userID"` }
SessionPlayer contains the player details inside a Session
type SessionStats ¶
type SessionStats struct { ID string `json:"id"` Bandwidth int `json:"bandwidth"` Location string `json:"location"` }
SessionStats contains the session details inside a Session
type SessionTranscoder ¶
type SessionTranscoder struct { Key string `json:"key"` Throttled bool `json:"throttled"` Complete bool `json:"complete"` Progress float64 `json:"progress"` Size int `json:"size"` Speed float64 `json:"speed"` Error bool `json:"error"` Duration int `json:"duration"` Context string `json:"context"` SourceVideoCodec string `json:"sourceVideoCodec"` SourceAudioCodec string `json:"sourceAudioCodec"` VideoDecision string `json:"videoDecision"` AudioDecision string `json:"audioDecision"` SubtitleDecision string `json:"subtitleDecision"` Protocol string `json:"protocol"` Container string `json:"container"` VideoCodec string `json:"videoCodec"` AudioCodec string `json:"audioCodec"` AudioChannels int `json:"audioChannels"` TranscodeHwRequested bool `json:"transcodeHwRequested"` TranscodeHwFullPipeline bool `json:"transcodeHwFullPipeline"` TimeStamp float64 `json:"timeStamp"` }
SessionTranscoder contains the transcoder details inside a Session. If the session doesn't transcode any media streams, all fields will be blank.
type SessionUser ¶
type SessionUser struct { ID string `json:"id"` Thumb string `json:"thumb"` Title string `json:"title"` }
SessionUser contains the user details inside a Session
type Show ¶ added in v0.3.0
type Show struct { RatingKey string `json:"ratingKey"` Key string `json:"key"` Guid string `json:"guid"` Studio string `json:"studio"` Type string `json:"type"` Title string `json:"title"` ContentRating string `json:"contentRating"` Summary string `json:"summary"` Index int `json:"index"` AudienceRating float64 `json:"audienceRating"` ViewCount int `json:"viewCount,omitempty"` LastViewedAt Timestamp `json:"lastViewedAt,omitempty"` Year int `json:"year"` Thumb string `json:"thumb"` Art string `json:"art"` Theme string `json:"theme,omitempty"` Duration int `json:"duration"` OriginallyAvailableAt string `json:"originallyAvailableAt"` LeafCount int `json:"leafCount"` ViewedLeafCount int `json:"viewedLeafCount"` ChildCount int `json:"childCount"` AddedAt Timestamp `json:"addedAt"` UpdatedAt Timestamp `json:"updatedAt"` AudienceRatingImage string `json:"audienceRatingImage"` PrimaryExtraKey string `json:"primaryExtraKey,omitempty"` Genre []struct { Tag string `json:"tag"` } `json:"Genre"` Country []struct { Tag string `json:"tag"` } `json:"Country"` Role []struct { Tag string `json:"tag"` } `json:"Role"` SkipCount int `json:"skipCount,omitempty"` Tagline string `json:"tagline,omitempty"` TitleSort string `json:"titleSort,omitempty"` }