Skip to content

cnf/go-gdm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go GDM package

go package to browse Plex server / players with GDM.

Based on the work, and with the help of Tobias Hieta tobias@plexapp.com

Documentation

godoc Build Status

gdmbrowser

To install the gdmbrowser binary run, including the ... at the end

go get github.com/cnf/go-gdm/...

If you have $GOPATH/bin in your path, you can then run gdmbrowser -h

Available functions

func GetPlayers() ([]*GDMMessage, error)
func GetPlayer(name string) (*GDMMessage, error)
func GetServers() ([]*GDMMessage, error)
func GetServer(name string) (*GDMMessage, error)

func WatchPlayers(freq int) (chan *GDMWatcher, error)
func WatchServers(freq int) (chan *GDMWatcher, error)

GDMMessage

type GDMMessage struct {
    Address *net.UDPAddr
    Added bool
    Props map[string]string
}

GDMWatcher

type GDMWatcher struct {
    Watch chan *GDMMessage
    closer chan bool
}

func (w *GDMWatcher) Close()

Examples

box, err := gdm.GetServer("someName")
if err != nil {
    fmt.Println(err.Error())
} else {
    fmt.Printf("%# v\n", box.Props["Name"])
}
w, cerr := gdm.WatchServers(5)
if cerr != nil {
    // Error handling
} else {
    i := 0
    fmt.Printf("%# v\n", w)
    fmt.Println("================")
    for gdm := range w.Watch {
        fmt.Printf("%02d ++++++++++++++\n", i)
        fmt.Printf("%# v\n", gdm)
        i++
        if i >= 10 {
            w.Close() // Call close to quit to clean up.
        }
    }
}

About

Plex.tv GDM client as a go package

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages