Merge pull request #381 from natilou/playlists-cached
chore: Delete cache playlists when playlists are modified
This commit is contained in:
@@ -39,10 +39,12 @@ func (s *subsonicMediaProvider) SetPrefetchCoverCallback(cb func(coverArtID stri
|
||||
}
|
||||
|
||||
func (s *subsonicMediaProvider) CreatePlaylist(name string, trackIDs []string) error {
|
||||
s.playlistsCached = nil
|
||||
return s.client.CreatePlaylistWithTracks(trackIDs, map[string]string{"name": name})
|
||||
}
|
||||
|
||||
func (s *subsonicMediaProvider) DeletePlaylist(id string) error {
|
||||
s.playlistsCached = nil
|
||||
return s.client.DeletePlaylist(id)
|
||||
}
|
||||
|
||||
@@ -51,6 +53,7 @@ func (s *subsonicMediaProvider) CanMakePublicPlaylist() bool {
|
||||
}
|
||||
|
||||
func (s *subsonicMediaProvider) EditPlaylist(id, name, description string, public bool) error {
|
||||
s.playlistsCached = nil
|
||||
return s.client.UpdatePlaylist(id, map[string]string{
|
||||
"name": name,
|
||||
"comment": description,
|
||||
@@ -59,10 +62,12 @@ func (s *subsonicMediaProvider) EditPlaylist(id, name, description string, publi
|
||||
}
|
||||
|
||||
func (s *subsonicMediaProvider) AddPlaylistTracks(id string, trackIDsToAdd []string) error {
|
||||
s.playlistsCached = nil
|
||||
return s.client.UpdatePlaylistTracks(id, trackIDsToAdd, nil)
|
||||
}
|
||||
|
||||
func (s *subsonicMediaProvider) RemovePlaylistTracks(id string, removeIdxs []int) error {
|
||||
s.playlistsCached = nil
|
||||
return s.client.UpdatePlaylistTracks(id, nil, removeIdxs)
|
||||
}
|
||||
|
||||
@@ -242,6 +247,7 @@ func (s *subsonicMediaProvider) GetTopTracks(artist mediaprovider.Artist, count
|
||||
}
|
||||
|
||||
func (s *subsonicMediaProvider) ReplacePlaylistTracks(playlistID string, trackIDs []string) error {
|
||||
s.playlistsCached = nil
|
||||
return s.client.CreatePlaylistWithTracks(trackIDs, map[string]string{"playlistId": playlistID})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user