plex

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseURL = "https://plex.tv/api"

	SettingIDCustomConnections       = "customConnections"
	SettingIDManualPortMappingMode   = "ManualPortMappingMode"
	SettingIDManualPortMappingPort   = "ManualPortMappingPort"
	SettingIDLastAutomaticMappedPort = "LastAutomaticMappedPort"
)

Variables

This section is empty.

Functions

func WriteConfigFile

func WriteConfigFile(config Config) error

Types

type ApiClient

type ApiClient struct {
	// contains filtered or unexported fields
}

func NewApiClient

func NewApiClient(baseURL string, token string, timeout int) *ApiClient

func (*ApiClient) GetIdentity

func (c *ApiClient) GetIdentity() (IdentityDTO, error)

func (*ApiClient) GetPreferences

func (c *ApiClient) GetPreferences() (PreferencesDTO, error)

func (*ApiClient) GetResources

func (c *ApiClient) GetResources() (ResourcesDTO, error)

func (*ApiClient) UpdateCustomConnections

func (c *ApiClient) UpdateCustomConnections(customConnections string) error

type Config

type Config struct {
	Path        string
	Preferences Preferences
}

func ReadConfigFile

func ReadConfigFile(path string) (Config, error)

type ConnectionDTO

type ConnectionDTO struct {
	Protocol string `xml:"protocol,attr"`
	Address  string `xml:"address,attr"`
	URI      string `xml:"uri,attr"`
	Local    string `xml:"local,attr"`
}

type DeviceDTO

type DeviceDTO struct {
	Name             string          `xml:"name,attr"`
	Product          string          `xml:"product,attr"`
	ClientIdentifier string          `xml:"clientIdentifier,attr"`
	Connections      []ConnectionDTO `xml:"Connection"`
}

func (DeviceDTO) GetLocalConnection

func (d DeviceDTO) GetLocalConnection() (ConnectionDTO, error)

func (DeviceDTO) GetPlexDirectHostname

func (d DeviceDTO) GetPlexDirectHostname() (string, error)

func (DeviceDTO) GetRemoteConnection

func (d DeviceDTO) GetRemoteConnection() (ConnectionDTO, error)

type IdentityDTO

type IdentityDTO struct {
	MachineIdentifier string `xml:"machineIdentifier,attr"`
}

type Preferences

type Preferences map[string]string

func (*Preferences) GetCustomConnections

func (p *Preferences) GetCustomConnections() []string

func (*Preferences) GetMappedPort

func (p *Preferences) GetMappedPort() string

func (*Preferences) GetProcessedMachineIdentifier

func (p *Preferences) GetProcessedMachineIdentifier() string

func (*Preferences) GetToken

func (p *Preferences) GetToken() string

func (*Preferences) MarshalXML

func (p *Preferences) MarshalXML(encoder *xml.Encoder, start xml.StartElement) error

func (*Preferences) UnmarshalXML

func (p *Preferences) UnmarshalXML(decoder *xml.Decoder, start xml.StartElement) error

func (*Preferences) Validate

func (p *Preferences) Validate() error

type PreferencesDTO

type PreferencesDTO struct {
	Settings []SettingDTO `xml:"Setting"`
}

func (PreferencesDTO) GetSettingByID

func (p PreferencesDTO) GetSettingByID(id string) (SettingDTO, error)

type ResourcesDTO

type ResourcesDTO struct {
	Devices []DeviceDTO `xml:"Device"`
}

func (ResourcesDTO) GetDeviceByIdentifier

func (r ResourcesDTO) GetDeviceByIdentifier(clientIdentifier string) (DeviceDTO, error)

type SettingDTO

type SettingDTO struct {
	ID    string `xml:"id,attr"`
	Type  string `xml:"type,attr"`
	Value string `xml:"value,attr"`
}

func (SettingDTO) IsEnabledBoolSetting

func (s SettingDTO) IsEnabledBoolSetting() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL