deletePlaylist

This commit is contained in:
Deluan
2016-03-24 12:17:35 -04:00
parent 52850c6ef0
commit a27803a4d1
4 changed files with 30 additions and 0 deletions
+9
View File
@@ -14,6 +14,7 @@ type ItunesControl interface {
SetTrackRating(trackId string, rating int) error
SetAlbumRating(trackId string, rating int) error
CreatePlaylist(name string, ids []string) (string, error)
DeletePlaylist(id string) error
}
func NewItunesControl() ItunesControl {
@@ -39,6 +40,14 @@ func (c *itunesControl) CreatePlaylist(name string, ids []string) (string, error
return strings.TrimSuffix(pid, "\n"), nil
}
func (c *itunesControl) DeletePlaylist(id string) error {
script := Script{
fmt.Sprintf(`set pls to the first item of (every playlist whose persistent ID is equal to "%s")`, id),
`delete pls`,
}
return script.Run()
}
func (c *itunesControl) MarkAsPlayed(trackId string, playDate time.Time) error {
script := Script{fmt.Sprintf(
`set theTrack to the first item of (every track whose persistent ID is equal to "%s")`, trackId),