Example #1
0
File: cmd.go Project: ushis/webmpc
func setPlaylist(cmd *Cmd, conn *mpd.Client) (*Result, error) {
	list := conn.BeginCommandList()
	list.Clear()

	for _, uri := range cmd.Uris {
		list.Add(uri)
	}
	list.Play(0)

	return nil, list.End()
}
Example #2
0
File: cmd.go Project: ushis/webmpc
func addMulti(cmd *Cmd, conn *mpd.Client) (*Result, error) {
	list := conn.BeginCommandList()

	for i, uri := range cmd.Uris {
		if cmd.Pos < 0 {
			list.Add(uri)
		} else {
			list.AddId(uri, cmd.Pos+i)
		}
	}
	return nil, list.End()
}