Documentation ¶
Overview ¶
Mediabrowser provides user-related bindings to the Jellyfin & Emby APIs. Some data aren't bound to structs as jfa-go doesn't need to interact with them, for example DisplayPreferences. See Jellyfin/Emby swagger docs for more info on them.
Index ¶
- Constants
- type AuthenticationResult
- type Configuration
- type MediaBrowser
- func (mb *MediaBrowser) Authenticate(username, password string) (User, int, error)
- func (mb *MediaBrowser) DeleteUser(userID string) (int, error)
- func (mb *MediaBrowser) GetDisplayPreferences(userID string) (map[string]interface{}, int, error)
- func (mb *MediaBrowser) GetUsers(public bool) ([]User, int, error)
- func (mb *MediaBrowser) NewUser(username, password string) (User, int, error)
- func (mb *MediaBrowser) SetConfiguration(userID string, configuration Configuration) (int, error)
- func (mb *MediaBrowser) SetDisplayPreferences(userID string, displayprefs map[string]interface{}) (int, error)
- func (mb *MediaBrowser) SetPolicy(userID string, policy Policy) (int, error)
- func (mb *MediaBrowser) UserByID(userID string, public bool) (User, int, error)
- func (mb *MediaBrowser) UserByName(username string, public bool) (User, int, error)
- type Policy
- type ServerInfo
- type SessionInfo
- type Time
- type User
Constants ¶
const ( JellyfinServer serverType = iota EmbyServer )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthenticationResult ¶
type AuthenticationResult struct { User User `json:"User"` AccessToken string `json:"AccessToken"` ServerID string `json:"ServerId"` SessionInfo SessionInfo `json:"SessionInfo"` }
type Configuration ¶
type Configuration struct { PlayDefaultAudioTrack bool `json:"PlayDefaultAudioTrack"` SubtitleLanguagePreference string `json:"SubtitleLanguagePreference"` DisplayMissingEpisodes bool `json:"DisplayMissingEpisodes"` GroupedFolders []interface{} `json:"GroupedFolders"` SubtitleMode string `json:"SubtitleMode"` DisplayCollectionsView bool `json:"DisplayCollectionsView"` EnableLocalPassword bool `json:"EnableLocalPassword"` OrderedViews []interface{} `json:"OrderedViews"` LatestItemsExcludes []interface{} `json:"LatestItemsExcludes"` MyMediaExcludes []interface{} `json:"MyMediaExcludes"` HidePlayedInLatest bool `json:"HidePlayedInLatest"` RememberAudioSelections bool `json:"RememberAudioSelections"` RememberSubtitleSelections bool `json:"RememberSubtitleSelections"` EnableNextEpisodeAutoPlay bool `json:"EnableNextEpisodeAutoPlay"` }
type MediaBrowser ¶
type MediaBrowser struct { Server string ServerInfo ServerInfo Username string Authenticated bool AccessToken string CacheExpiry time.Time Hyphens bool // contains filtered or unexported fields }
MediaBrowser is an api instance of Jellyfin/Emby.
func NewServer ¶
func NewServer(st serverType, server, client, version, device, deviceID string, timeoutHandler common.TimeoutHandler, cacheTimeout int) (*MediaBrowser, error)
NewServer returns a new Mediabrowser object.
func (*MediaBrowser) Authenticate ¶
func (mb *MediaBrowser) Authenticate(username, password string) (User, int, error)
Authenticate attempts to authenticate using a username & password
func (*MediaBrowser) DeleteUser ¶
func (mb *MediaBrowser) DeleteUser(userID string) (int, error)
DeleteUser deletes the user corresponding to the provided ID.
func (*MediaBrowser) GetDisplayPreferences ¶
func (mb *MediaBrowser) GetDisplayPreferences(userID string) (map[string]interface{}, int, error)
GetDisplayPreferences gets the displayPreferences (part of homescreen layout) for the user corresponding to the provided ID.
func (*MediaBrowser) GetUsers ¶
func (mb *MediaBrowser) GetUsers(public bool) ([]User, int, error)
GetUsers returns all (visible) users on the Emby instance.
func (*MediaBrowser) NewUser ¶
func (mb *MediaBrowser) NewUser(username, password string) (User, int, error)
NewUser creates a new user with the provided username and password.
func (*MediaBrowser) SetConfiguration ¶
func (mb *MediaBrowser) SetConfiguration(userID string, configuration Configuration) (int, error)
SetConfiguration sets the configuration (part of homescreen layout) for the user corresponding to the provided ID.
func (*MediaBrowser) SetDisplayPreferences ¶
func (mb *MediaBrowser) SetDisplayPreferences(userID string, displayprefs map[string]interface{}) (int, error)
SetDisplayPreferences sets the displayPreferences (part of homescreen layout) for the user corresponding to the provided ID.
func (*MediaBrowser) SetPolicy ¶
func (mb *MediaBrowser) SetPolicy(userID string, policy Policy) (int, error)
SetPolicy sets the access policy for the user corresponding to the provided ID.
func (*MediaBrowser) UserByName ¶
UserByName returns the user corresponding to the provided username.
type Policy ¶
type Policy struct { IsAdministrator bool `json:"IsAdministrator"` IsHidden bool `json:"IsHidden"` IsDisabled bool `json:"IsDisabled"` BlockedTags []interface{} `json:"BlockedTags"` EnableUserPreferenceAccess bool `json:"EnableUserPreferenceAccess"` AccessSchedules []interface{} `json:"AccessSchedules"` BlockUnratedItems []interface{} `json:"BlockUnratedItems"` EnableRemoteControlOfOtherUsers bool `json:"EnableRemoteControlOfOtherUsers"` EnableRemoteAccess bool `json:"EnableRemoteAccess"` EnableLiveTvManagement bool `json:"EnableLiveTvManagement"` EnableLiveTvAccess bool `json:"EnableLiveTvAccess"` EnableMediaPlayback bool `json:"EnableMediaPlayback"` EnableAudioPlaybackTranscoding bool `json:"EnableAudioPlaybackTranscoding"` EnableVideoPlaybackTranscoding bool `json:"EnableVideoPlaybackTranscoding"` EnablePlaybackRemuxing bool `json:"EnablePlaybackRemuxing"` ForceRemoteSourceTranscoding bool `json:"ForceRemoteSourceTranscoding"` EnableContentDeletion bool `json:"EnableContentDeletion"` EnableContentDeletionFromFolders []interface{} `json:"EnableContentDeletionFromFolders"` EnableContentDownloading bool `json:"EnableContentDownloading"` EnableSyncTranscoding bool `json:"EnableSyncTranscoding"` EnableMediaConversion bool `json:"EnableMediaConversion"` EnabledDevices []interface{} `json:"EnabledDevices"` EnableAllDevices bool `json:"EnableAllDevices"` EnabledChannels []interface{} `json:"EnabledChannels"` EnableAllChannels bool `json:"EnableAllChannels"` EnabledFolders []string `json:"EnabledFolders"` EnableAllFolders bool `json:"EnableAllFolders"` InvalidLoginAttemptCount int `json:"InvalidLoginAttemptCount"` LoginAttemptsBeforeLockout int `json:"LoginAttemptsBeforeLockout"` MaxActiveSessions int `json:"MaxActiveSessions"` EnablePublicSharing bool `json:"EnablePublicSharing"` BlockedMediaFolders []interface{} `json:"BlockedMediaFolders"` BlockedChannels []interface{} `json:"BlockedChannels"` RemoteClientBitrateLimit int `json:"RemoteClientBitrateLimit"` AuthenticationProviderID string `json:"AuthenticationProviderId"` PasswordResetProviderID string `json:"PasswordResetProviderId"` SyncPlayAccess string `json:"SyncPlayAccess"` }
type ServerInfo ¶
type ServerInfo struct { LocalAddress string `json:"LocalAddress"` Name string `json:"ServerName"` Version string `json:"Version"` OS string `json:"OperatingSystem"` ID string `json:"Id"` }
ServerInfo stores info about the server.
type SessionInfo ¶
type Time ¶
Time embeds time.Time with a custom JSON Unmarshal method to work with Jellyfin & Emby's time formatting.
func (*Time) UnmarshalJSON ¶
type User ¶
type User struct { Name string `json:"Name"` ServerID string `json:"ServerId"` ID string `json:"Id"` HasPassword bool `json:"HasPassword"` HasConfiguredPassword bool `json:"HasConfiguredPassword"` HasConfiguredEasyPassword bool `json:"HasConfiguredEasyPassword"` EnableAutoLogin bool `json:"EnableAutoLogin"` LastLoginDate Time `json:"LastLoginDate"` LastActivityDate Time `json:"LastActivityDate"` Configuration Configuration `json:"Configuration"` // Policy stores the user's permissions. Policy Policy `json:"Policy"` }