amcp

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2020 License: MIT Imports: 7 Imported by: 0

README

amcp

amcp is a Go client implementation of the Advanced Media Control Protocol (AMCP) mainly used with CasparCG Server.

Installation

Install using the "go get" command:

go get github.com/sean-callahan/amcp

This package only relies on the Go standard library.

License

This package is available under the MIT License

Documentation

Overview

Package amcp implements the Advanced Media Control Protocol as defined here: https://github.com/CasparCG/help/wiki/AMCP-Protocol.

Example
package main

import (
	"log"

	"github.com/sean-callahan/amcp"
)

func main() {
	// Connect to the remote AMCP server.
	c, err := amcp.Dial("127.0.0.1:5250")
	if err != nil {
		log.Fatal(err)
	}
	defer c.Close()

	// Send the PLAY command to make channel 1 white.
	_, _, err = c.Do("PLAY", 1, "#FFFFFF")
	if err != nil {
		log.Fatal(err)
	}
}
Output:

Index

Examples

Constants

View Source
const (
	ReturnInfo     = 100
	ReturnInfoLine = 101

	ReturnOkMulti = 200
	ReturnOkData  = 201
	ReturnOk      = 202

	ReturnClientError         = 400
	ReturnIllegalVideoChannel = 401
	ReturnParameterMissing    = 402
	ReturnIllegalParameter    = 403
	ReturnMediaNotFound       = 404

	ReturnServerError        = 500
	ReturnServerErrorCommand = 501
	ReturnMediaUnreachable   = 502
	ReturnAccessError        = 503
)

Return codes

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Timeout time.Duration
	// contains filtered or unexported fields
}

A Client represents a client connection to an AMCP server.

func Dial

func Dial(addr string) (*Client, error)

Dial returns a new Client connected to an AMCP server at addr.

func (*Client) Close

func (c *Client) Close() error

Close closes the network connection.

func (*Client) Do

func (c *Client) Do(cmd string, args ...interface{}) (code int, data interface{}, err error)

Do sends a command to the server and returns the reply. If the server returned multiple lines of data, data is a []string, otherwise it's a string.

Jump to

Keyboard shortcuts

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