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
+10
View File
@@ -12,6 +12,7 @@ type Playlists interface {
GetAll() (domain.Playlists, error)
Get(id string) (*PlaylistInfo, error)
Create(name string, ids []string) error
Delete(id string) error
}
func NewPlaylists(itunes itunesbridge.ItunesControl, pr domain.PlaylistRepository, mr domain.MediaFileRepository) Playlists {
@@ -47,6 +48,15 @@ func (p *playlists) Create(name string, ids []string) error {
return nil
}
func (p *playlists) Delete(id string) error {
err := p.itunes.DeletePlaylist(id)
if err != nil {
return err
}
beego.Info(fmt.Sprintf("Deleted playlist with id '%s'", id))
return nil
}
func (p *playlists) Get(id string) (*PlaylistInfo, error) {
pl, err := p.plsRepo.Get(id)
if err != nil {