-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
1,193 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/djthorpe/gopi/v3" | ||
) | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
// TYPES | ||
|
||
type app struct { | ||
gopi.Unit | ||
gopi.Logger | ||
gopi.CastService | ||
gopi.PingService | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
// LIFECYCLE | ||
|
||
func (this *app) Run(ctx context.Context) error { | ||
|
||
// Wait for interrupt | ||
fmt.Println("Press CTRL+C to end") | ||
<-ctx.Done() | ||
|
||
return ctx.Err() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
|
||
tool "github.com/djthorpe/gopi/v3/pkg/tool" | ||
) | ||
|
||
func main() { | ||
os.Exit(tool.Server("googlecast", os.Args[1:], new(app))) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package main | ||
|
||
import ( | ||
_ "github.com/djthorpe/gopi/v3/pkg/dev/googlecast" | ||
_ "github.com/djthorpe/gopi/v3/pkg/event" | ||
_ "github.com/djthorpe/gopi/v3/pkg/mdns" | ||
_ "github.com/djthorpe/gopi/v3/pkg/rpc/googlecast" | ||
_ "github.com/djthorpe/gopi/v3/pkg/rpc/ping" | ||
_ "github.com/djthorpe/gopi/v3/pkg/rpc/server" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"net/url" | ||
"os" | ||
|
||
gopi "github.com/djthorpe/gopi/v3" | ||
table "github.com/djthorpe/gopi/v3/pkg/table" | ||
) | ||
|
||
func (this *app) RunCast(ctx context.Context, stub gopi.CastStub) error { | ||
casts, err := stub.ListCasts(ctx) | ||
if err != nil { | ||
return err | ||
} else if len(casts) == 0 { | ||
return gopi.ErrNotFound | ||
} | ||
|
||
// Display platform information | ||
table := table.New() | ||
|
||
table.SetHeader(header{"Name"}, header{"Id"}, header{"Model"}, header{"Service"}, header{"State"}) | ||
for _, cast := range casts { | ||
table.Append(cast.Name(), cast.Id(), cast.Model(), cast.Service(), cast.State()) | ||
} | ||
table.Render(os.Stdout) | ||
|
||
// Return success | ||
return nil | ||
} | ||
|
||
func (this *app) RunCastApp(ctx context.Context, stub gopi.CastStub) error { | ||
if err := stub.SetApp(ctx, *this.castId, gopi.CAST_APPID_MUTABLEMEDIA); err != nil { | ||
return err | ||
} | ||
|
||
// Return success | ||
return nil | ||
} | ||
|
||
func (this *app) RunCastLoad(ctx context.Context, stub gopi.CastStub) error { | ||
if u, err := url.Parse("http://aurl/"); err != nil { | ||
return err | ||
} else if err := stub.LoadURL(ctx, *this.castId, u); err != nil { | ||
return err | ||
} | ||
|
||
// Return success | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
package main | ||
|
||
import ( | ||
_ "github.com/djthorpe/gopi/v3/pkg/event" // gopi.Publisher | ||
_ "github.com/djthorpe/gopi/v3/pkg/log" // gopi.Logger | ||
_ "github.com/djthorpe/gopi/v3/pkg/mdns" // Multicast DNS | ||
_ "github.com/djthorpe/gopi/v3/pkg/metrics" // Metrics Platform | ||
_ "github.com/djthorpe/gopi/v3/pkg/rpc/client" // gRPC Client | ||
_ "github.com/djthorpe/gopi/v3/pkg/rpc/metrics" // Metrics Service | ||
_ "github.com/djthorpe/gopi/v3/pkg/rpc/ping" // Ping Service | ||
_ "github.com/djthorpe/gopi/v3/pkg/rpc/server" // gRPC Server | ||
_ "github.com/djthorpe/gopi/v3/pkg/event" // gopi.Publisher | ||
_ "github.com/djthorpe/gopi/v3/pkg/log" // gopi.Logger | ||
_ "github.com/djthorpe/gopi/v3/pkg/mdns" // Multicast DNS | ||
_ "github.com/djthorpe/gopi/v3/pkg/metrics" // Metrics Platform | ||
_ "github.com/djthorpe/gopi/v3/pkg/rpc/client" // gRPC Client | ||
_ "github.com/djthorpe/gopi/v3/pkg/rpc/googlecast" // Googlecast Service | ||
_ "github.com/djthorpe/gopi/v3/pkg/rpc/metrics" // Metrics Service | ||
_ "github.com/djthorpe/gopi/v3/pkg/rpc/ping" // Ping Service | ||
_ "github.com/djthorpe/gopi/v3/pkg/rpc/server" // gRPC Server | ||
) |
Oops, something went wrong.