func (p *Playlist) Add(path index.Path) {
	p.items = append(p.items, newItem(path))
}
Add adds a new with the path to the Playlist.
package playlist
import (
	"encoding/json"
	"fmt"
	"tchaik.com/index"
)
type Transformer interface {
	Transform() string
}
type RemovePath index.Path
func (RemovePath) Transform() string {
	return "remove"
}
func (r RemovePath) MarshalJSON() ([]byte, error) {
	exp := struct {
		Action string     `json:"action"`
		Path   index.Path `json:"path"`
	}{
		Action: r.Transform(),
		Path:   index.Path(r),
	}
	return json.Marshal(exp)
}
type Item struct {
	path       index.Path
	transforms []Transformer
}
func newItem(path index.Path) *Item {
	return &Item{
		path: path,
	}
}
func (i *Item) AddTransform(t Transformer) {
	i.transforms = append(i.transforms, t)
}
func (i *Item) MarshalJSON() ([]byte, error) {
	exp := struct {
		Path       index.Path    `json:"path"`
		Transforms []Transformer `json:"transforms"`
	}{
		Path:       i.path,
		Transforms: i.transforms,
	}
	return json.Marshal(exp)
}
func (i *Item) UnmarshalJSON(b []byte) error {
	exp := struct {
		Path       index.Path               `json:"path"`
		Transforms []map[string]interface{} `json:"transforms"`
	}{}
	err := json.Unmarshal(b, &exp)
	if err != nil {
		return err
	}
	transforms := make([]Transformer, 0, len(exp.Transforms))
	for _, t := range exp.Transforms {
		if t["action"] == "remove" {
			p, err := index.PathFromJSONInterface(t["path"])
			if err != nil {
				return fmt.Errorf("invalid format for path: %v", t["path"])
			}
			transforms = append(transforms, RemovePath(p))
		}
	}
	i.path = exp.Path
	i.transforms = transforms
	return nil
}
type Playlist struct {
	items []*Item
}
func (p *Playlist) MarshalJSON() ([]byte, error) {
	exp := struct {
		Items []*Item `json:"items"`
	}{
		p.items,
	}
	return json.Marshal(exp)
}
func (p *Playlist) UnmarshalJSON(b []byte) error {
	exp := struct {
		Items []*Item `json:"items"`
	}{}
	err := json.Unmarshal(b, &exp)
	if err != nil {
		return err
	}
	p.items = exp.Items
	return nil
}