Skip to content

tpcarlson/go-gdm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

go GDM package

go package to browse Plex server / players with GDM.

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 WatchPlayer(name string) (chan *GDMWatcher, error)
func WatchServers(freq int) (chan *GDMWatcher, error)
func WatchServer(name string) (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

  • Go 100.0%