Documentation
¶
Index ¶
- Constants
- Variables
- type Country
- type Director
- type GUID
- type Genre
- type LibrarySection
- type Media
- type MediaPart
- type MediaStream
- type Player
- type Producer
- type Role
- type Server
- func (s *Server) GetPlexSectionKey(keyPath string) (*LibrarySection, error)
- func (s *Server) GetSessions() ([]*Session, error)
- func (s *Server) GetSessionsWithContext(ctx context.Context) ([]*Session, error)
- func (s *Server) GetXMLSessions() (*Sessions, error)
- func (s *Server) HandleKillSession(r *http.Request) (int, interface{})
- func (s *Server) HandleSessions(r *http.Request) (int, interface{})
- func (s *Server) KillSession(sessionID, reason string) error
- func (s *Server) KillSessionWithContext(ctx context.Context, sessionID, reason string) error
- func (s *Server) Validate() error
- type Session
- type Sessions
- type Similar
- type Transcode
- type User
- type Webhook
- type Writer
Constants ¶
View Source
const Plex apps.App = "plex"
View Source
const WaitTime = 10 * time.Second
WaitTime is the recommended wait time to pull plex sessions after a webhook.
Variables ¶
View Source
var ErrBadStatus = fmt.Errorf("status code not 200")
View Source
var ErrNoURLToken = fmt.Errorf("token or URL for Plex missing")
Functions ¶
This section is empty.
Types ¶
type LibrarySection ¶
type LibrarySection struct { Size int `json:"size"` AllowSync bool `json:"allowSync"` Identifier string `json:"identifier"` LibrarySectionID int `json:"librarySectionID"` LibrarySectionTitle string `json:"librarySectionTitle"` LibrarySectionUUID string `json:"librarySectionUUID"` MediaTagPrefix string `json:"mediaTagPrefix"` MediaTagVersion int `json:"mediaTagVersion"` Metadata []struct { RatingKey string `json:"ratingKey"` Key string `json:"key"` ParentRatingKey string `json:"parentRatingKey,omitempty"` GrandparentRatingKey string `json:"grandparentRatingKey,omitempty"` GUID string `json:"guid"` ParentGUID string `json:"parentGuid,omitempty"` GrandparentGUID string `json:"grandparentGuid,omitempty"` Type string `json:"type"` Title string `json:"title"` GrandparentKey string `json:"grandparentKey,omitempty"` ParentKey string `json:"parentKey,omitempty"` LibrarySectionTitle string `json:"librarySectionTitle"` LibrarySectionID int `json:"librarySectionID"` LibrarySectionKey string `json:"librarySectionKey"` GrandparentTitle string `json:"grandparentTitle,omitempty"` ParentTitle string `json:"parentTitle,omitempty"` ContentRating string `json:"contentRating"` Summary string `json:"summary"` Index int `json:"index,omitempty"` ParentIndex int `json:"parentIndex,omitempty"` Rating int `json:"rating,omitempty"` Year int `json:"year,omitempty"` Thumb string `json:"thumb"` Art string `json:"art"` ParentThumb string `json:"parentThumb,omitempty"` GrandparentThumb string `json:"grandparentThumb,omitempty"` GrandparentArt string `json:"grandparentArt,omitempty"` GrandparentTheme string `json:"grandparentTheme,omitempty"` Duration int `json:"duration"` OriginallyAvailableAt string `json:"originallyAvailableAt"` AddedAt int `json:"addedAt"` UpdatedAt int `json:"updatedAt"` 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"` AudioProfile string `json:"audioProfile"` Has64BitOffsets bool `json:"has64bitOffsets"` VideoProfile string `json:"videoProfile"` Part []struct { ID int `json:"id"` Key string `json:"key"` Duration int `json:"duration"` File string `json:"file"` Size int `json:"size"` AudioProfile string `json:"audioProfile"` Container string `json:"container"` Indexes string `json:"indexes"` VideoProfile string `json:"videoProfile"` OptimizedForStreaming bool `json:"optimizedForStreaming"` Has64BitOffsets bool `json:"has64bitOffsets"` Stream []struct { ID int `json:"id"` StreamType int `json:"streamType"` Codec string `json:"codec"` Index int `json:"index"` Bitrate int `json:"bitrate"` BitDepth int `json:"bitDepth,omitempty"` ChromaLocation string `json:"chromaLocation,omitempty"` ChromaSubsampling string `json:"chromaSubsampling,omitempty"` CodedHeight int `json:"codedHeight,omitempty"` CodedWidth int `json:"codedWidth,omitempty"` ColorRange string `json:"colorRange,omitempty"` ColorSpace string `json:"colorSpace,omitempty"` FrameRate float64 `json:"frameRate,omitempty"` Height int `json:"height,omitempty"` Level int `json:"level,omitempty"` Profile string `json:"profile"` RefFrames int `json:"refFrames,omitempty"` StreamIdentifier string `json:"streamIdentifier"` Width int `json:"width,omitempty"` DisplayTitle string `json:"displayTitle"` ExtendedDisplayTitle string `json:"extendedDisplayTitle"` Channels int `json:"channels,omitempty"` Language string `json:"language,omitempty"` LanguageCode string `json:"languageCode,omitempty"` AudioChannelLayout string `json:"audioChannelLayout,omitempty"` SamplingRate int `json:"samplingRate,omitempty"` Selected bool `json:"selected,omitempty"` HasScalingMatrix bool `json:"hasScalingMatrix,omitempty"` Default bool `json:"default"` } `json:"Stream"` } `json:"Part"` } `json:"Media"` TitleSort string `json:"titleSort,omitempty"` ViewOffset int `json:"viewOffset,omitempty"` LastViewedAt int `json:"lastViewedAt,omitempty"` ParentYear int `json:"parentYear,omitempty"` Studio string `json:"studio,omitempty"` AudienceRating float64 `json:"audienceRating,omitempty"` ViewCount int `json:"viewCount,omitempty"` Tagline string `json:"tagline,omitempty"` AudienceRatingImage string `json:"audienceRatingImage,omitempty"` ChapterSource string `json:"chapterSource,omitempty"` PrimaryExtraKey string `json:"primaryExtraKey,omitempty"` RatingImage string `json:"ratingImage,omitempty"` GuID []*GUID `json:"Guid,omitempty"` } `json:"Metadata"` }
type Media ¶
type Media struct { AspectRatio string `json:"aspectRatio"` AudioChannels int `json:"audioChannels,string"` AudioCodec string `json:"audioCodec"` AudioProfile string `json:"audioProfile"` Bitrate int64 `json:"bitrate,string"` Container string `json:"container"` Duration float64 `json:"duration,string"` Height int64 `json:"height,string"` ID string `json:"id"` Protocol string `json:"protocol"` StreamingOptmzd string `json:"optimizedForStreaming"` VideoCodec string `json:"videoCodec"` VideoFrameRate string `json:"videoFrameRate"` VideoProfile string `json:"videoProfile"` VideoResolution string `json:"videoResolution"` Width int64 `json:"width,string"` Selected bool `json:"selected"` Part []*MediaPart `json:"Part"` }
type MediaPart ¶
type MediaPart struct { AudioProfile string `json:"audioProfile"` Bitrate int64 `json:"bitrate,string"` Container string `json:"container"` Decision string `json:"decision"` Duration float64 `json:"duration,string"` File string `json:"file"` Height int64 `json:"height,string"` ID string `json:"id"` Indexes string `json:"indexes"` Key string `json:"key"` Protocol string `json:"protocol"` Selected bool `json:"selected"` Size string `json:"size"` StreamingOptmzd string `json:"optimizedForStreaming"` VideoProfile string `json:"videoProfile"` Width int64 `json:"width,string"` Stream []*MediaStream `json:"Stream"` }
type MediaStream ¶
type MediaStream struct { AudioChannelLayout string `json:"audioChannelLayout,omitempty"` BitDepth string `json:"bitDepth,omitempty"` Bitrate float64 `json:"bitrate,string"` BitrateMode string `json:"bitrateMode,omitempty"` Channels string `json:"channels,omitempty"` ChromaLocation string `json:"chromaLocation,omitempty"` ChromaSubsampling string `json:"chromaSubsampling,omitempty"` Codec string `json:"codec"` CodedHeight string `json:"codedHeight,omitempty"` CodedWidth string `json:"codedWidth,omitempty"` ColorPrimaries string `json:"colorPrimaries,omitempty"` ColorTrc string `json:"colorTrc,omitempty"` Decision string `json:"decision"` Default string `json:"default,omitempty"` DisplayTitle string `json:"displayTitle"` ExtDisplayTitle string `json:"extendedDisplayTitle"` FrameRate float64 `json:"frameRate,omitempty,string"` HasScalingMatrix string `json:"hasScalingMatrix,omitempty"` Height int64 `json:"height,omitempty,string"` ID string `json:"id"` Index string `json:"index"` Language string `json:"language,omitempty"` LanguageCode string `json:"languageCode,omitempty"` Level string `json:"level,omitempty"` Location string `json:"location"` Profile string `json:"profile"` RefFrames string `json:"refFrames,omitempty"` SamplingRate string `json:"samplingRate,omitempty"` ScanType string `json:"scanType,omitempty"` Selected string `json:"selected,omitempty"` StreamType string `json:"streamType"` Width int64 `json:"width,omitempty,string"` }
type Player ¶
type Player struct { Address string `json:"address"` Device string `json:"device"` MachineID string `json:"machineIdentifier"` Model string `json:"model"` Platform string `json:"platform"` PlatformVer string `json:"platformVersion"` Product string `json:"product"` Profile string `json:"profile"` PublicAddr string `json:"remotePublicAddress"` State string `json:"state"` Title string `json:"title"` UserID int64 `json:"userID"` Vendor string `json:"vendor"` Version string `json:"version"` Relayed bool `json:"relayed"` Local bool `json:"local"` Secure bool `json:"secure"` }
type Server ¶
type Server struct { Timeout cnfg.Duration `toml:"timeout" xml:"timeout"` Interval cnfg.Duration `toml:"interval" xml:"interval"` URL string `toml:"url" xml:"url"` Token string `toml:"token" xml:"token"` AccountMap string `toml:"account_map" xml:"account_map"` Name string `toml:"server" xml:"server"` ReturnJSON bool `toml:"return_json" xml:"return_json"` Cooldown cnfg.Duration `toml:"cooldown" xml:"cooldown"` SeriesPC uint `toml:"series_percent_complete" xml:"series_percent_complete"` MoviesPC uint `toml:"movies_percent_complete" xml:"movies_percent_complete"` // contains filtered or unexported fields }
func (*Server) GetPlexSectionKey ¶
func (s *Server) GetPlexSectionKey(keyPath string) (*LibrarySection, error)
func (*Server) GetSessions ¶
func (*Server) GetSessionsWithContext ¶ added in v0.1.5
func (*Server) GetXMLSessions ¶
func (*Server) HandleKillSession ¶ added in v0.1.5
func (*Server) HandleSessions ¶ added in v0.1.5
func (*Server) KillSession ¶ added in v0.1.5
func (*Server) KillSessionWithContext ¶ added in v0.1.5
type Session ¶
type Session struct { User User `json:"User"` Player Player `json:"Player"` TranscodeSession Transcode `json:"TranscodeSession"` Added string `json:"addedAt"` Art string `json:"art"` AudienceRating string `json:"audienceRating"` AudienceRatingImg string `json:"audienceRatingImage"` ContentRating string `json:"contentRating"` Duration float64 `json:"duration,string"` GUID string `json:"guid"` 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"` Index string `json:"index"` Key string `json:"key"` LastViewed int64 `json:"lastViewedAt,string"` LibrarySectionID string `json:"librarySectionID"` LibrarySectionKey string `json:"librarySectionKey"` LibrarySectionTitle string `json:"librarySectionTitle"` OriginallyAvailable string `json:"originallyAvailableAt"` ParentGUID string `json:"parentGuid"` ParentIndex string `json:"parentIndex"` ParentKey string `json:"parentKey"` ParentRatingKey string `json:"parentRatingKey"` ParentThumb string `json:"parentThumb"` ParentTitle string `json:"parentTitle"` PrimaryExtraKey string `json:"primaryExtraKey"` Rating string `json:"rating"` RatingImage string `json:"ratingImage"` RatingKey string `json:"ratingKey"` SessionKey string `json:"sessionKey"` Studio string `json:"studio"` Summary string `json:"summary"` Thumb string `json:"thumb"` Title string `json:"title"` TitleSort string `json:"titleSort"` Type string `json:"type"` Updated int64 `json:"updatedAt,string"` ViewCount string `json:"viewCount"` ViewOffset float64 `json:"viewOffset,string"` Year string `json:"year"` Session struct { Bandwidth int64 `json:"bandwidth"` ID string `json:"id"` Location string `json:"location"` } `json:"Session"` GuID []*GUID `json:"Guid,omitempty"` }
type Transcode ¶
type Transcode struct { AudioChannels int `json:"audioChannels"` AudioCodec string `json:"audioCodec"` AudioDecision string `json:"audioDecision"` Container string `json:"container"` Context string `json:"context"` Duration int64 `json:"duration"` Key string `json:"key"` MaxOffsetAvailable string `json:"maxOffsetAvailable"` MinOffsetAvailable string `json:"minOffsetAvailable"` Progress string `json:"progress"` Protocol string `json:"protocol"` Remaining int64 `json:"remaining"` Size int64 `json:"size"` SourceAudioCodec string `json:"sourceAudioCodec"` SourceVideoCodec string `json:"sourceVideoCodec"` Speed string `json:"speed"` TimeStamp string `json:"timeStamp"` VideoCodec string `json:"videoCodec"` VideoDecision string `json:"videoDecision"` Throttled bool `json:"throttled"` Complete bool `json:"complete"` XcodeHwFullPipeline bool `json:"transcodeHwFullPipeline"` XcodeHwRequested bool `json:"transcodeHwRequested"` }
type Webhook ¶
type Webhook struct { Event string `json:"event"` User bool `json:"user"` Owner bool `json:"owner"` Account struct { ID int `json:"id"` Thumb string `json:"thumb"` Title string `json:"title"` } `json:"Account"` Server struct { Title string `json:"title"` UUID string `json:"uuid"` } `json:"Server"` Player struct { Local bool `json:"local"` PublicAddress string `json:"publicAddress"` Title string `json:"title"` UUID string `json:"uuid"` } `json:"Player"` Metadata struct { LibrarySectionType string `json:"librarySectionType"` RatingKey string `json:"ratingKey"` ParentRatingKey string `json:"parentRatingKey"` GrandparentRatingKey string `json:"grandparentRatingKey"` Key string `json:"key"` GUID string `json:"guid"` ParentGUID string `json:"parentGuid"` GrandparentGUID string `json:"grandparentGuid"` GuID []*GUID `json:"Guid"` Studio string `json:"studio"` Type string `json:"type"` GrandParentTitle string `json:"grandparentTitle"` GrandparentKey string `json:"grandparentKey"` ParentKey string `json:"parentKey"` ParentTitle string `json:"parentTitle"` ParentYear int `json:"parentYear"` ParentThumb string `json:"parentThumb"` GrandparentThumb string `json:"grandparentThumb"` GrandparentArt string `json:"grandparentArt"` GrandparentTheme string `json:"grandparentTheme"` ParentIndex int64 `json:"parentIndex"` Index int64 `json:"index"` Title string `json:"title"` TitleSort string `json:"titleSort"` LibrarySectionTitle string `json:"librarySectionTitle"` LibrarySectionID int `json:"librarySectionID"` LibrarySectionKey string `json:"librarySectionKey"` ContentRating string `json:"contentRating"` Summary string `json:"summary"` Rating float64 `json:"rating"` AudienceRating float64 `json:"audienceRating"` ViewOffset int `json:"viewOffset"` LastViewedAt int `json:"lastViewedAt"` Year int `json:"year"` Tagline string `json:"tagline"` Thumb string `json:"thumb"` Art string `json:"art"` Duration int `json:"duration"` OriginallyAvailableAt string `json:"originallyAvailableAt"` AddedAt int `json:"addedAt"` UpdatedAt int `json:"updatedAt"` AudienceRatingImage string `json:"audienceRatingImage"` PrimaryExtraKey string `json:"primaryExtraKey"` RatingImage string `json:"ratingImage"` } `json:"Metadata"` }
Webhook is the incoming webhook from a Plex Media Server.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.