Documentation
¶
Overview ¶
Package vlcctrl provides functions to control VLC instances through the web API.
Index ¶
- type Equalizer
- type File
- type Information
- type Node
- type Stats
- type Status
- type VLC
- func (instance *VLC) Add(uri string) (err error)
- func (instance *VLC) AddStart(uri string, option ...string) (err error)
- func (instance *VLC) AddSubtitle(uri string) (err error)
- func (instance *VLC) Art(itemID ...int) (byteArr []byte, err error)
- func (instance *VLC) AspectRatio(ratio string) (err error)
- func (instance *VLC) AudioDelay(delay float64) (err error)
- func (instance *VLC) Browse(uri string) (files []File, err error)
- func (instance *VLC) Delete(id int) (err error)
- func (instance *VLC) EmptyPlaylist() (err error)
- func (instance *VLC) ForcePause() (err error)
- func (instance *VLC) GetStatus() (status Status, err error)
- func (instance *VLC) Next() (err error)
- func (instance *VLC) Pause(itemID ...int) (err error)
- func (instance *VLC) Play(itemID ...int) (err error)
- func (instance *VLC) PlaybackRate(rate float64) (err error)
- func (instance *VLC) Playlist() (playlist Node, err error)
- func (instance *VLC) Preamp(gain int) (err error)
- func (instance *VLC) Previous() (err error)
- func (instance *VLC) RequestMaker(urlSegment string) (response string, err error)
- func (instance *VLC) Resume() (err error)
- func (instance *VLC) Seek(val string) (err error)
- func (instance *VLC) SelectAudioTrack(id int) (err error)
- func (instance *VLC) SelectChapter(id int) (err error)
- func (instance *VLC) SelectSubtitleTrack(id int) (err error)
- func (instance *VLC) SelectTitle(id int) (err error)
- func (instance *VLC) SelectVideoTrack(id int) (err error)
- func (instance *VLC) SetEQ(band int, gain int) (err error)
- func (instance *VLC) SetEQPreset(id int) (err error)
- func (instance *VLC) Sort(id int, val int) (err error)
- func (instance *VLC) Stop() (err error)
- func (instance *VLC) SubDelay(delay float64) (err error)
- func (instance *VLC) ToggleEQ(enable bool) (err error)
- func (instance *VLC) ToggleFullscreen() (err error)
- func (instance *VLC) ToggleLoop() (err error)
- func (instance *VLC) ToggleRandom() (err error)
- func (instance *VLC) ToggleRepeat() (err error)
- func (instance *VLC) ToggleSD(val string) (err error)
- func (instance *VLC) Vlm() (response string, err error)
- func (instance *VLC) VlmCmd(cmd string) (response string, err error)
- func (instance *VLC) VlmCmdErr() (response string, err error)
- func (instance *VLC) Volume(val string) (err error)
- type VideoEffects
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Equalizer ¶ added in v0.4.0
type Equalizer struct { Presets map[string]string `json:"presets"` Bands map[string]string `json:"bands"` Preamp int `json:"preamp"` }
Equalizer contains information related to the equalizer configuration. An Equalizer variable is included in Status
type File ¶ added in v0.5.0
type File struct { Type string `json:"type"` // file or dir Path string `json:"path"` Name string `json:"name"` AccessTime uint `json:"access_time"` UID uint `json:"uid"` CreationTime uint `json:"creation_time"` GID uint `json:"gid"` ModificationTime uint `json:"modification_time"` Mode uint `json:"mode"` URI string `json:"uri"` Size uint `json:"size"` }
File struct represents a single item in the browsed directory. Can be a file or a dir
func ParseBrowse ¶ added in v0.4.0
ParseBrowse parses Browse() responses to []File
type Information ¶ added in v0.4.0
type Information struct { Chapter int `json:"chapter"` // TODO: Chapters definition might need to be changed Chapters []interface{} `json:"chapters"` Title int `json:"title"` // TODO: Category definition might need to be updated/modified Category map[string]struct { Filename string `json:"filename"` Codec string `json:"Codec"` Channels string `json:"Channels"` BitsPerSample string `json:"Bits_per_sample"` Type string `json:"Type"` SampleRate string `json:"Sample_rate"` } `json:"category"` Titles []interface{} `json:"titles"` }
Information contains information related to the item currently being played. It is also part of Status
type Node ¶ added in v0.4.0
type Node struct { Ro string `json:"ro"` Type string `json:"type"` // node or leaf Name string `json:"name"` ID string `json:"id"` Duration int `json:"duration,omitempty"` URI string `json:"uri,omitempty"` Current string `json:"current,omitempty"` Children []Node `json:"children,omitempty"` }
Node structure (node or leaf type) is the basic element of VLC's playlist tree representation. Leafs are playlist items. Nodes are playlists or folders inside playlists.
func ParsePlaylist ¶ added in v0.4.0
ParsePlaylist parses Playlist() responses to Node
type Stats ¶ added in v0.4.0
type Stats struct { InputBitRate float64 `json:"inputbitrate"` SentBytes uint `json:"sentbytes"` LosABuffers uint `json:"lostabuffers"` AveragedEMuxBitrate float64 `json:"averagedemuxbitrate"` ReadPackets uint `json:"readpackets"` DemuxReadPackets uint `json:"demuxreadpackets"` LostPictures uint `json:"lostpictures"` DisplayedPictures uint `json:"displayedpictures"` SentPackets uint `json:"sentpackets"` DemuxReadBytes uint `json:"demuxreadbytes"` DemuxBitRate float64 `json:"demuxbitrate"` PlayedABuffers uint `json:"playedabuffers"` DemuxDiscontinuity uint `json:"demuxdiscontinuity"` DecodeAudio uint `json:"decodedaudio"` SendBitRate float64 `json:"sendbitrate"` ReadBytes uint `json:"readbytes"` AverageInputBitRate float64 `json:"averageinputbitrate"` DemuxCorrupted uint `json:"demuxcorrupted"` DecodedVideo uint `json:"decodedvideo"` }
Stats contains certain statistics of a VLC instance. A Stats variable is included in Status
type Status ¶ added in v0.4.0
type Status struct { // TODO: The Status structure is still a work in progress Fullscreen bool `json:"fullscreen"` Stats Stats `json:"stats"` AspectRatio string `json:"aspectratio"` AudioDelay float64 `json:"audiodelay"` APIVersion uint `json:"apiversion"` CurrentPlID uint `json:"currentplid"` Time uint `json:"time"` Volume uint `json:"volume"` Length uint `json:"length"` Random bool `json:"random"` AudioFilters map[string]string `json:"audiofilters"` Rate float64 `json:"rate"` VideoEffects VideoEffects `json:"videoeffects"` State string `json:"state"` Loop bool `json:"loop"` Version string `json:"version"` Position float64 `json:"position"` Information Information `json:"information"` Repeat bool `json:"repeat"` SubtitleDelay float64 `json:"subtitledelay"` Equalizer Equalizer `json:"equalizer"` }
Status contains information related to the VLC instance status. Use parseStatus to parse the response from a status.go function.
func ParseStatus ¶ added in v0.4.0
ParseStatus parses GetStatus() responses to Status struct.
type VLC ¶ added in v0.3.0
VLC struct represents an http interface enabled VLC instance. Build using NewVLC()
func NewVLC ¶
NewVLC builds and returns a VLC struct using the IP, Port and Password of the VLC instance
func (*VLC) AddStart ¶ added in v0.3.0
AddStart adds a URI to the playlist and starts playback. The option field is optional and can have the values: noaudio, novideo
func (*VLC) AddSubtitle ¶ added in v0.3.0
AddSubtitle adds a subtitle from URI to currently playing file
func (*VLC) Art ¶ added in v0.3.0
Art fetches cover art based on a playlist item's ID. If no ID is provided, Art returns the current item's cover art. Cover art is returned in the form of a byte array.
func (*VLC) AspectRatio ¶ added in v0.3.0
AspectRatio sets aspect ratio. Must be one of the following values. Any other value will reset aspect ratio to default. Valid aspect ratio values: 1:1 , 4:3 , 5:4 , 16:9 , 16:10 , 221:100 , 235:100 , 239:100
func (*VLC) AudioDelay ¶ added in v0.3.0
AudioDelay sets Audio Delay in seconds
func (*VLC) Browse ¶ added in v0.3.0
Browse returns a File array with the items of the provided directory URI
func (*VLC) EmptyPlaylist ¶ added in v0.3.0
EmptyPlaylist empties the playlist
func (*VLC) ForcePause ¶ added in v0.3.0
ForcePause pauses playback, does nothing if already paused
func (*VLC) GetStatus ¶ added in v0.4.0
GetStatus returns a Status object containing information of the instances' status
func (*VLC) Pause ¶ added in v0.3.0
Pause toggles pause: If current state was 'stop', play item with given id, if no id specified, play current item. If no current item, play the first item in the playlist.
func (*VLC) Play ¶ added in v0.3.0
Play playlist item with given id. If id is omitted, play last active item
func (*VLC) PlaybackRate ¶ added in v0.3.0
PlaybackRate sets Playback Rate. Must be > 0
func (*VLC) Playlist ¶ added in v0.3.0
Playlist returns a Node object that is the root node of VLC's Playlist tree Playlist tree structure: Level 0 - Root Node (Type="node"), Level 1 - Playlists (Type="node"), Level 2+: Playlist Items (Type="leaf") or Folder (Type="node")
func (*VLC) RequestMaker ¶ added in v0.3.0
RequestMaker make requests to VLC using a urlSegment provided by other functions
func (*VLC) Seek ¶ added in v0.3.0
Seek seeks to <val>
Allowed values are of the form: [+ or -][<int><H or h>:][<int><M or m or '>:][<int><nothing or S or s or ">] or [+ or -]<int>% (value between [ ] are optional, value between < > are mandatory) examples: 1000 -> seek to the 1000th second +1H:2M -> seek 1 hour and 2 minutes forward -10% -> seek 10% back
func (*VLC) SelectAudioTrack ¶ added in v0.3.0
SelectAudioTrack selects the audio track (use the number from the stream)
func (*VLC) SelectChapter ¶ added in v0.3.0
SelectChapter selects the chapter using the chapter number
func (*VLC) SelectSubtitleTrack ¶ added in v0.3.0
SelectSubtitleTrack selects the subtitle track (use the number from the stream)
func (*VLC) SelectTitle ¶ added in v0.3.0
SelectTitle selects the title using the title number
func (*VLC) SelectVideoTrack ¶ added in v0.3.0
SelectVideoTrack selects the video track (use the number from the stream)
func (*VLC) SetEQPreset ¶ added in v0.3.0
SetEQPreset sets the equalizer preset as per the id specified
func (*VLC) Sort ¶ added in v0.3.0
Sort sorts playlist using sort mode <val> and order <id>. If id=0 then items will be sorted in normal order, if id=1 they will be sorted in reverse order. A non exhaustive list of sort modes: 0 Id, 1 Name, 3 Author, 5 Random, 7 Track number.
func (*VLC) ToggleFullscreen ¶ added in v0.3.0
ToggleFullscreen toggles Fullscreen mode
func (*VLC) ToggleLoop ¶ added in v0.3.0
ToggleLoop toggles Random Playback
func (*VLC) ToggleRandom ¶ added in v0.3.0
ToggleRandom toggles Repeat
func (*VLC) ToggleRepeat ¶ added in v0.3.0
ToggleRepeat toggles Playback Looping
func (*VLC) ToggleSD ¶ added in v0.3.0
ToggleSD toggle-enables service discovery module <val>. Typical values are: sap shoutcast, podcast, hal
func (*VLC) VlmCmd ¶ added in v0.3.0
VlmCmd executes a VLM Command and returns the response. Command is internally URL percent-encoded
type VideoEffects ¶ added in v0.4.0
type VideoEffects struct { Hue int `json:"hue"` Saturation int `json:"saturation"` Contrast int `json:"contrast"` Brightness int `json:"brightness"` Gamma int `json:"gamma"` }
VideoEffects contains the current video effects configuration. A VideoEffects variable is included in Status