Help us shape the future of Go! Take the 2026 Go Developer Survey

mpdconn

package module
v0.0.0-...-577df36 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2019 License: GPL-3.0 Imports: 8 Imported by: 0

README

mpdconn

GitHub GitHub release (latest by date) Build Status Go Report Card GoDoc

Simple wrapper around a TCP connection to an MPD daemon with very basic functionality. This library is used by Leixb/MPD_goclient

It can make requests and return the reponse as a map and download an album cover to a file.

Example

package main

import (
	"fmt"
	"github.com/Leixb/mpdconn"
)

func main() {

	MPDCon, err := mpdconn.NewMpdConn("localhost:6600")
	if err != nil {
		fmt.Println(err)
		return
	}

	resp, err := MPDCon.Request("status")
	if err != nil {
		fmt.Println(err)
		return
	}

	fmt.Println(resp)

}
map[audio:44100:16:2 bitrate:1167 consume:0 duration:203.782 elapsed:72.215 mixrampdb:0.000000 nextsong:116 nextsongid:117 playlist:2 playlistlength:120 random:0 repeat:0 single:0 song:115 songid:116 state:play time:72:204]

Documentation

Overview

Package mpdconn provides a simple wrapper around a TCP connection to an MPD daemon with very basic functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MpdConn

type MpdConn struct {
	// contains filtered or unexported fields
}

MpdConn MPD connection object

func NewMpdConn

func NewMpdConn(URL string) (*MpdConn, error)

NewMpdConn creates a new MpdConn object to the MPD server at URL and checks that the connection can be established

func (MpdConn) DownloadCover

func (m MpdConn) DownloadCover(name string, file *os.File) error

DownloadCover downloads the cover for the song specified into the given file

func (MpdConn) Request

func (m MpdConn) Request(req string) (map[string]string, error)

Request sends a request to the MPD daemon and returns the answer as a map

Jump to

Keyboard shortcuts

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