chore: Delete cache playlists when playlists are modified
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"image"
|
"image"
|
||||||
"io"
|
"io"
|
||||||
|
"log"
|
||||||
"math"
|
"math"
|
||||||
"net/url"
|
"net/url"
|
||||||
"slices"
|
"slices"
|
||||||
@@ -39,10 +40,12 @@ func (s *subsonicMediaProvider) SetPrefetchCoverCallback(cb func(coverArtID stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *subsonicMediaProvider) CreatePlaylist(name string, trackIDs []string) error {
|
func (s *subsonicMediaProvider) CreatePlaylist(name string, trackIDs []string) error {
|
||||||
|
s.playlistsCached = nil
|
||||||
return s.client.CreatePlaylistWithTracks(trackIDs, map[string]string{"name": name})
|
return s.client.CreatePlaylistWithTracks(trackIDs, map[string]string{"name": name})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *subsonicMediaProvider) DeletePlaylist(id string) error {
|
func (s *subsonicMediaProvider) DeletePlaylist(id string) error {
|
||||||
|
s.playlistsCached = nil
|
||||||
return s.client.DeletePlaylist(id)
|
return s.client.DeletePlaylist(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,6 +54,7 @@ func (s *subsonicMediaProvider) CanMakePublicPlaylist() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *subsonicMediaProvider) EditPlaylist(id, name, description string, public bool) error {
|
func (s *subsonicMediaProvider) EditPlaylist(id, name, description string, public bool) error {
|
||||||
|
s.playlistsCached = nil
|
||||||
return s.client.UpdatePlaylist(id, map[string]string{
|
return s.client.UpdatePlaylist(id, map[string]string{
|
||||||
"name": name,
|
"name": name,
|
||||||
"comment": description,
|
"comment": description,
|
||||||
@@ -59,10 +63,12 @@ func (s *subsonicMediaProvider) EditPlaylist(id, name, description string, publi
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *subsonicMediaProvider) AddPlaylistTracks(id string, trackIDsToAdd []string) error {
|
func (s *subsonicMediaProvider) AddPlaylistTracks(id string, trackIDsToAdd []string) error {
|
||||||
|
s.playlistsCached = nil
|
||||||
return s.client.UpdatePlaylistTracks(id, trackIDsToAdd, nil)
|
return s.client.UpdatePlaylistTracks(id, trackIDsToAdd, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *subsonicMediaProvider) RemovePlaylistTracks(id string, removeIdxs []int) error {
|
func (s *subsonicMediaProvider) RemovePlaylistTracks(id string, removeIdxs []int) error {
|
||||||
|
s.playlistsCached = nil
|
||||||
return s.client.UpdatePlaylistTracks(id, nil, removeIdxs)
|
return s.client.UpdatePlaylistTracks(id, nil, removeIdxs)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,6 +248,7 @@ func (s *subsonicMediaProvider) GetTopTracks(artist mediaprovider.Artist, count
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *subsonicMediaProvider) ReplacePlaylistTracks(playlistID string, trackIDs []string) error {
|
func (s *subsonicMediaProvider) ReplacePlaylistTracks(playlistID string, trackIDs []string) error {
|
||||||
|
s.playlistsCached = nil
|
||||||
return s.client.CreatePlaylistWithTracks(trackIDs, map[string]string{"playlistId": playlistID})
|
return s.client.CreatePlaylistWithTracks(trackIDs, map[string]string{"playlistId": playlistID})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user