go-caster

command module
v0.0.0-...-cef0945 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

README

go-caster

testing

forked from github.com/vishen/go-chromecast

goal

  • make a easy to use library for chromecast with documentation and examples

TODOs

  • remove everything that is not needed to control a chromecast
  • error handling
  • fix race conditions
  • remove more stuff

removed libs

  • github.com/mitchellh/go-homedir
  • github.com/pkg/errors
  • github.com/sirupsen/logrus
  • github.com/h2non/filetype

use

Discover cast devices
package main

import (
	"context"
	"fmt"
	"log"
	"net"
	"strings"
	"time"

	"github.com/ConfusedManbird/go-caster/dns"
)


func discoverCastDevices(i *net.Interface) {
	ctx, timeout := context.WithTimeout(context.Background(), time.Duration(1)*time.Second)
	entries, err := dns.DiscoverCastDNSEntries(ctx, i)
	if err != nil {
		log.Fatalf("ERROR:: ::%v\n", err)
	}
	defer timeout()
	for entry := range entries {
		fmt.Printf("Device: %s\n  Name: %s\n  IP: %s\n  Port: %d\n", entry.GetUUID(), entry.GetName(), entry.GetAddr(), entry.GetPort())
	}
}



func main() {
	iFaces, _ := net.Interfaces()
	for _, iFace := range iFaces {
		addrs, _ := iFace.Addrs()
		for _, addr := range addrs {
			if strings.Contains(addr.String(), "/24") {
				discoverCastDevices(&iFace)
			}
		}
	}
}
cast "big buck bunny"
package main

import (
	"github.com/ConfusedManbird/go-caster/application"
	"log"
)

func main() {
	uri :=  "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
	castAddress := "10.0.0.23"
	app := application.NewApplication()
	if err := app.Start(castAddress, 8009); err != nil {
		log.Printf("ERROR::unable to start application::%v\n", err)
		return
	}
	if err := app.LoadApp("CC1AD845", uri); err != nil {
		log.Printf("ERROR::app.LoadApp()::%v\n", err)
	}
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
proto
Package api is a generated protocol buffer package.
Package api is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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